With a Transformator you can “format” your Templates during the generation process and it is defined as child element of a Descriptor. The topic is also covered by the second Eclipse magazin article (in German). The following types exist:
The ElementTypeTransformator is called during the copy process of the Template and allows to modify the type of an element contained in the Template. The new type needs to be assignment compatible to the containment reference of the old element. All attributes and references will be migrated if the feature is part of common base class. The Wizard will ask you for compatible type replacements.
Example: In a NodeTemplate is a “Rectangle” defined as main figure element. With the ElementTypeTransformator you can make it a “RoundedRectangle”, a “Circle” or any other Figure as long the resulting EObject’s EClass is derived from the GMFGraph Figure EClass.
With the ColorTransformator you can specify the foreground or background color of a Figure element. The color will be set after the Template contents have been copied for the Descriptor. The Wizard will ask you for rgb or predefined constant colors.
Example: A Figure element in a NodeTemplate has no color set and therefore will be drawn in the resulting editor black-on-white. To make the editor elements a bit more catchy the background color for each referencing Descriptor needs to be set to a different value. In the ColorTransformator you can specify the figure, a background and a foreground color.
Templates may contain a static text field which is not bound to a feature. The StaticTextTransfromator allows you to enter a specific text for a descriptor. The Wizard will let you change the default text.
Example: You have an abstract Entity class and some derived ones (e.g. a LocalEntity and a PersistedEntity). You want to use an already defined template which contains a static label for showing the ClassName enclosed in guillemots. Additionally you want to customize the static label to show “Entity” instead of “PersistedEntity” because this is the default case.
On the descriptor for your “PersistedEntity” use the wizard to change the static text, select the label you want to change and enter a new text.
The StaticTextTransformator has been introduced in Version 2.1!
The ScriptTransformator can be used to apply arbitrary changes to the generated GMFGraph or GMFMap models. Internally they are used to support the deprecated PostProcessor functions from the 1.0 version. Because a Wizard cannot guess the script you want there is no one.
Example: You want to add a label with a fixed text to an editor element. The rest of the node should look as in the Template specified. To do that you can add a ScriptTransformator in the Descriptor and specify a function name from a Xtend script. The script file itself needs to be referenced from the “Model” root element in the “Post Proc Transformator Ext” attribute.