185

When I'm editing a Java class in Eclipse, when my cursor is over a class variable, I can do Ctrl+T to have a popup that shows all its parents and subclasses. What is the equivalent in IntelliJ?

Example:

Use|r user = new User();

The pipe is my cursor.

dimitrisli
  • 20,895
  • 12
  • 59
  • 63
Glide
  • 20,235
  • 26
  • 86
  • 135

15 Answers15

262

Navigate | Type Hierarchy Ctrl+H will show similar information, however in the Panel. You can Float and Unpin the Panel so that it appears on the fixed display position only when you use the keyboard shortcut.

guo
  • 9,674
  • 9
  • 41
  • 79
CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • 2
    I'm fairly new to IntelliJ, and I found out it's much better to have "Hide Active Tool Window" shortcut mapped to (instead of the "Escape" shortcut), which by default is mapped to . So far it felt way more natural to me when closing "floating windows" (type hierarchy included). – Eyal Roth Nov 19 '15 at 18:12
  • 2
    One more thing - this still doesn't behave the same as Eclipse's quick type hierarchy: In Eclipse, when you hover over a class in the hierarchy, pressing will open the source file with the class; in IntelliJ, you have to use the "jump to source" shortcut. Also, clicking back on the editor won't make the window disappear, unlike the "show implementations" window (for instance), so this is isn't a pure floating window. – Eyal Roth Nov 19 '15 at 18:21
  • Is it possible to show only the immediate children? In python, all descendents are shown, which is most of the time useless. – dawid Sep 28 '20 at 07:27
  • also, it doesn't give the methods list that the subclasses override and other methods they have. Is there a setting to enable this?? – thumala manish Feb 06 '21 at 07:03
86

In terms of behavior the equivalent of Eclipse Ctrl+T in IntelliJ IDEA is Ctrl+Alt+B

Jacek Laskowski
  • 72,696
  • 27
  • 242
  • 420
dimitrisli
  • 20,895
  • 12
  • 59
  • 63
  • 11
    on macOS this is `Option` + `Cmd` + `B` – Brad Cupit Feb 14 '17 at 17:08
  • Is it possible to show only the immediate children? In python, all descendents are shown, which is most of the time useless. – dawid Sep 28 '20 at 07:25
  • please post the name of the command as mapping schemas might differ and might change between versions. This given combo will go directly to the sole impl. on the xwin binding schema which is not what i want b/c i just want to see the info but not navigate. – elonderin Jul 14 '21 at 14:00
24

Not an IntelliJ IDEA user, but this blog post seems to indicate that in version 8.1.1 and beyond Ctrl+Alt+U will display the "Quick Class Hierarchy".

vahid abdi
  • 9,636
  • 4
  • 29
  • 35
Daniel DiPaolo
  • 55,313
  • 14
  • 116
  • 115
  • 1
    That's pretty good, but is there a more lightweight one? This one builds a UML diagram? Just curious if there's quick hover which I can view its parents and go to them. – Glide Oct 21 '10 at 19:02
  • 2
    Seems this is not an equivalent. For example for interface org.slf4j.Logger it shows nothing more than Logger, which is useless. Ctrl-H seem to be better as it shows tree of implementing classes (the tree is unfortunately not expanded). However Eclipse shows also all extending interfaces and its implementing classes. Also below mentioned CTRL-ALT-B does not show tree or implementing interfaces. I'm just starting with Idea and was expecting that such frequently used function will supersede the Eclipse version, or will be at least equally good... – petrsyn Jan 30 '13 at 15:07
  • 1
    13.1 Ultimate appears to have it back and the shortcut works. – Jason D Jun 11 '14 at 22:11
  • UML class hierarchy Ctrl + Alt + U works only in Ultimate Edition – Srujan Kumar Gulla Mar 30 '16 at 19:29
  • Ctrl + Alt + U does not even show all ancestor traits. Only direct parents. Pathetic. – rapt Nov 18 '17 at 19:47
20

Intellij does - in contrast to Eclipse - distinguish between type hierachies and implementation classes. I'm still undecided whether this is a good thing or not (just switched over from Eclipse to Intellij myself)

On a Mac Intellij 14

  • Ctrl + H will bring up the type hierarchy showing you sub- and supertypes
  • Cmd + Alt + B will show you all implementing classes and subclasses of the interface/class you're interested in
