简体   繁体   中英

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? (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:

@Inject
EPartService partService;

...

partService.addPartListener(IPartListener instance);

Be sure to import the correct IPartListener - org.eclipse.e4.ui.workbench.modeling.IPartListener

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM