Chapter 4. A meta model from an Ecore file

To create an Ecore file, go in the main menu of Eclipse select :

"File" > "New" > "Other..."

Figure 4.1. 


Select "Ecore model" wizard and click "Next >". Select a location and a name for the file. Call it "AnOtherMetamodel.ecore" for example. Click on "Finish".

Your main window now looks like this :

Figure 4.2. 


You can edit this meta model. If you do not know how to do that, please have a look in section about the Ecore editor (page 26) in the following link :

http://www.eclipsecon.org/2005/presentations/EclipseCon2005_Tutorial28.pdf

[Important]Important
You must at least fill in the name, ns prefix and ns URI of the package.

Figure 4.3. 


You can also edit these ecore file using a diagram editor. For example, the ecore tools project provides a class diagram editor that works on top of ecore files. The diagram informations (ie. shape and position of the classes on the sheet) are stored in a separated file : *.ecorediag

Sample use of Ecore tool diagram editor on top of an ecore file

Figure 4.4. Sample use of Ecore tool diagram editor on top of an ecore file


Let say that you edited this meta model and now you want to add some behaviors. You have now two possibilities :

You'll find more details and tip and tricks about adding behavior to a metamodel in the "How to add behavior to a metamodel" tutorial : http://www.kermeta.org/documents/tutorials/tut-add_behavior/