IDEA View class inheritance diagram and show the operation of the source category

We all know that this IDEA development tool very easy to use, very much, today, when reviewing a set of Java system, want to see the inheritance structure of a class or interface, and then search for a wave, are using the IDEA Diagram plug , here to share.

For example, I wrote this piece of code

public class CollectionLearning {
    public static void main(String[] args) {
        List list = new ArrayList();
        list.add("java");
        list.add("Android");
        list.add("python");
        list.add("前端");
        //lambda+方法引用:遍历list集合元素
        list.forEach(System.out::println);
    }
}

Then I want to see the inheritance structure ArrayList, we can right-click on the ArrayList class, in the pop-up dialog box, select Diagram.
Here Insert Picture Description
Displays two options:
Show Diagram ... -> display class inheritance structure diagram in a new tab
Here Insert Picture Description
Show Diagram Popup ... -> elastic layer displayed in the current page class inheritance structure diagram
Here Insert Picture Description
still feel good display in a new tab, we'll see ArrayList to the inheritance structure diagram of
Here Insert Picture Description
this view is very clear, sometimes I feel that the relationship has displayed all the class or interface takes up too much screen, we can not delete a class or interface concerned, 鼠标点击某个类或接口,按住delete键就会删除它。
Here Insert Picture Description
we removed the Cloneable, Serializable, RandomAccess interfaces, we note that there are different colors and arrows on top of the actual situation, these lines are marked relationship between class and class, classes and interfaces.

蓝色实线箭头:类之间继承

绿色实线箭头:接口之间继承

绿色虚线箭头:类实现接口

Sometimes just look at the class inheritance structure diagram is not enough, we also want to methods in the class, variables, constructors, and so on.
We can right-click on the current page
Here Insert Picture Description
in the figure above, we can choose to display variables, constructors, methods, properties, inner classes. We click on Fileds
Here Insert Picture Description
so we show the class or interface variables involved in the inheritance structure diagram, we click constructor
Here Insert Picture Description
this constructor will all show up for this we would like to quickly understand the internal structure of a class of very fast, we the above operations can also be done using the Quick toolbar.
Here Insert Picture Description
We can also quickly access to the source code which variable or method. We double-click a class or interface, in which the mouse will then walk, then we have to choose a method Jump to Source, you can enter the source of which
Here Insert Picture Description
Here Insert Picture Description
we sometimes feel relatively small figure shows, not clear, we You can use the magnifying glass function,
按住Alt键,鼠标移到哪就是放大镜。
Here Insert Picture Description
sometimes we would like to see the current class and other classes if a relationship, we'll add other classes come in,
right-click to select Add Class to Diagram...
Here Insert Picture Description
a dialog box
Here Insert Picture Description
us in class in the class's name, press enter. Here I enter the Map interface
Here Insert Picture Description
so that we know ArrayList and Map does not matter (There may be superfluous, already shows all the current class inheritance structure diagram)

Published 25 original articles · won praise 6 · views 4496

Guess you like

Origin blog.csdn.net/weixin_44176169/article/details/104135054