Use Patterns


Using a pattern enables items defined in the pattern to be used with the UML model. Using patterns enables you to rapidly create template solutions for code structures that perform the same type of task in other situations.

To use a pattern that you have previously imported into the model, follow the steps below:

  1. Open the diagram into which you want to add the pattern.
  2. Select the Resources tab on the Project Browser window.
  3. Expand the Pattern folder and find the pattern to add.
  4. Either:

    • Right-click on the pattern and select the Add Pattern to Diagram menu option or
    • Drag and drop the pattern from the Resources tab onto the diagram.

    (You can also view the pattern details in read-only mode by selecting the View Pattern Details menu option.)

    The Add Pattern dialog displays.
    Add Pattern Elements dialog
    Control Description
    Preview This panel displays a preview of the pattern; click on the Preview link to open a view of the pattern and drag the sides into as large a picture as you require.
    Pattern Elements This panel provides access to the individual elements contained in the pattern.
    From here you can:
    • select the action for the individual element (Create, Merge, Instance or Type, as applicable for each element) by clicking on the drop-down arrow, or
    • modify the default of the pattern element or - for a merged element - choose the namespace, by clicking on the [...] button on the right of the Default entry.
    Element Notes This panel displays the comments that describe the element in the pattern. Highlight an element in the Pattern Elements panel to view the notes.

  5. Once the appropriate selections have been made, click on the OK button to import the pattern into the model, recreating the original diagram with new GUIDs.

Changing Pattern Element Default

To change the default of the pattern element, follow the steps below:

  1. From the Add Pattern dialog select the individual element in the Pattern Element panel.
  2. Click on the [...] button to display the Edit dialog. The specific method for changing the element name is dependant upon the entry in the Action column of the Pattern Elements panel.
  3. If the Action entry is Create, then in the Default field in the Edit dialog delete the existing value and type your own, user-defined value. Click on the OK button. The element default is updated on the Add Pattern dialog.
  4. If the Action entry for the element is Merge, in the Edit dialog click on the [...] button to browse to an existing element classifier. This displays the Set Element Classifier dialog.
    Add Pattern Elements dialog
  5. On the Set Element Classifier dialog select an existing element classifier from the list of available classifiers. You can restrict the number of available choices by selecting the elements from a specific namespace; to do this, click on the In Namespace drop-down arrow and select a namespace.