Adding entry, do, and exit activities to states

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

  1. 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.
  2. 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.
  3. 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.
  4. Optional: To associate an operation with an activity, in the Select Element for Specification window, select an operation from the list, and click OK.

Feedback