将现有项目文件夹添加到 eclipse 中的项目资源管理器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3924229/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Adding existing project folders to the project explorer in eclipse
提问by Richard Stokes
Probably a very straight forward solution here, but can't seem to find an answer. I recently changed my eclipse workspace to my dropbox folder, so I can work on my netbook when in college and on my desktop when at home. I copied and pasted all my project folders from the old workspace into the dropbox workspace, changed the workspace location in eclipse, but none of the projects are showing up in the project explorer now. Having refreshed the project explorer many times now to no avail, is there any way to add these projects into the project explorer? Thanks
这里可能是一个非常直接的解决方案,但似乎无法找到答案。我最近将我的 eclipse 工作区更改为我的 Dropbox 文件夹,这样我就可以在大学时在上网本上工作,在家里时在桌面上工作。我将旧工作区中的所有项目文件夹复制并粘贴到保管箱工作区中,在 eclipse 中更改了工作区位置,但现在没有任何项目显示在项目资源管理器中。现在多次刷新项目资源管理器都无济于事,有什么办法可以将这些项目添加到项目资源管理器中吗?谢谢
回答by Vijin Paulraj
From the main menu bar, select File > Import. The Import wizard opens.
Collapse or click +in General > Existing Project into Workspaceand click Next.
Choose either Select root directoryor Select archive fileand click the associated Browseto locate the directory or file containing the projects.
Under Projectsselect the project or projects which you would like to import.
Click Finishto start the import.
从主菜单栏中,选择文件 > 导入。导入向导打开。
折叠或单击General > Existing Project into Workspace 中的+,然后单击Next。
选择“选择根目录”或“选择存档文件”,然后单击关联的“浏览”以找到包含项目的目录或文件。
在项目下选择您要导入的一个或多个项目。
单击完成开始导入。
回答by simo.3792
I have had this problem in many versions of Eclipse and followed the process outlined by @vijin-paulraj, but frustratingly kept failing...
我在 Eclipse 的许多版本中都遇到过这个问题,并遵循了@vijin-paulraj 概述的过程,但令人沮丧的是一直失败......
Until I noticed that the checkbox at the bottom of the wizard "Copy projects into workspace" is checked by default, and does not have an eventhandler attached to it. So if you do not clear this box beforeselecting the directory it will tell you that "Some projects cannot be imported because they already exist in the workspace." Clearing the checkbox after this will not trigger a form refresh and the Finish button will remain disabled.
直到我注意到向导底部的复选框“将项目复制到工作区”被默认选中,并且没有附加事件处理程序。因此,如果您在选择目录之前没有清除此框,它会告诉您“某些项目无法导入,因为它们已存在于工作区中”。在此之后清除复选框不会触发表单刷新,并且“完成”按钮将保持禁用状态。
TIP: once the checkbox is cleared, select the directory again will trigger form validation and allow you to proceed.
提示:清除复选框后,再次选择目录将触发表单验证并允许您继续。
回答by Alois Cochard
回答by Xinous
The answer for me was to make sure that I was in the correct working set.
我的答案是确保我在正确的工作集中。
I was in the working set from training and had not placed my new project into a working set at all.
我在训练中处于工作集中,并且根本没有将我的新项目放入工作集中。
While the above answers will most likely place your project into Eclipse, a working set will exclude you from seeing any project that is not placed in it from the package explorer.
虽然上述答案很可能会将您的项目放入 Eclipse,但工作集将使您无法从包资源管理器中看到任何未放入其中的项目。
My personal answer was to create a new working set to keep it separate from work, via the context menu from the upside down triangle at the top left of the package explorer.
我个人的回答是创建一个新的工作集以使其与工作分开,通过包浏览器左上角倒三角形的上下文菜单。
Yours may be to modify your current set by adding the new project to it. This option is also located in the same menu.
您可能会通过向其中添加新项目来修改当前集。此选项也位于同一菜单中。
My circumstance could have been avoided in the "new project" wizard, if I had placed it in a set from there.
如果我从那里把它放在一个集合中,我的情况本可以在“新项目”向导中避免。
I hope this has been useful. Please, feel free to ask for clarification.
我希望这很有用。请随时要求澄清。