Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/raedan/public_html/textpattern/lib/txplib_db.php on line 14
State of Flow: Browsing Eclipse Java Perspectives::journal

Browsing Eclipse Java Perspectives

Channing Walton - Sunday February 25, 2007

When developing in Eclipse I favour the Java Browsing perspective over the Java Perspective. Here’s why …

The Java Browsing Perspective organises the IDE views with the Projects, Packages, Types and Members views laid out horizontally at the top of the IDE window, and the editor area underneath.

This arrangement will be familiar to those that have developed in Smalltalk or Visual Age for Java. It pops up in other places such as the Ruby documentation at RDoc.

The Java Browsing Perspective continues this tradition. Here is an example:

Java Browsing Perspective

Compare this to the Java Perspective:

Java Perspective

So why do I like it? There are at least two areas where this perspective has an advantage of the Java Perspective or other IDEs that use a similar approach: navigation and code design.

The browsing perspective presents information much more compactly than the Java perspective making navigation of the codebase much easier. Even for the small project1 shown in the screenshots above, the Java perspective cannot show all the packages, source folders or method names (outline view). But the entire project is visible in the browsing perspective.

But some people do not like this perspective because the amount of editing space is less than other perspectives – “you cannot see the whole file you are currently editing”. I become concerned when I hear talk of files and the need to see as much of a class as possible.

For object oriented programming, thoughts should be on types and their interfaces, not implementation details and certainly not files. Having to know how methods are implemented to use them should be something we strive to avoid. Codebases I have worked on that require careful study of implementation details to use or extend a type have always been a bit of a mess.

To help you focus on types and interfaces there is one more magic button you can press: Show Source of Selected Element Only2. Enabling this feature limits the editor to the source of methods you select in the Members view, or the whole class if you select it in the Types view. This creates even more space for other views you might need, but more importantly, you will find yourself looking more to the types and member views (behaviours!), rather than implementation details in the editor. This is what it looks like:

Java Browsing Perspective with Show Selected Element Only

There is one more tweak I make to this perspective, I put the Members view on the right using all the vertical space:

Java Browsing Perspective with Members view adjusted

I have found this arrangement helps me navigate the codebase quickly, especially when using small monitors like a laptop screen.

It might take you some time to get used to this perspective. When I switched from Visual Cafe to Visual Age for Java in the late nineties I struggled a bit at first. But after a short while I found it to be much more efficient.

Try it for a week, what’s the worst that could happen?

1 This project is called JEDI, soon to be released. If you like functional languages, you’ll find JEDI offers a little relief in a world of Java.

2 You may need to add the Show Source of Selected Element Only buttons to the perspective as follows. From the Window menu select Customise Perspective. Click on the Commands tab and select Editor Presentation.


  1. Daniel    Sunday February 25, 2007

    “Show Source of Selected Element Only” is not good.

    When I work on unfamiliar class, I always read all the JavaDocs (sometimes, all comments and “FIXME”s) in other method. This give me an idea what this class intends to do.
    When debugging on low quality codes, reading these information is very very important.

    “Show Source of Selected Element Only” discourage this from happening.

  2. Rafael Chaves    Sunday February 25, 2007

    “Show Source of Selected Element Only” is dangerous.

    Because it limits what you can see, but not what you can act upon. Example: if you press Ctrl-D (line delete) multiple times at the bottom of the currently selected element, you will start deleting the top lines of the next element WITHOUT NOTICING IT!!!

    I have reported this as a bug but the answer I got from the Text team was: “it has been like this from day zero, won’t fix”.

    That’s why I don’t use that feature and warn others not to use it as well.

  3. Channing Walton    Sunday February 25, 2007

    Rafael, I had never noticed that bug which sounds really nasty. Whats the bug number?

  4. Channing Walton    Sunday February 25, 2007

    Daniel, I agree that when working on poor quality codebases you need to do everything you can to understand what is going on. If the methods of a class do not convey sufficient meaning then you are in trouble. When working on your own code though, that shouldn’t be the case.

  5. Rafael Chaves    Sunday February 25, 2007

    Channing, you already CC’d yourself on it, but here is the URL:

    https://bugs.eclipse.org/bugs/show_bug.cgi?id=135563

    As you can see, my memory had betrayed me. The PR was not actually marked as WONTFIX, but there are no plans of working on it for the foreseeable future (that is what ASSIGNED status means, when the assignee is the component inbox).

  6. Channing Walton    Sunday February 25, 2007

    Thanks Rafael, I had found it. I am considering fixing it myself as its clearly wrong :-)

  7. Alex Blewitt    Sunday February 25, 2007

    Yeah, I use this for all of my development work as well. My thoughts are people are too used to the Windows explorer and its primitive tree-like view instead of the Mac’s superior columnar view, which the Java Browsing perspective does a good job of.

    (And I came from VAJ too)

  8. Andrew Jackman    Tuesday February 27, 2007

    I think you should use VI. It’s much more powerful than Eclipse! ;)

  9. Juan Jose Zapico    Wednesday March 14, 2007

    Coding as in Visual Age for Java is really a big feature. I use Eclipse that way, and I agree with you: thinking in files is not OO thinking. Do you know if NetBeans 5.5 have something like “Show Source of Selected Element Only”” ? Thanks.

  10. Channing Walton    Wednesday March 14, 2007

    Hi Juan, I am not aware of a similar netbeans feature. But I find netbeans really clunky in general ;)

    Channing