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

Custom Templates

Custom templates enable you to generate an element in many different ways. Enterprise Architect enables you to define custom templates that are associated with given elements and call these templates from existing templates. You can even add stereotype overrides to your custom templates. For example, you might list all of your parameters and their notes in your method notes.

To create a new custom template, follow the steps below:

  1. Select the Settings | Code Generation Templates menu option, or press [Ctrl]+[Shift]+[P]. The Code Templates Editor tab opens.
  2. In the Language field, click on the drop-down arrow and select the appropriate language.
  3. Click on the Add New Custom Template button. The Create New Custom Template dialog displays.
  4. In the Template Type field, click on the drop-down arrow and select the appropriate element. The elements currently supported are:
  • Attribute
  • Class
  • Class Base
  • Class Interface
  • Class Parameter
  • Connector
  • Import
  • Linked Attribute
  • Linked Class Base
  • Linked Class Interface
  • Namespace
  • Operation
  • Parameter.


<None> requires special treatment. It enables the definition of a function macro that doesn't actually apply to any of the types, but must be called as a function to define variables $parameter1, $parameter2 and so on for each value passed in.

  1. In the Template Name field, type an appropriate name, then click on the OK button.
  2. On the Code Templates Editor tab, the new template displays in the Templates list with the value Yes in the Modified field. The template is called <Template Type>_<Template Name>.
  3. Select the appropriate template from the Templates list and edit the contents in the Template field to meet your requirements.
  4. Click on the Save button. This stores the new stereotyped template in the .EAP file. The template is now available from the list of templates and via direct substitution for use.