It has snowed in my hometown, and it has cooled down in Guangzhou. This year’s winter comes especially early ~ if in the hometown, this time should play high, in Guangzhou this time can only honestly knock on the code.


When doing source code analysis, we often have a requirement that, after reviewing a bunch of source code, I want to draw a sequence diagram to get the idea straight, like the following:

There are many drawing tools, I believe that most of your friends can draw.

However, drawing takes too long!! And this diagram has a lot to do with the code that we drew it from.

So the question is, can you generate it from code? It would be a lot better if we could generate it from code.

Today Songo will introduce a SequenceDiagram plugin that I have been using recently.

I am not a collector. Although my laptop is not stuck, I am very cautious about installing plug-ins for IDEA and seldom install them. But the SequenceDiagram was really good and helped me a lot, so I’ll give you a break.

1. Install

First come to talk about installation, IDEA plug-in market directly search and install, this is the basic skills, I will not say more:

Remember to restart IDEA after installing.

Function of 2.

What does this plugin do?

  • Generate a simple sequence diagram.
  • Navigate code by clicking text on the sequence diagram.
  • You can remove a class from the sequence diagram.
  • You can export a sequence diagram as an image.
  • Sequence diagrams can be exported as PlantUML files.

There are also three experimental features:

  • Intelligent interface
  • Lambda expressions
  • Kotlin support

3. Usage

Once the SequenceDiagram is installed, we can enable it from the following places:

  • In the navigation toolbar, the following icon appears (lower left corner of IDEA) :

  • From the Tools menu, Tools -> Sequence Diagram

  • In the editor right-click menu, Sequence Diagram…

  • Generate sequence diagram in IntentionAction prompt (place cursor over method name, press Alt + Enter or Option + Enter) :

Through these places, we can generate a sequence diagram, and the resulting sequence diagram is as follows:

From the figure, we can clearly see the method call and return process.

There are a few details in this picture, so let’s look at them separately.

Look at the left row of buttons.

The first triangle is the regenerate button.

The second wrench is to set some of the generated details, such as the depth of the method call, whether to ignore get/set, whether to ignore private methods/constructors, etc., as shown below:

Below are the save buttons, you can save to different formats, friends can try their own.

Look at the picture on the right.

Double-click the name of a class or method to go to the corresponding class or method.

To remove a class/method from the diagram, right-click over the class/method name.

Almost these usage bar, relatively simple but very useful a plug-in, interested partners can try oh ~