This lesson guides you through how to establish the environment
you need to apply a pattern.
You apply patterns to models that contain UML elements so
that you can modify these elements. To do this, you need an open UML
project and a UML model. For this tutorial you also need an open freeform
or class diagram. Although the diagram view is not essential, using
it to apply patterns makes it easier to see the pattern results.
If
you are an advanced user, you can create a UML project, a UML model,
and a freeform or class diagram. For this lesson you need to add a
UML class and a UML interface to the model. The interface must define
one or more operations. Ensure that the Modeling perspective is open.
An easier option is to perform the following instructions to create
these requirements for you. Advanced users can review these instructions
to ensure that their results are the same as the example.
To
create the model environment:
- Load the UML project and model. For this tutorial,
you can use the Simple UML model from the Samples, UML models section.
- Import the Simple UML project from the Samples section.
- Expand Technology samples, expand UML
models, and click Simple UML model sample.
- Click Import the sample. The
Sample Model window opens.
- Click Finish to open the new
project and model. The Project Explorer view opens.
- Expand the project and double-click the model. The model
and a freeform diagram open.
Note: If you use this same sample in other tutorials,
you must rename the imported sample.
- Open the Modeling Perspective
- Click .
- In the Select Perspective window, select Modeling and
click OK.
Identify the diagram view by the name of the model on its
tab. A new diagram view is a blank surface used to add and manipulate
model elements. If you use the Simple UML model sample from the Samples
section, you see the class, named AppFunction1, and the interface,
named DoWork, are already displayed on to the freeform diagram. DoWork
owns UML operations named doNothing and doSomething. The AppFunction
class also owns two UML elements: an operation named Operation1 and
an attribute named Attribute1.
Now that you know the basic requirements
to create a pattern, you are ready to import the sample patterns.
You will apply a sample pattern to elements in your new UML model.