Application Life Cycle
A class can hook into the application lifecycle of an e4 application by adding a property into the plugin.xml file for the product element.
<plugin> <extension id="product" point="org.eclipse.core.runtime.products"> <product name="miworkplace" application="org.eclipse.e4.ui.workbench.swt.E4Application"> ... <property name="lifeCycleURI" value="bundleclass://miworkplace/miworkplace.LifeCycleManager"> </property> </product> </extension> </plugin>
The bundle class consists of the bundle id and the full qualified class name.
public class LifeCycleManager { @PostContextCreate void postContextCreate(IApplicationContext appContext, Display display) { System.out.println("Context constructed"); } @PreSave void preSave(IApplicationContext context) { System.out.println("Saving ..."); } }
See http://www.vogella.com/articles/Eclipse4LifeCycle/article.html