Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Contents
Prev Next

Edit Transformation Templates

A single transformation applies a number of transformation templates, each of which defines a type of object that is acted on within the transformation, and the actions that are performed on objects of that type. The system provides a range of built-in default templates, and each type of transformation uses a specific subset of these templates. Typically, the transformation type and the subset of templates are tailored to the target language. Some default templates within a set have no content; these are 'latent', and represent the potential for acting on an object that is not generally included in the transformation but is perfectly valid if you wanted to include it. An example of a latent template is the Linked Class Base template in the C# transformation.

You can tailor the transformation templates in various ways, including:

  • Adjust the code in one or more of the templates in a default set
  • Add code to a 'latent' default template
  • Add a new custom template, based on one of the defaults but serving a different purpose that you define
  • Add a new transformation type containing - initially - a basic set of default templates
  • Add (or remove) a stereotyped override for a template

A stereotyped override directs the transformation to use the modified template only if the element and/or feature are of the specified stereotyped types. If the object or feature are not of that type, the transformation applies the base template.

Access

Ribbon

Design > Tools > Transform > Transform Templates

Keyboard Shortcuts

Ctrl+Alt+H

Edit Transformation Templates

Option

Action

See also

Language

Click on the drop-down arrow and select the name of the transformation.

New Transformation Type

Click on this button if you want to create a new transformation.

A prompt displays for the name of the transformation; type in the name and click on the OK button.

The 'Templates' list shows the default set of built-in templates, from which you can develop your transformation. Your custom transformation is not saved or available for use unless you add and/or edit one or more templates in the transformation.

Templates

Lists the transformation templates for the current transformation.

Click on a template name to highlight it and display its content in the Template panel. The 'Modified' column indicates whether you have edited the template for this transformation.

The Code Template Editor in MDG Development

Template

Displays the contents of the currently-selected template, and provides the editor facilities for modifying the template (right-click on the code text).

The Code Template Editor in MDG Development Write Transformations Code Template Syntax

Stereotype Overrides

Lists the stereotyped templates, for the active base template.

The 'Modified' column indicates whether you have modified a stereotyped template.

Add New Custom Template

Click on this button to create a custom template to add to the current transformation.

A dialog displays, prompting you to specify:

  • The object type (base template type) that this new template will respond to - click on the drop-down arrow and select the name (custom template types are not included in this list)
  • The name of the new template - type in the appropriate text

Click on the OK button. The new template name is added to the list of templates, and it is opened in the template editor ready for you to add its code.

Add New Stereotyped Override

Click on this button to add a new stereotype override for the currently selected template. A dialog displays, prompting you to specify the:

  • Base Class (stereotyped Class type - click on the drop-down arrow and click on the type in the list) and/or
  • Feature (click on the drop-down arrow and click on the stereotyped feature in the list)

Click on the OK button. The override is added to the 'Stereotype Overrides' list.

Get Default Template

Click on this button to update the editor display with the default version of the current built-in template or to clear the content of the current custom template.

If you have saved the changed template, re-instating the default version is a change, so the 'Modified' field still displays the word 'Yes'.

Save

Click on this button to save the new or edited current template. You cannot switch to another template without saving the current template, so this effectively saves the transition as well.

Delete

Click on this button to delete the current custom template or stereotype override, or the most recent changes to a built-in template (effectively returning it to the default, base content). You cannot delete a built-in template.

You are prompted to confirm the deletion.

Help

Click on this button to display this Help topic.

Notes

  • Transformation template editing is based very strongly on code generation template editing; for additional information on editing transformation templates see the Code Template Editor section and the Editing Source Code topic

Learn more