已加载项目的 Eclipse 插件
我有一个插件,想要检测项目何时添加到工作区,以便从我的插件代码 Any Ideas 设置一些项目设置。
特别是我想在一些派生文件的资源中调用 setHidden ,因为此设置似乎不是项目的一部分,我的意思是,如果我将项目导入到新的工作区中,则只要资源被隐藏,似乎就不会持续存在。
I have a plug-in and want to detect when projects are added to workspace, to set some project settings from my plug-in code, Any Ideas.
Specially i want to call setHidden in some resources that are derived files, as this settings seems to not be part of the project, i mean whenever a resources is hidden seems to not persist if i import the project in a new workspace.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
讽刺的是,我昨天才写了这样的东西。它比你想要的要复杂一些。以下是供您使用的代码片段:
然后,您需要将此 ProjectListener 添加到工作区,最好是在插件激活器的
start
方法中:然后您想在 <代码>停止方法。我昨天刚刚写了这段代码。我希望它有帮助。
Ironically, I just wrote something like this yesterday. It is a bit more complicated than you would like. Here is a code snippet for you to play with:
Then, you need to add this ProjectListener to the Workspace, preferably in the
start
method of your plugin activator:And then you want to remove it in the
stop
method. I literally just wrote this code yesterday. I hope it helps.您可以为工作区定义资源侦听器,并查找资源根中的更改。有关详细信息,请参阅以下文章:http://www.eclipse。 org/articles/Article-Resource-deltas/resource-deltas.html
You can define a resourcelistener to the workspace, and look for changes in the resource root. See the following article for details: http://www.eclipse.org/articles/Article-Resource-deltas/resource-deltas.html