Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Create Use Case for Method

The code editor context menu enables you to 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 in a diagram, and hide any attributes or methods that are not the targets of feature links.

How To:

To create a Use Case for a method, follow the steps below:



See also


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



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> context menu option

The Create Use Case for Method dialog displays



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



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



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



To add the newly-created Use Case to the diagram, select the Add Use Case to Diagram check box. This would now show the Use Case, Class and Trace connector on the diagram.



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


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 the following:


Learn More: