Sequence Diagram In Intellij

  1. Download Sample.zip of this tutorial and extract the zip file to any directory.
  2. Study the source code. Read the register method in RegisterController.java to see how it works.
  3. Create a new project by selecting Project > New from the application toolbar. In the New Project window, enter Account Registration as project name and click Create Blank Project.
  4. Select Tools > Code > Instant Reverse Java to Sequence Diagram... from the toolbar.
  5. In the Instant Reverse Java to Sequence Diagram window, click on Add Source Folder... button.
  6. Select the extracted source folder src. Click Next button.
  7. Select the method to visualize. Select src > RegisterController.java > register (String,int). Click the Next button.
  8. You need to select a diagram to visualize the interaction. The Create new sequence diagram option is selected and diagram name is entered by default. Click Finish button.
  9. As a result, a UML sequence diagram is formed. Let's study the diagram.
    When a person invokes RegisterController's register method (message: 1), it creates an account object (message: 1.1). After that, the controller sets the id, name and age to the account object (message 1.2, 1.3, 1.4) and adds itself to the account list (message: 1.5). The invocation ends with a return (message 1.6).
Related Links

How To Create Sequence Diagrams

Simple Sequence Diagram Generator. Fixed version of SequencePlugin, work from x/5 (9). UML model in IntelliJ IDEA is represented by a Class diagram in standard notation. IntelliJ IDEA enables using UML class diagrams to analyze Java, ActionScript/Flex, PHP, and Maven applications, and the structure of the databases and tables. Compatible with IntelliJ IDEA, Android Studio. + generate Simple Sequence Diagram. + Navigate the code by click the diagram shape. + Delete Class from. Sequence diagrams can be used to explore the logic of a complex operation, function, or procedure. One way to think of sequence diagrams, particularly highly detailed diagrams, is as visual object code. The logic of services. A service is effectively a high-level method, often one that can be invoked by a wide variety of clients. The sequence diagram is a good diagram to use to document a system’s requirements and to flush out a system’s design. The reason the sequence diagram is so useful is because it shows the interaction logic between the objects in the system in the time order that the interactions take place. In order to generate such diagrams you need to install a plugin for IntelliJ. Open your project in IntelliJ, click on: File → Settings → Plugins and type SequenceDiagram in the search field.

IntelliJ IDEA lets you generate a diagram on a package in your project. Such diagrams always reflect the structure of actual classes and methods in your application.

View diagram on a package

  1. In the Project tool window, right-click a package for which you want to create a diagram and select Diagrams Show DiagramCtrl+Alt+Shift+U ).

  2. In the list that opens, select Java Class Diagram. IntelliJ IDEA generates a UML diagram for classes and their dependencies.

You can view your VCS local changes as a diagram. Select VCS Show Local Changes as UMLCtrl+Alt+Shift+D.

Analyze class diagram

You can press Ctrl+F12 on the element to view a list of diagram elements and navigate between them.

To see the list of methods, fields, and other code elements, select the appropriate icon on the diagram toolbar located on top of the diagram editor.

The lists are displayed based on the selected visibility level, which you can change. For example, to view protected methods, click on the diagram toolbar and select protected from the list. IntelliJ IDEA displays members with visibility not less than protected, such as public, package local, and protected ones. The protected methods are displayed with modifier icons next to them.

Intellij Sequence Diagram Plugin

You can click the icon to see class dependencies. IntelliJ IDEA follows the UML conventions in showing relationships between the classes.

When you click through classes in the graph, IntelliJ IDEA greys out classes that do not reside in the same package. This might be helpful, when you generate a diagram on a package that contains inner packages.

To save the diagram as a file, right-click the diagram editor and from the context menu, select Save UML Diagram.


Manage class diagram

When working with diagrams, use the context menu in the diagram editor to perform different tasks. You can view members of the class, add new, delete the existing ones, see implementations, check parent classes, perform basic refactoring, add notes, and so on.

You can select the icon on the diagram toolbar to draw relationship links between elements in your graph. To delete the existing links, select the ones you don't need and press Delete. IntelliJ IDEA will update the source code accordingly.

  1. Press Space.

  2. In the search field that opens, start typing a name of the class you want to add. Then, select the desired class from the suggestion list.

    If you want to add a class that is out of the project scope, select the Include non-project items checkbox.

  1. In the diagram editor, select a node element you want to delete.

  2. Right-click the element and from the context menu, select DeleteDelete.

    Alternatively, select Refactor Safe DeleteAlt+Delete. In this case, IntelliJ IDEA checks for usages before applying the changes.

You can quickly search for usages by pressing Alt+F7 on a code element.

You can perform some forward engineering while in the diagram editor.

  1. In the diagram editor, right-click anywhere and from the context menu, select New. Then select a code element you want to create.

  2. Depending on your selection, IntelliJ IDEA opens the appropriate dialog where you specify the necessary information for creating the new element.

IntelliJ IDEA adds the item to your diagram as well as to your project tree.

You can view implementations and parent classes in your diagram. If IntelliJ IDEA finds more than one parent class or implementation, it displays a list of appropriate items. Select the one you need to see the connections between the parent and its children.

  1. In the diagram editor, select an item for which you want to see implementations or parent classes.

  2. Right-click the items and from the context menu, select the Show ImplementationsCtrl+Alt+B or Show ParentsCtrl+Alt+P respectively.

  3. In the popup that opens, select items you need and press Enter. To extend your selection up or down while in the popup, press Shift + Up or Shift + Down respectively.

You can configure the diagram settings, so that you have certain options available to you by default when you create your diagram.

  1. In the Settings/Preferences dialog Ctrl+Alt+S, go to Tools Diagrams.

  2. In the right-hand pane, select the options that you want to see by default and click OK to apply your changes.