The “Source Helper” plugin is an Eclipse plugin that takes a very useful feature that exists in Intellij IDEA and puts it into Eclipse. In short, the feature shows the code of an out-of-visible-range starting bracket by floating a window that shows the code you cannot see. This helps immensely when trying to identify what closing bracket belongs to what part of the code.
Here is a Screenshot of how it looks in IDEA:
Why it was created
I think once you’ve had it and used it, you can’t live without it (which was my case and why I wanted it for Eclipse). But you probably want it because it makes it so much easier seeing where you are in your code, especially in deeply nested scopes.
How it works
The “feature” is that when you set the cursor at a closing bracket
) } > ] and the starting bracket happens to be out of range in the editor, it can be really hard to remember what that closing bracket is actually for. Eclipse will highlight starting/closing bracket pairs with a square box, but if it’s out of range you would have either scroll away from your code or do the “goto starting bracket” shortcut, which also takes you away from where you are.
This is where the plugin jumps in. If it notices the cursor on a closing bracket (or you write a closing bracket) and the starting bracket is out of visible range, it will find the snippet of code that started the scope and create a floating window that shows the code at the top of the screen, without blocking your view (see screenshots below). That way, you know right away what a closing bracket belongs to without the need for going anywhere in the code.
Normally the popup view sticks to one-line views of what started the code, but for method signatures it shows the entire method constructor.
The latest version is version 0.2.4. It was updated on May 09, 2009.
Here’s what’s new for 0.2.4.
- Brackets inside comments are no longer mistaken for “matching” brackets
- If the starting bracket and end bracket were not in the same location, the connecting line would draw funny, now it draws a bend
- Preferences page moved to under Java then “Java Editor”. Search for helper if you can’t find it in the Preferences dialog.
- Some minor glitch fixes
Gradient parent code:
Shorter history (Eclipse line style):
Shorter history (IntelliJ line style):
Parenthesis (line numbers in Eclipse turned on as well to show that the popup will align). Do note that the blue line is not drawn on parenthesis and only on curly braces:
Required Eclipse Version
It was built and tested under Eclipse 3.4 (and 3.4.1/3.4.2) (it uses a few copied internal class methods from Eclipse 3.4 to make it work, as these classes are normally marked as internal). Other versions have not been tested, but it’s possible it works for older ones as well. I have no current plan of making it backwards compatible.
- Field coloring in popup is missing (by default a blue color).
- Error underlines etc are not shown in popup.
The license is the Eclipse Public License (EPL). Read up on it here.
Like it? Vote for it!
If you like the plugin, please drop a vote for it for the Eclipse Plugin Central by selecting a score below and pressing “Vote!”. I do ask however that if you are planning on giving a low vote due to some existing bug, I’d prefer if you sent me the bug report instead. Thanks!
Eclipse Update Site
Alternatively you can tell Eclipse to download the Java Source Helper by adding an update site that points to:
Put the jar in your Eclipse plugins folder (for example: “C:\Program Files\Eclipse 3.4\plugins”), and start up (or restart) Eclipse. That’s it. The plugin should be visible in your plugins list and work out of the box. Here’s a screenshot of how it will show up when installed correctly (version should be whatever latest version is):
The latest version of the plugin has a preference page that looks like this. You will find it in Window->Preferences.
If you installed via the update site, uninstall the plugin from the Eclipse Update Manager. If you installed it manually, delete the jar from your Eclipse plugins folder and restart Eclipse.