The Apply Pattern wizard helps you create
a pattern instance and select argument values for the pattern's template parameters.
You can continue to add argument values to the pattern instance after using
the wizard.
Create a UML model that contains a diagram editor before you do the
following instructions.
To apply a pattern with the Apply Pattern wizard:
- In the Pattern Explorer view, right-click
a pattern and click Apply Pattern. The Apply
Pattern wizard opens, listing the open UML 2.0 models in your workspace.
- In the Location list, click the model element
you want to contain the pattern instance. Only the elements that
can own the type of pattern you are applying (collaboration, class, or package
pattern) are available for selection. The qualified name
of the model element appears in the Selected location box.
- Accept the default diagram editor in the Create pattern
instance on diagram box or specify another existing diagram editor.
- Click Next. The Pattern
Parameters page of the Apply Pattern wizard opens.
- To specify an argument for a parameter, click the Value field
for the parameter and do one of the following steps:
Note: In the
pattern design, the pattern author has the option to define a subset of allowable
subtypes for appropriate UML 2.0 types. Parameter types such as Classifier
can be limited to a subset of Activity, Class, Interface subtypes as possible
arguments. To see the allowable types list, hover over the Value field.
- Click the browse button to open the Select Value window and
select an existing element.
- Type a name to create a new element.
- Type the name of an existing element of the same UML 2.0 type as the
template parameter (if the definition does not include subtypes) or an allowable
subtype.
- For UML 2.0 types that take a primitive value: Type a value that matches
the parameter type (for example, an integer, a string, or unlimited natural
number).
- For UML 2.0 types with value sets (or parameters designed to have
value sets), select an option from the drop-down list (for example, you select true or false for
a literal Boolean type)
- To add additional values to parameters (with multiplicity values
that allow multiple values), do the following steps:
- Click the Value field, and click the Add
Value button. An additional row in the table
is added below the parameter.
- Perform one of the options in step 5.
- Repeat steps 5 and 6 as needed.
- Click Finish. You can see
the results of the pattern in your model or models. The pattern instance is
in the model of the element you specified.
- To specify additional values for the pattern's parameters or modify
the selections you have made, in the Model Explorer view,
right-click the pattern instance and click
- Modify the values, and click OK.