Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij project view: not show multiple classes in same file

One frustrating thing I find in Intellij's project view is that it shows all the classes in a file instead of just the class for which the file is named.

The problem with this is that to open a file I have to double click twice: once to expand the file and show the classes in the file, and then a second time to actually open the file.

In most cases I don't want to see the classes inside of a file. I just want to see the file in the project view and when I double click on the file I want to open the file, not drill down into its structure.

Is it possible to configure my UI this way?

UPDATE: further explanation

enter image description here

Apparently people are having problems understanding this question. See the above picture of the Intellij Project navigation pane. Notice that some classes (the blue circles) have a + sign and others do not. The ones with a plus sign are files that have multiple classes inside of them.

The problem is that if you double click on a file with only one class (no plus sign) it opens (GOOD), but if you double click on a file with multiple classes in it (has plus sign) then the file does NOT open, it just expands the plus sign to show you the individual classes in the file as BoxArray.java, for example (BAD).

For example, if I double click on the file Coastline.java in the view above it will NOT open the file, it will expand the plus sign. I want it to open Coastline.java when I double click on Coastline.java, not expand it. I do not care about seeing the classes inside of a class file, I just want to open it in one double click.

I know that I can use the hotkey F4 to do this. I do not want to reach for the F4 key. I want to double click on the file and have it open.

like image 394
Tyler Durden Avatar asked Oct 17 '13 02:10

Tyler Durden


2 Answers

When you enable Autoscroll to Source in the little menu of your Project tool window (View > Tool Windows > Project), single clicking a collection (closed and opened) goes straight to the code as well as folding / unfolding it.

This works in IntelliJ 13.1 and 14 (in OSX and Linux)

IntelliJ 14 project window config menu

like image 77
Peter Avatar answered Oct 20 '22 00:10

Peter


You could bind Jump to Source function to double click in Settings -> Keymap -> search for "Jump to Source" -> RMB click and choose "Add Mouse Shortcut". Now double clicking on file will open it. Drawback could be that from now if you double click on some code to select it you will always go to source..

like image 39
Tomasz Góralski Avatar answered Oct 20 '22 00:10

Tomasz Góralski