In addition to providing the Ecore meta-metamodel, EMF also comes with support for building (more or less usable) editors. These are generated automatically from the metamodel we just defined. In order to define example models (which we will do below) we have to generate these editors. Also, we have to generate the implementation classes for our metamodel. To generate all these things, we have to define a markup model that contains a number of specifics to control the generation of the various artifacts. This markup model is called genmodel .
So we have to define the
genmodel
first. Select
the data.ecore
model in the explorer and right mouse
click to → → → . Follow the following five steps; note that they are also
illustrated in the next figure.
Select EMF Generator Model
Define the name
Select the folder
Select Ecore model as source
Press the Load button and then Finish
As a consequence, you will get the finished EMF genmodel . It is a kind of "wrapper" around the original metamodel, thus, it has the same structure, but the model elements have different properties. As of now, you do not have to change any of these.
You can now generate the other projects.
You now have all the generated additional projects.
We will not look any deeper at these additional projects for now.
However, there is one important thing to point out: The generator also
generated the implementation classes for the metamodel. If you take a look
into xpand.demo.emf.datamodel/src
folder, you can find classes (actually, interfaces at the top level) that
represent the concepts defined in your metamodel. These can be used to
access the model. For some more details on how to use the EMF model APIs
as well as the reflective cousins, take a look at http://voelterblog.blogspot.com/2005/12/codeblogck-emf_10.html.