Friday, July 8, 2011

EMF Ecore model inheritance

Let's say you have a common.ecore with Node element. You create person.ecore in another plugin and want Person->Node inheritance. To do this create your person.ecore and load common.ecore from "Sample Ecore Editor" menu. Continue creating Person element and setting super type as node. Now, when it's time generate genmodel for person.ecore on package selection page of wizard you will see packages for person and common. Make sure you don't select common checkbox and instead choose common.ecore from "Reference generator models" pane. If you don't then person model will expect common to be on the same level as itself and you don't want that.

Blogger Syntax Highliter