[英]Eclipse e4 - Add a Closing Part handler
I'd like to implement an handler which is triggered every time I close a part of my Application Model. 我想实现一个处理程序,该处理程序在每次关闭应用程序模型的一部分时都会触发。
How can I do? 我能怎么做?
For instance, every time I close such part I want to print a message thru the System Console. 例如,每次关闭该部分时,我都希望通过系统控制台打印一条消息。 Moreover is there any object (that could be injected) that provides the state of an MPart?
此外,是否有任何对象(可以注入)提供MPart的状态? (if it's open or close)
(如果打开或关闭)
Thanks 谢谢
You can use the addPartListener
method of EPartService
to add a listener for changes to the state of parts: 您可以使用
addPartListener
的方法EPartService
添加侦听器的更改部分的状态:
@Inject
EPartService partService;
...
partService.addPartListener(IPartListener instance);
Be sure to import the correct IPartListener
- org.eclipse.e4.ui.workbench.modeling.IPartListener
确保导入正确的
IPartListener
- org.eclipse.e4.ui.workbench.modeling.IPartListener
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.