开发者

How to interrupt Eclipse RCP shutdown

开发者 https://www.devze.com 2022-12-28 12:36 出处:网络
I have a plugin into an eclipse r开发者_运维技巧cp 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 n

I have a plugin into an eclipse r开发者_运维技巧cp 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?


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号