JustDanyul
JustDanyul

Reputation: 14054

How to quickly find the fully qualified name of a class in IntelliJ?

I been giving IntelliJ a spin, and loving it so far. But, I got a question, is there any way of quickly getting the fully qualified name of a class from within the editor?

So, if I have some code like

Element element = new Element();

I could quickly get the fully qualifed name of Element, for example, com.whatever.Element

Upvotes: 35

Views: 22814

Answers (4)

Marit
Marit

Reputation: 3046

You can also pull up Quick Documentation for a class by pressing F1 when your cursor is on that class in the editor. Granted, this will show you more than jthe package where the class resides, but does include the package name.

For example: Quick Documentation in IntelliJ IDEA

Upvotes: 0

ajp15243
ajp15243

Reputation: 7960

Ctrl and hover (or and hover)

If I hold Ctrl and hover over the class name Element with my mouse, I get a popup with the following information (assuming Element extends AbstractElement and implements IElement):

[intellij-module-name] com.whatever
public class Element extends AbstractElement
implements IElement

The package name after the module name on the first line, plus the name of the class itself, would give you the fully-qualified name in your head. You can also Ctrl+Left Click on the Element class name to jump to its definition, where you could copy out the package declaration from the file if you need the actual text in the editor for whatever reason.

For macOS, hold while hovering mouse pointer.

Upvotes: 26

Peter Gromov
Peter Gromov

Reputation: 19001

Press Ctrl+Alt+Shift+C (Edit | Copy Reference) on "Editor" in the code and you'll have the fully-qualified name in your clipboard.

Or alternatively just right-click on the code and select "Copy Reference".

Upvotes: 53

vegemite4me
vegemite4me

Reputation: 6896

Pressing Ctrl+Q when the cursor is inside the class name, will show you the class's package name and the Javadoc for that class. Esc will then close the window.

Upvotes: 11

Related Questions