This is the most simple way for creating an instance of a meta-model. Creation is accessible by right-clicking onto the root class/model object of the meta-model (in the scope of the FSM example, it is the Fsm class). Because of the containment property, classes are only available for creation through this root class.
Since it allows to customize the generated editor to match meta-model specificities. (see the end of this article: http://www.eclipse.org/articles/Article-Using%20EMF/using-emf.html), this solution should be favoured for meta-models that are relatively stable.
This is the most ergonomic – but longest – way to create an instance of a meta-model. This method is here presented in its main lines:
Once the meta-model is created, it is possible to create a model for model generation, called genmodel:
File > New > Other > Eclipse Modeling Framework folder > EMF Models;
Choose a name for your genmodel (fsm.genmodel is ok);
Select Load from an EMF core model button, and find the meta-model file (fsm.ecore);
Select the unique package fsm.
In order to avoid weird behaviour (particularly if the current project was not set as a “Java project”) the model directory of the genmodel needs to be changed in the Properties tab of the genmodel. For this purpose, change the property called Model Directory (in the Model folder), to /MyFirstEMFSamples.model/src, so that the EMF source code is generated in a new empty project that will exclusively contain this source code.
Right-click on the root node of the fsm.genmodel, and choose the Generate all item.
To be able to use the generated reflexive editor, a new runtime workbench has to be launched through the tool bar menu:
Run > Run As > Run-time Workbench (in Eclipse 3.0.2);
or Run > Run... > Eclipse application item in the right part > New button > Apply button > Run button at the bottom (Eclipse 3.1).
or Run > Open Run Dialog... > Eclipse application item in the left part > New button > Apply button > Run button at the bottom (Eclipse 3.3).
Once the new eclipse application is launched, create a new simple project (e.g. called MyFirstEMFInstances), and select File > New > Other > Example EMF Creation Wizards folder > Fsm Model;
Creation of an EMF model follows the same principles that the creation of an Ecore model. Please refer to the meta-model creation steps, section ???, p.???. Note that the model object, which was EPackage in the meta-model creation, becomes Fsm in the EMF model creation;
As you work in another Eclipse environment, you will probably want to copy the models that you created this way in your initial project (the one named MyFirstEMFSamples). Simply do it.