nz_21
nz_21

Reputation: 7403

Intellij: how to directly open relevant file when clicking on class icon?

enter image description here

My file structure looks like the above picture.

Now, when I click on Environment, it shows me all of the methods on the sidebar, rather than opening up the file Environment.java. I want it to open the file instead.

How do I accomplish this?

Upvotes: 1

Views: 526

Answers (3)

Yassin Hajaj
Yassin Hajaj

Reputation: 22005

  1. Click on the gearing on the Project header

enter image description here

  1. Click on Autoscroll to Source

Upvotes: 2

Bohemian
Bohemian

Reputation: 425418

  1. Click on the little settings icon at the top of that project window.
  2. Select “Autoscroll to source”

That causes the editor pane for that file (if open) to become the current pane. If it’s not already open, double click.

I always also select “Autoscroll from source” too, so selecting an editor window causes the same file to be selected in the project window

Upvotes: 1

Makoto
Makoto

Reputation: 106508

By convention, that menu is doing what it should; it shows you the symbols contained in that class.

If you want to navigate to the file, don't rely on your mouse and instead use the keyboard shortcut CTRL+N (or equivalent on Mac) to open a class.

Upvotes: 1

Related Questions