eclipse package explorer: file node duplicates type node?

When you activate Java members for the package explorer in eclipse, the tree hierarchy goes source folder > package > java file > type > methods. Together with Mylyn that is actually quite handy. However, I feel that the Java file node is superfluous. Since every file contains exactly one "root" type, there will always be exactly one type node under the file node showing the same name. That just takes space away and doesn't add any info. It would make much more sense to have only the Java language elements in this tree: package > type > members. When you disable members it makes sense to replace type nodes with file nodes to avoid having to load the additional information from the file. But when members are enabled it doesn't.

Is there some option which makes the package explorer skip the file nodes, or am I missing some rationale here?


@Wolfgang, I agree with your rationale. For vast majority of cases, there is a 1-to-1 mapping between a .java file and its contained type. While it is possible to have multiple top-level types in one .java file, this practice is not common, especially after advent of inner types. Arguably, even if you are using multiple top-level types feature, explicit relationship to the .java file is not that important. If you delete all types in a file, the file can go away.

Unfortunately, there is no option to suppress .java file nodes. I suspect that this is mostly for historic inertia reasons. The various navigational views started as basic file navigators way back when.

I would suggest opening enhancement request for Eclipse Java Developer Tools.

I think if you explore source code, files are very important part of appearance. They can be not just java files (does not contain types), can contain more than 1 type (file with non-public classes) etc. If you just skip file names you would have a bunch of classes under package level and not aware what class belongs to what file.

Need Your Help

Graphics.DrawImage: Out of memory exception

c# system.drawing

I just can't for the life of me figure out why I'm getting an out of memory exception here, even after much research on various websites and forums. Is anyone able to shed some light on the root of...

java gdb runtime

java process gdb runtime runtime.exec

how do you execute gdb commands using process object in java?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.