如何中断 Eclipse RCP 关闭

发布于 2024-08-29 21:18:16 字数 164 浏览 2 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

海夕 2024-09-05 21:18:16

您是否考虑过安装 IWorkbenchListener 并扩展 preShutdown 方法?看来您可以使用此机制否决关闭。

Have you looked at installing an IWorkbenchListener and extending the preShutdown method? It appears you can veto a shutdown using this mechanism.

葬花如无物 2024-09-05 21:18:16

我想你想做的事是不可能的。如果插件可以阻止 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文