Search code examples
javaeclipsercpe4

Eclipse E4 - UIEvents Mpart Closure/Opening


Does somebody know if there's a UIEvents which tracks the closure/opening of a MPart?

Just to remark it, I don't need a @PreDestroy method. I have some actions to perform outside the MPart's class.

Thanks


Solution

  • Rather than UIEvents use the EPartService IPartListener:

    @Inject
    EPartService partService;
    
    
    partService.addPartListener(listener);
    

    The IPartListener has methods called for all major changes to parts.

    Note: This is org.eclipse.e4.ui.workbench.modeling.IPartListener not org.eclipse.ui.IPartListener