This feature is available only in the Enterprise edition.
The Sequence Diagram from Java Source Wizard allows for visualizing Java method implementation within UML Sequence diagrams. At this time, the UML Sequence diagram cannot show Java code with 100% accuracy; however, MagicDraw provides a mechanism for generating a diagram that reflects the essence of Java method content.
If you want to create a sequence diagram from the Java source, you must first reverse the Java source code to a model.
You can also create a model corresponding to your Java code structure manually.
Ensure the model you use to create a sequence diagram fully corresponds the Java source code you want to represent in the diagram.
One sequence diagram can represent one method in a Java code. Classes are represented as lifelines, and method calls are represented as messages in the diagram. The sequence diagram can also be used to visualize dependencies for all classes used in this method.
To create a sequence diagram using the Sequence Diagram from Java Source Wizard
- Open the Sequence Diagram from Java Source Wizard by doing one of the following:
- On the Diagrams menu, select Diagram Wizards > Sequence Diagram from Java Source Wizard.
- From the Analyze menu, select Model Visualizer. In the open Model Visualizer dialog, select to open the Sequence Diagram from Java Source Wizard and click Start.
- In the Code Engineering Set, select an operation of the class and from the shortcut menu, select Reverse Implementation.
- Follow the steps as directed by the wizard.
What you should know when selecting classes for the diagram:
- Analyze and split long expressions in the diagram: Select to display every call as a separate call message with a temporary variable initialization, if the expression containing calls cannot be displayed as a call message. In the final expression message, these calls are replaced with appropriate temporary variable names.
- Create reply message: Select to display the return message for every call message.
- Wrap message text: Select to wrap message text in the diagram. In the Maximum wrapped messages name length (in pixels) box, specify the maximum message text length in pixels.