Support free tutorials:











vogella training Training Books



Extending the Eclipse 4 application model- Tutorial

Building Eclipse RCP applications based on Eclipse 4

Lars Vogel

Version 6.4

21.10.2012

Revision History
Revision 0.1 14.02.2009 Lars
Vogel
created
Revision 0.2 - 6.4 16.02.2009 - 21.10.2012 Lars
Vogel
bug fixes and enhancements

How to extend the Eclipse 4 application model

This tutorial gives an overview how to extend the Eclipse 4 application model and how to define new renderers for new model elements.


Table of Contents

1. Tutorial Extend the Eclipse application model
2. Support free vogella tutorials
2.1. Thank you
2.2. Questions and Discussion
3. Links and Literature
3.1. Source Code

Get the book Eclipse IDE book

1. Tutorial Extend the Eclipse application model

Define a plug-in called com.example.e4.model.extensions based on OSGi without an activator.

Add a dependency to the org.eclipse.e4.ui.model.workbench, org.eclipse.e4.core.contexts.

Create a folder called model and create a new EMF model called UiExtensions.ecore via FileNewOther...Eclipse Modeling FrameworkEMF Model.

Create EMF model

Right-click on the model and select Load Resource....

Click on the Browse Registered Packages and select the model from org.eclipse.e4.ui.model.workbench.

Create a new EClass model element called MyOwnPart and add the following Part ESuper Types to it.

Create another model element called MyOwnPartStack with the supertype PartStack The finished model should look like the following.

Generate a EMF genmodel from this ecore model and create the Java code.

Export all package via the Runtime tab on the plugin.xml.

Tip

Please note that the first time you run the model generation the plugin.xml file will be created and the org.eclipse.emf.ecore.generated_package extension point will be added to the file. This extension point describes your model. It will only be added if no plugin.xml file does exists until this point in time. If you later adjust for example your packages, etc you have to adjust the extension point manually.

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>

<!--
-->

<plugin>

   <extension point="org.eclipse.emf.ecore.generated_package">
      <package
            uri="http://www.vogella.com/uiextensions"
            class="extension.ExtensionPackage"
            genModel="model/UiExtensions.genmodel"/>
   </extension>

</plugin> 

Note down the uri from the extension point. You need later to define this in your Application.e4xmi.

2. Support free vogella tutorials

Maintaining high quality free online tutorials is a lot of work. Please support free tutorials by donating or by reporting typos and factual errors.

2.1. Thank you

Please consider a contribution if this article helped you.

Flattr this

2.2. Questions and Discussion

If you find errors in this tutorial, please notify me (see the top of the page). Please note that due to the high volume of feedback I receive, I cannot answer questions to your implementation. Ensure you have read the vogella FAQ as I don't respond to questions already answered there.

3. Links and Literature

3.1. Source Code

Source Code of Examples

http://wiki.eclipse.org/E4 Eclipse E4 - Wiki

Eclipse RCP

Eclipse EMF

Dependency Injection