Replacing the persistence approach for the Eclipse 4 application model

Eclipse 4 uses an instance of the IModelResourceHandler interface to load and save the application model at startup. The default implementation of this interface is provided by the ResourceHandler class from the org.eclipse.e4.ui.internal.workbench package.

You can specify the modelResourceHandler as parameter on your product extension to point to another class via the bundleclass:// notation.

Implementing this interface requires knowledge about the Eclipse Modeling Framework (EMF). You can use the ResourceHandler class as a template to see how the IModelResourceHandler interface could be implemented.

By default the Eclipse platform expect that the application model is provided by an file called Application.e4xmi.

Via your own IModelResourceHandler you could read, construct the application model from another source , e.g. a database or a web service.

Another example would be a class which reads the extension information from the extension registry and creates an Eclipse 4 application model from this information.

About Lars Vogel

Lars Vogel is the founder and CEO of the vogella GmbH and works as Eclipse and Android consultant, trainer and book author. He is a regular speaker at international conferences, He is the primary author of vogella.com. With more than one million visitors per month this website is one of the central sources for Java, Eclipse and Android programming information.
This entry was posted in Eclipse and tagged , , . Bookmark the permalink.