Prev Next

Create Use Case for Method

Using the code editor context menu, you can create a Use Case element for a method that you select from the code. You can also:

  • Link the Use Case directly to the method
  • Add the parent Class to a diagram (if it is not already in the selected diagram) and/or add the Use Case element to the diagram
  • Block from display any attributes or methods that are not also the targets of feature links

Create a Use Case for a method, through the code editor

Step

Action

See also

1

(If you want to depict the Use Case and its link to the method in a diagram) click on the diagram name in the Project Browser.

2

In the code editor, right-click on either the method name or any part of the method body, and select the 'Create Method for <methodname>' option.

The 'Create Use Case for Method' dialog displays.

Code Editor Context Menu

3

The basic function of this dialog is to create a Use Case for the selected method:

  • If this is all that is required, click on the OK button; the Use Case element is created in the Project Browser, in the same Package as the parent Class for the method, and with the same name as the method
  • If you intend to make the relationship tangible, continue with the procedure

4

To create a Trace connector linking the Use Case to the method, select the 'Link Use Case to Method' checkbox.

5

To add the method's parent Class to the diagram, if it is not already there, select the 'Add Class to Diagram' checkbox.

6

To add the newly-created Use Case to the diagram, select the 'Add Use Case to Diagram' checkbox; this would now show the Use Case, Class and Trace connector on the diagram.

7

To only show the features (attributes and methods) of the parent Class that are the targets of 'link to feature' relationships, select the 'Display only linked features in Class' checkbox.

The Class might contain any number of attributes and methods, but those without a 'link to feature' relationship are hidden.

Connect to Element Feature

8

Click on the OK button to create and depict the Use Case and relationship; if you selected all options, the diagram now contains linked elements resembling this illustration: