Working with Classes in Sequence/Collaboration Diagrams

This section provides techniques for creating classes, linking and unlinking classes, and showing classes in sequence or collaboration diagrams.

Creating a New Class or Interface

Use the context menu of an actor or object to create a new class or interface. Double-clicking the actor or object displays the source code in the Editor.

To create a new class or interface:

  1. Select the actor or object on the sequence diagram.


  2. Right click on the element and choose New > Class or New > Interface. The New Object's Class dialog displays.


  3. Enter information required by the dialog to create a new class, and then click Finish


    NB: When selecting to create a new interface, the New Object's Interface dialog displays.

Linking an Actor or Object to a Class/Interface

Use the context menu of an actor or object element to link it with a class. After the association has been made, double-clicking the element displays the source code of the linked class.

To link an actor or object to a class:

  1. Select the actor or object on the sequence diagram.


  2. Right click on the Actor/Object and choose Select Class from the context menu. The Select Class command expands to display:


  3. Choose a class from the list, or select More to associate a class that is not local to the diagram. This renames the actor or object to the chosen class's name.

TIP: You can associate multiple objects with the same class. Use CTRL + click to select the objects, and follow the steps above to associate the objects to a class.

Unlinking a Class/Interface from an Actor or Object

To unlink a class from an actor or object:

  1. Select the actor or object on the sequence diagram.


  2. Right click and select Unlink Class from the context menu.

Showing a Class

Once a class has been associated with an actor or object, use the context menu to show the class in the editor, resource navigator, package explorer, or model navigator. Right click on the element, and select Show Class > In Editor (Navigator, Package Explorer, or UML Navigator).

Alternatively, to show the source code of a class in the editor, double-click the element in the sequence diagram. The source code displays highlighting the class name.