Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find dependency chain between two classes on Intellij IDEA diagram

I'm trying to find an automatic way of getting from here:

Initial status

To here:

Final status

Without having to manually add classes B and C. I've tried using the find dependencies action when right clicking on class A, but it only shows direct dependencies and if class A has lots of dependencies it's hard to know what "branch" to follow to find class D.

like image 710
Alfergon Avatar asked Nov 09 '22 02:11

Alfergon


1 Answers

So, I found a way to do this, at least in terms of displaying the connections between the classes in the hierarchy.

First, I opened the two classes alongside each other using the "move right" on one of the editor tabs (see Splitting and Unsplitting Editor tabs.

Second, I selected both class names by holding Alt + Shift and dragging my mouse across each class name (which triggers the multiple cursors feature.

Third, I hit the keyboard shortcut to view the class hierarchy as a UML diagram (⌥⇧⌘U on my Mac).

You can then hit the "Show Dependencies" button in the UML editor to get the full dependency view around your two target classes.

This was in IntelliJ IDEA 2017.1.

like image 102
jonnybot Avatar answered Nov 15 '22 04:11

jonnybot