In UML models, you can add an
entry, do, or exit activity to a state to describe an activity that
is performed only upon entry into a state, exit out of a state, or
that is ongoing in a particular state.
Before you begin
Before you add activities to composite
and orthogonal states, you must have a state machine diagram open
in the
Modeling perspective.
About this task
To add entry, do, and exit activities to states:
Procedure
- Right-click a state; then click Add UML and
complete one of the following steps:
- To add an entry action to a state, click Entry.
- To add a do action to a state, click Do.
- To add an exit action to a state, click Exit.
- In the pop-up menu that opens after you create the activity,
complete one of the following steps:
- To create a new activity, click Create Activity,
type a name and press Enter.
- To create a new state machine, click Create State
Machine, type a name and press Enter.
- To create a new opaque behavior, click Create Opaque
Behavior, type a name and press Enter.
- To associate the activity with an existing element, click Select
Existing Element, select an element from the list, and
click OK.
- Optional: To associate an operation with an
entry, do, or exit activity, click the activity in the diagram and
in the Properties view, on the General page,
click Set.
Note: To associate an
operation with an activity, the activities compartment must be visible.
To show the activities compartment, click the state and, in the Properties view
on the Appearance page, under Show Compartments,
click Activities.
- Optional: To associate an operation with an
activity, in the Select Element for Specification window,
select an operation from the list, and click OK.