Stefan Haberl
  • 9,812
  • 7
  • 72
  • 81
  • CTRL+ALT+B does not only make sense with interfaces - it also shows all subclasses of a class, so it's easily visible which types inherit from the class you're interesteed in. – nachteil Oct 12 '15 at 14:36
  • @nachteil thanks. didn't know that. I changed the description of cmd + alt + b – Stefan Haberl Oct 13 '15 at 07:34
  • 1
    Yes - Ctrl+H is correct answer Ctrl+Alt+B isnt exactly Ctrl+T of eclipse – prash May 20 '16 at 03:08
16

Also try CTRL+SHIFT+A in case of any doubt. The short cut for short cut information.

vahid abdi
  • 9,636
  • 4
  • 29
  • 35
sorencito
  • 2,517
  • 20
  • 21
12

In IntelliJ IDEA 12, it's Navigate > Type Hierarchy (Ctrl+H by default).

falmp
  • 39,347
  • 3
  • 21
  • 18
thSoft
  • 21,755
  • 5
  • 88
  • 103
7

For Mac users who come here, this is the shortcut for IntelliJ 14.1.4:

+H by default.

mkobit
  • 43,979
  • 12
  • 156
  • 150
5

For Mac Users, the shortcut is

^(control) + h

redhot
  • 27
  • 6
Zia
  • 2,365
  • 2
  • 17
  • 14
3

In IntelliJ 13, it's Navigate > Implementations or CMD + ALT + B by default. Of course, this shortcut can be overridden in your Keymap preferences.

Cody A. Ray
  • 5,869
  • 1
  • 37
  • 31
2

I don't know about prior versions, but in IntelliJ version 13 you can go into your Keymap preferences, search for "Implementations", and bind that to Ctrl+T. It will work very much like the Eclipse equivalent.

redhot
  • 27
  • 6
pohl
  • 3,158
  • 1
  • 30
  • 48
2

With Eclipse, hitting Ctrl+T on a type displays its subtypes and hit again Ctrl+T displays so supertypes. And so for... this is a toggle.
That is really helpful and also very straight.

Unfortunately with IntelliJ, the switch between the supertypes and the subtypes doesn't have any default shortcut. So you will have to click on the icons of the hierarchy windows.
If like me you favor the keyboard shortcuts to the "move cursor and click on mouse" option, I encourage you to set a binding for these two operations. For example Ctrl+Down for subtypes and Ctrl+Up for supertypes.

Where you can change the binding ("Bas" means "Down" and "Haut" means "Up") : biding

Note that these bindings are contextual to the "Other" context (Eclipse does have a similar enough concept). 1) In this way, enter Ctrl+T on a ArrayList type produces :

Default hierarchy

2) Enter Ctrl+Down focuses on subtypes :

subtypes focus

3) And Enter Ctrl+Up focuses on supertypes :

supertypes focus

In this way, I find it better than the default behavior but to be honest even with that shortcut adding, the IntelliJ feature is not as good as Eclipse which the Ctrl+T shortcut also works on methods...

davidxxx
  • 125,838
  • 23
  • 214
  • 215
2

One more option to do this:

For Windows user:

Ctrl + Alt + Left mouse click on type, method etc.

You will get this

Torino
  • 445
  • 5
  • 12
1

Whilst Eclipse includes the type hierarchy and class structure (methods, fields etc.) in a single view, IntelliJ splits these up: In addition to the CTRL+H (or ALT+8) "Type Hierarchy" view, the other relevant IntelliJ window is called "Structure" and can be invoked via ALT+7 (Structure Tool Window) or CTRL+F12(Structure popup).

(Not a direct answer to the exact question posted but would expect others from an Eclipse background may arrive here having googled for "intellij type hierarchy", as I did.)

Steve Chambers
  • 37,270
  • 24
  • 156
  • 208
1

Ctrl+U - go to base class

Ctrl+Alt+B - got to implementation. Type parts of class name to narrow down the list

Ctrl+H - open type hierarchy tool window

Ctrl+Alt+U - peek class/interface inheritance hierarchy

Konstantin Spirin
  • 20,609
  • 15
  • 72
  • 90
0

There is a hierarchy view as in Eclipse, have a look at the menu View / Tool Windows / Hierarchy or press Alt-8 or F4.

herberlin
  • 11
  • 1
  • 1