简体   繁体   English

如何使用动态语言工具包(DLTK)将Ruby文件添加到Eclipse 3.6中的现有项目中?

[英]How do you add a ruby file to an existing project in Eclipse 3.6 using the Dynamic Languages Toolkit (DLTK)?

I've installed the Dynamic Languages Toolkit (DLTK) in Eclipse 3.6. 我已经在Eclipse 3.6中安装了Dynamic Languages Toolkit(DLTK)。 But I can't figure out how to create a Ruby file in an existing Java project. 但是我不知道如何在现有的Java项目中创建Ruby文件。

Doing the obvious thing (New -> Empty Ruby Script) just gives the error message "Source folder is not a correct project". 做明显的事情(新建->空Ruby脚本)只会给出错误消息“源文件夹不是正确的项目”。 Do I have to modify the project in some way to tell DLTK that it's OK to add Ruby files to it? 我是否必须以某种方式修改项目以告知DLTK可以向其中添加Ruby文件?

(Adding the file outside of Eclipse does work.) (在Eclipse外部添加文件确实可以。)

Do the following steps (has worked for me): 请执行以下步骤(对我有用):

  1. Create a java project, or visit an existing one. 创建一个Java项目,或访问一个现有的项目。
  2. Select in the directory you want the ruby file to live in the menu entry New file and enter in the dialog the filename my_file.rb . 在菜单项“ New file选择要保存红宝石文件的目录,然后在对话框中输入文件名my_file.rb The essential part is the extension, because this will ensure that the ruby mechanisms are in place. 必不可少的部分是扩展,因为这将确保红宝石机制到位。
  3. Enter in the new ruby file def and press CTRL-SPACE , you should see as a result the list with def - method definition (the template), def and defined? 输入新的红宝石文件def并按CTRL-SPACE ,结果将看到带有def - method definition (模板), defdefined? . This is all part of the ruby text editor. 这全部是ruby文本编辑器的一部分。

So it is possible to mix java and ruby files in the same project, that has as nature java. 因此,可以将java和ruby文件混合在同一个项目中,该项目具有java的性质。 The only thing I has noticed is that the run menu entry only allows you to start the dialog Run As > Run Configurations... and enter there the necessary parameters to start your ruby script. 我唯一注意到的是,运行菜单项仅允许您启动对话框Run As > Run Configurations...并在其中输入必要的参数以启动ruby脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM