Alfergon
Alfergon

Reputation: 5929

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.

Upvotes: 5

Views: 2079

Answers (1)

jonnybot
jonnybot

Reputation: 2453

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.

Upvotes: 1

Related Questions