To create an Ecore file, go in the main menu of Eclipse select :
"File" > "New" > "Other..."
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 :
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 | |
---|---|
You must at least fill in the name, ns prefix and ns URI of the package. |
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
Let say that you edited this meta model and now you want to add some behaviors. You have now two possibilities :
Use kermeta aspects
You can directly require the ecore file and then using the aspect
keyword
you can create a class that will extend the definition imported from the ecore file.
Since the addition of aspect in kermeta (v1.0.0), this is usually the recommended way to add behavior.
Transform your ecore file into a KMT text file and then directly add the expected behavior in it.
This is the old way to achieve that, you simply have to transform your ecore file to and from the textual syntax (ie. kmt file) so yopu'll be able to add new operations, atributes, ... and define their behavior using the textual syntax.
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/