Graphical Editor Extension Development

Aus SDQ-Wiki

Within this section we give a short tutorial on how to extend a given Sirius diagram representation editor. The original editor is thereby not altered. We hereby assume that you are already familiar with creating Sirius editors. If not, please refer to Sirius Editors and first.

Creating an Extension

Like creating a new Sirius editor, a new viewpoint specification project containing a new viewpoint belonging to the extension is recommended. Instead of creating a new diagram representation, a diagram extension should be chosen available in the menu Extension. There are overall three properties needed for the new diagram extension: Name, Viewpoint URI and Representation Name. The values needed for the extension to work properly are explained at After creating a new layer, the user can start adding new notation elements or alter existing ones.

Access to Meta-Classes of the Meta-Model Extension

Assuming the editor extension should be based on a meta-model extension, those meta-classes can not be accessed by using the basic Acceleo expressions. That is due to the fact, that the editor extension assumes the same underlying root meta-class as the base editor. Therefore, a java service class is needed in order to use the meta-classes of the meta-model extension. The java service can be implemented as java class in any plug-in. The viewpoint description of the editor extension only needs a dependency to that plug-in and the qualified java class name where the service is located. The class itself needs a standard constructor and every method, that should be useable as java service needs to be public and requires at least one sub-class of EObject as parameter instance. A tutorial on how to use java services can be found at

Altering Existing Notation Elements

In order to alter existing notation elements, Sirius offers an import mechanism for each existing notation element. For this import mechanism to work, the user needs to load the base editor as resource into the diagram extension. This is done by right-clicking on the viewpoint description editor's surface and choosing Load Resource. After importing a notation element its style can be altered and further notation elements can be added, such as Bordered Node or new Sub-Node or -Container. For edges, it is only possible to add additional styles. Other options cannot be modified in the extension [1].

Using the Extension

To finally use the extension, both the base editor's and the extension editor's viewpoint have to be activated for the modeling project. Furthermore, the modeling project must contain at least one model file instanciating the base meta-model and another one instanciating the extension meta-model. Otherwise one of the viewpoints can not be chosen. When opening a representation with the base editor, in addition to all the base editor's layers, further layers are now available that were created in the editor extension. Choosing one or more of these additional layers enables the editor extension. Creating an extension model and adding the extension viewpoint to the corresponding project could be done automatically. However, this is currently not supported.