This shows you the differences between two versions of the page.
— |
application_lifecycle [2013/11/02 07:35] (current) mihael created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== 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. | ||
+ | <sxh xml; highlight: [9,12]> | ||
+ | <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> | ||
+ | </sxh> | ||
+ | |||
+ | The bundle class consists of the bundle id and the full qualified class name. | ||
+ | |||
+ | <sxh java> | ||
+ | public class LifeCycleManager { | ||
+ | |||
+ | @PostContextCreate | ||
+ | void postContextCreate(IApplicationContext appContext, Display display) { | ||
+ | System.out.println("Context constructed"); | ||
+ | } | ||
+ | |||
+ | @PreSave | ||
+ | void preSave(IApplicationContext context) { | ||
+ | System.out.println("Saving ..."); | ||
+ | } | ||
+ | } | ||
+ | </sxh> | ||
+ | |||
+ | See [[http://www.vogella.com/articles/Eclipse4LifeCycle/article.html]] | ||
+ | |||
+ | {{tag>e4}} |