IntelliJ IDEA 2019.1 Help

Class diagrams

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 Diagram (Ctrl+Shift+Alt+U)).

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

Analyze class diagram

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.

Diagram editor

The lists are displayed based on the selected visibility level, which you can change. For example, to view only protected methods, click the Change Visibility Level button on the diagram toolbar and select protected from the list. IntelliJ IDEA displays such methods with modifier icons (key) next to them.

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

class dependencies

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.

different packages

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.

Add an existing class to a diagram

  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.

Add new members to a class

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.

View implementations and parent classes

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 Implementations (Ctrl+Alt+B) or Show Parents (Ctrl+Alt+P) respectively.

Configure diagram settings

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.

Last modified: 20 May 2019