Prev Next

Incorporate Model Templates

When a user creates a model within their project, they can choose the type of model to develop from a range of system-supplied model templates presented through the Model Wizard. You can also develop custom model templates and add them to this list via your MDG Technology.

Access

You edit the .MTS file directly, using whatever file browser you work with to locate and open the file.

Add custom model templates to MDG Technology

Step

Action

See also

1

Create a Package that contains all sub-Packages, diagrams, elements, notes and information links that you want to provide in your model template.

See the EAExample.eap model for illustrations of what you might include, or create a model from a standard template and see what is generated.

As a model template, the Package would be self contained and not contain any dependencies or other links to elements outside the Package.

Model Wizard

2

Export your Package to XMI.

Export to XMI

3

Create a reference to the XMI file in the MTS file; open your MTS file in a text editor and copy and paste this <ModelTemplates> block at the top level inside the <MDG.Selections> block:

     <ModelTemplates>

     <Model name="Template Name"

          location="MyTemplatePackage.xml"

          default="yes"

          icon = "34"

          isFramework="false"/>

     </ModelTemplates>

You can include as many <ModelTemplates> blocks in your MTS file as you have model templates.

The attributes within a <ModelTemplates> block have these meanings:

  • Model name: The name of the model template to show in the Model Wizard window, which displays when you create a new model or when you execute the 'Add a New Model using Wizard' menu option
  • location: The path of the XML file that contains the XMI export of the model template Package, relative to the location of the ModelPatterns directory in the Enterprise Architect install path:
         -  If the XMI file is directly in the ModelPatterns directory then the path just contains the file name (for example, MyPattern1.xml)
         -  If you have placed all your files in a subdirectory of ModelPatterns, the path includes the directory name (for example, MyTechnology\MyPattern2.xml)
         -  You can also specify a fixed path (for example, C:\Program Files\MyTechnology\MyPattern3.xml)
  • icon: Contains an index to Enterprise Architect's base icons list; to show the appropriate view icon, use one of these values:
         -  29 = Use Case
         -  30 = Dynamic
         -  31 = Class
         -  32 = Component
         -  33 = Deployment
         -  34 = Simple
  • isFramework: Defines the possible uses of a model Pattern; there are three possible values:
         -  isFramework="true" - never strip GUIDs; the Pattern is intended
            as a re-usable Package for any model
         -  isFramework="optional" - prompt to strip GUIDs; the Pattern is
            intended as a re-usable Package, but the user can choose
         -  isFramework="false" - always strip GUIDs (the default, if not
            stated); the Pattern could be applied multiple times within the
            one model
Working with MTS Files

4

Regenerate the MDG Technology using the edited MTS file.

5

To allow multiple custom categories per technology, go to the <Documentation> row of the MDG Technology file and add the attributes:

  • categoryList, which contains either a comma-separated list of custom category names, or the name of a single built-in category (such as 'Business')
  • categoryMappings, which contains a list of option pairs of the form 'Group Name 1=Category Name A;Group Name 2=Category Name B;" and so on; the category names must all be in 'categoryList'

In the <ModelTemplates> block of the MDG Technology file, each <Model> row will have an attribute groupName. The group name must be in categoryMappings.

Learn more