标题翻译
How to include an external resource to WorkingSet in Eclipse
问题
我正在开发一个与自定义工作集一起使用的Eclipse插件。这些工作集可以包含来自工作区的项目,还可以包含用户通过向导选择的外部项目。
在选择文件夹后,我的插件将返回一个具有文件夹路径的java.io.File
。现在,我想将此文件夹作为资源添加到我的自定义工作集中。目前,将元素添加到工作集的操作是通过向List<IAdaptable>
添加IAdaptable
的实例来完成的,然后将该列表提供给IWorkingSetManager
,因此将File
转换为类似IResource
或IFolder
的对象应该可以实现。所以我的问题是,如何使我的java.io.File
变为IAdaptable
?
英文翻译
I'm developing an Eclipse Plug-in that is working with custom working sets. Those working sets can contain projects from the workspace but also external projects which are selected by the user through a wizard.
After selecting a folder, my plugin returns a java.io.File
with the path of the folder. Now I'd like to add this folder as a resource to my custom working set. Right now adding elements to working-sets works by adding instances of IAdaptable
to a List<IAdaptable>
, which is then given to the IWorkingSetManager
, so casting/converting the File
to something like IResource
or IFolder
should work. So my question is, how do I make my java.io.File
IAdaptable
?
专注分享java语言的经验与见解,让所有开发者获益!
评论