如何中断 Eclipse RCP 关闭
我有一个 Eclipse RCP 应用程序插件。每当特定视角关闭或应用程序关闭时,我需要检测场景,并且根据结果,我可能需要取消应用程序或视角的关闭。如果我可以访问应用程序的 WorkbenchAdvisor 类,那么这将是微不足道的。作为此应用程序的插件,我如何检测事件以及如何告诉主应用程序/顾问我需要取消关闭?
I have a plugin into an eclipse rcp application. I need to detect a scenario whenever a particular perspective is closed or if the application is closed and based on the outcome, I may need to cancel the closing of the app or perspective. If I had access to the application's WorkbenchAdvisor class, this would be trivial. As a plugin to this app, how can I detect the event and how can I tell the main application/advisor that I need to have the close canceled?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否考虑过安装 IWorkbenchListener 并扩展
preShutdown
方法?看来您可以使用此机制否决关闭。Have you looked at installing an IWorkbenchListener and extending the
preShutdown
method? It appears you can veto a shutdown using this mechanism.我想你想做的事是不可能的。如果插件可以阻止 rcp 应用程序关闭(或以其他方式强制其关闭),这可能是一个严重的安全问题。此外,应用程序状态也不清楚,因为它可能已经释放了一些资源。
如果应用程序想要将程序终止的控制权交给插件,它应该定义一个可以使用的接口/扩展点。
I think want you want to do is not possible. If a plug-in could prevent an rcp application to shut down (or the other way force it to should down) this can be a serious security problem. Also the app state would be unclear as it might has released some resources.
If an app wants to give control of program termination to a plug-in it should define an interface/extension point that can be used.