Adding Local Variables
In UML, data that is local to an activity is stored to object nodes. Object nodes reflect Local Variables.
Activities are modeled in activity diagrams. Refer to Modeling Activities for more information on how to create an activity diagram.
Adding a Local Variable via the Elements Toolbar
Via the Elements Toolbar
Drag out the local variable icon from the elements toolbar:
Refer to Working with the Activity Editor for an overview on all elements that are available for activity diagrams.
To change name and type, switch to the Attributes panel:
Refer to Changing the Attributes of Elements on the Activity Diagram for more information on what you can do in the attributes panel.
Via a Pin
Alternatively, you can mark the parameter pin of a call operation to which you want to connect the new local variable. Then select Local Variable in the elements toolbar, drag out the variable and place it at the desired position. The newly created local variable is automatically connected to the marked pin and inherits the name and type of the corresponding parameter pin:
Click on the image to run through the animated version once. Click again to repeat.
Adding a Local Variable via Service Panel
You can also drag out classes, parameters and properties from other service panel folders, and drop it on the diagram pane:
Name and type of the created new local variable match those of the element dragged out from the service panel.
Moving and Resizing Local Variables
Once added to the diagram, you can move local variables any time. Click the local variable and drag it to a new position:
You can resize local variables by clicking the square in the bottom right corner of the element and dragging it:
You can hover over the local variable to see a tooltip showing the full path of the type: