Chapter 3. Define the editor

In this task, you will learn how to provide editors to manipulate instance-model which conforms to your metamodel. There are many ways to do so. As these techniques are independant from each other, you can experiment each of them according to your needs.

3.1. Dynamic instance

Before editing, you should create an instance-model with the dynamic instance. This is the most simple and fastest way for creating an instance of a meta-model. Creation is accessible by right-clicking onto the root meta-class. Because of the containment property, classes are only available for creation through this root class.

[Note]Note

Illustrations of this technique can be seen in the dedicated part of the tutorials :

3.2. Tree-view editor

Then, the simplest tree view is a way to manipulate instance-model. Generally you can find it in the Outline view. You can populate your model by right-clicking on an element, this triggers a popup menu where you can choose to create child or sibling element.

[Note]Note

An illustration of create metamodel using tree view is available in :

3.3. Textual editor

Textual editor allows you to "program" your instance-model. Instead of designing it with its representation, you 'll textually define the concrete syntax of each concept of your metamodel. As a result, you'll get an instance-model conforms to your metamodel. Many tools allow us to achieve this goal such as : Xtext, EMFText, Sintax. Basically, these tools connect with the metamodel to define its concrete syntax and generate the according code.

[Note]Note

If you want to have an example on this technique, please refer to the example in :

3.4. GMF editor

The last manipulation technique of a metamodel is to do so in a graphical way.

[Note]Note

A dedicated tutorial covers the process to define such kind of editor in :