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