简体   繁体   English

Eclipse Package Explorer中的项目

[英]Projects from Eclipse Package Explorer

I develop an Eclipse plugin project, I started a few days ago and I have a question. 我开发了一个Eclipse插件项目,该项目是几天前开始的,我有一个问题。 My plugin works, my plugin toolbar has a button, named Extract the project. 我的插件正常工作,我的插件工具栏上有一个按钮,名为“提取项目”。 When I click on this button, the plugin writes the names of the open projects from the Package Explorer. 当我单击此按钮时,插件将从Package Explorer中写入打开的项目的名称。 How I can get the names of the projects from the package explorer? 如何从包资源管理器中获取项目的名称?

I used ISelection, but unfortunately the ISelection object is empty. 我使用了ISelection,但不幸的是ISelection对象为空。 There are three open projects in package explorer. 打包浏览器中有三个打开的​​项目。

Thanks for the answers! 感谢您的回答!

You do not need the selection. 您不需要选择。 You should start with the workspace root and start from there. 您应该从工作空间根目录开始,然后从那里开始。

ResourcesPlugin.getWorkspace().getRoot()

If you want to access the Java nature of a project use 如果要访问项目的Java性质,请使用

JavaCore.create(iProject)

Right click on the project and open the context menu. 右键单击该项目,然后打开上下文菜单。 And go for the menu item "Restore from Local History...". 然后转到菜单项“从本地历史记录中恢复...”。

在此处输入图片说明

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

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