Eclipse RCP 中 ImportWizard 的通知
我正在开发一个 Eclipse RCP 应用程序。在此应用程序中,我使用导入向导导入项目。我希望在导入向导结束后收到通知。
请帮我!
I am developing an Eclipse RCP application. In this application I am importing the project using an Import Wizard. I want to get notified after the Import wizard is over.
Please help me!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您启动导入向导时,我会将 org.eclipse.core.resources.IWorkspace.addResourceChangeListener(IResourceChangeListener) 添加到工作区。监视事件并查看导入完成后是否发出 org.eclipse.core.resources.IResourceChangeEvent.POST_CHANGE 。
I would add an
org.eclipse.core.resources.IWorkspace.addResourceChangeListener(IResourceChangeListener)
to the workspace when you launch the import wizard. Monitor the events and see iforg.eclipse.core.resources.IResourceChangeEvent.POST_CHANGE
is issued when the import it done.您可以使用 ICommandService 来监视 Eclipse 平台中命令的执行。
因此,当使用命令 id 执行导入时,您可以收到通知“
org.eclipse.ui.file.import”:
您可以通过扩展 WorkspaceJob 来描述导入后将执行的逻辑。WorkspaceJob
自动与 Workspace 同步。因此,在 Workspace 中完成所有更改后,您的作业将运行。并且它确保没有其他在您的作业执行期间,工作区修改不会运行。
要使用这个魔法,您所要做的只是安排:
You can use ICommandService to monitor execution of commands in Eclipse Platform.
So you can notified when importing is executed with command id "
org.eclipse.ui.file.import":
You can describe logic which will executed after importing with extending WorkspaceJob.
WorkspaceJob automatically synchronized with Workspace. So After all change is done in Workspace, your Job will run. And it makes sure No other workspace modification is not running during your job is executing.
All you have to do to use this magic is just scheduling: