插件eclipse自动启动产品 [英] Plugin eclipse auto start in product

查看:171
本文介绍了插件eclipse自动启动产品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个加载从加载项目中获得的不同资源的插件。
我试图在早期阶段注册到工作区的ResourceChangeListener,以便我收到添加到工作区的资源的通知。 org.eclipse.ui的ear​​lyStartup太晚了(如果项目已经加载到工作区)。
如何或者哪个扩展点可以用来在我听到工作区资源更改的时候注册我的监听器?

I am trying to create a plugin that loads different resources taken from the loaded project. I am trying to register to ResourceChangeListener of the workspace in an early stage, so that I get notification of the resources that are added to the workspace. The earlyStartup of org.eclipse.ui is too late(If the projects are already loaded to the workspace). How or which extension point can I use in order register my listener in a time that I can listen to the workspace resource changes ?

谢谢
Clint

Thanks, Clint

推荐答案

如果你想知道在工作区中打开的资源(即项目),你可以得到IWorkspace并查看其中包含的项目。

If you want to know the resources (i.e. projects) that are open in a workspace, you can just get the IWorkspace and look at the project contained in it.

IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot rootResource = workspace.getRoot();

然后你应该能够遍历这个树结构来查找所有的资源。希望这有帮助。

Then you should be able to just traverse this tree structure to find out about all the resources. Hope this helps.

以下是一些资源:

  • Resources and File System
  • Resource Changes in Eclipse

这篇关于插件eclipse自动启动产品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