Announcing Extras for Eclipse

Home  >>  Eclipse  >>  Announcing Extras for Eclipse

Announcing Extras for Eclipse

Over the last months, I wrote some extensions for the Eclipse IDE that I found were missing and could be implemented with reasonable effort.

The outcome is Extras for Eclipse, a collection of small extensions for the Eclipse IDE, which include a launch dialog, a JUnit status bar, a launch configuration housekeeper, and little helper to accomplish recurring tasks with keyboard shortcuts.

They have been developed and proven useful in daily work over the last months to me, and so I thought they might be useful for others, too. In this post, I will walk through each of the features briefly.

The most noteworthy Extras for Eclipse at a glance:

  • A JUnit progress meter in the main status bar and a key binding to open the JUnit View
  • A dialog to quickly start or edit arbitrary launch configurations, think of Open Resource for launch configurations
  • An option to remove generated launch configurations when they are no longer needed
  • A key binding for the Open With… menu to choose the editor for the selected file
  • And yet another key binding to delete the currently edited file

The listed components can be installed separately so that you are free to choose whatever fits your needs.

Installation

Extras for Eclipse is available from the Eclipse Marketplace. If you want to give it a try, just drag the icon to your running Eclipse:

Extras for Eclipse: Install from Eclipse Marketplace

If you prefer, you can also install Extras for Eclipse directly from this software repository:

In the Eclipse main menu, select Help > Install New Software…, then enter the URL above and select Extras for the Eclipse IDE. Expand the item to select only certain features for installation.

Please note that a JRE 8 or later and Eclipse Luna (4.4) or later are required to run this software.

Extras for JUnit

If you are using the JUnit View like Frank does and have it minimized in a fast view, the only progress indicator is the animated view icon. While it basically provides the desired information – progress and failure/success – I found it a little too subtle. But having the JUnit View always open is quite a waste of space.

That brought me to the JUnit Status Bar: a progress meter in the main status bar that mirrors the bar of the JUnit View but saves the space of the entire view that is only useful when diagnosing test failure.

Extras for Eclipse: JUnit Status Bar      Extras for Eclipse: JUnit Status Bar      Extras for Eclipse: JUnit Status Bar

Together with a key binding (Alt+Shift+Q U) to open the JUnit View when needed this made running tests even a little more convenient.

If you would like to hide the status bar, go to the Java > JUnit > JUnit Status Bar preference page. Note that due to a bug in Eclipse Mars (4.5) and later you need to resize the workbench window afterwards to make the change appear.

Launching with Keys

When working on Eclipse plug-ins I usually run tests with Ctrl+R or Alt+Shift+D T/P, but from time to time I also launch the application for a reality-check. And then Ctrl+F11/F11 to relaunch the previously launched application often isn’t the right choice. Neither does Launch the selected resource always pick the right one either.

See also  How to manage Git Submodules with JGit

Hence, leave the keyboard and grab the mouse, go to the main toolbar, find the Run/Debug tool item and select the appropriate launch configuration, if it is still among the most recently used ones. Otherwise, open the launch dialog, …

Therefore, I was looking for quicker access and came up with the Start Launch Configuration dialog. It works much the same as Open Type or Open Resource: A filtered list shows all available launch configurations. Favorites and recently used launch configurations are listed first. With Return the selected launch configuration(s) can be debugged. A different launch mode (i.e. run or profile) can be chosen from the drop-down menu next to the filter text.

And most important, there is a key binding: Alt+F11. Or if you prefer Ctrl+3, the command is named Open Launch Dialog.

The screenshot below shows the Start Launch Configuration dialog in action:

Extras for Eclipse: Start Launch Configuration Dialog

If there are launch configurations that have currently running instances, their image is decorated with a running (Extras for Eclipse: Running Launch Configuration Decorator) symbol. And if you need to modify a launch configuration prior to running it, the Edit button gives you quick access to its properties.

Launch Configuration Housekeeping

With launch configurations, there is another annoyance: each test that runs generates a launch configuration, and if you code test driven, you will end up with many launch configurations. So many that they obscure the two or so manually created master test suites that actually matter.

That brought me to the idea to remove launch configurations that were generated when they are no longer needed. The no longer needed is currently reached when another launch configuration is run. This still gives the ability to re-run an application with Ctrl+F11/F11 but limits the number of launch configurations to those that are relevant.

The term generated applies to all launch configurations that aren’t explicitly created in the launch configuration dialog such as those created through the Run As > JUnit Test or Debug As > Java Application commands for example.

With the Run/Debug > Launching > Clean Up preference page, you can specify which launch configuration types should be considered when cleaning up.

Extras for Eclipse: Clean up Launch Configurations Preference Page

Open With… Key Binding

Extras for Eclipse: Open With... Key Binding

Sometimes I had the need to open a file with a different editor than the default one.

To work around the broken PDE target definition editor for example, I used to open target definition files with a text editor. While this particular editor has improved since its Mars release, I still have occassional use for Open With….

As an extension of the F3 or Return key that opens the selected file in the respective default editor, there is now Shift+F3 that shows the Open With… menu to choose an alternative editor.

See also  Getting Java Event Notification Right

Delete the Currently Edited File

For a while now I realized that I use the Package Explorer less and less. It even is in the way at times and may as well make a good candidate for a fast view.

I find the package explorer – or more generally navigation views – a useful tool to get to know the structure of a software project, but once you are comfortable with it, the view adds less and less value while occupying much screen real estate.

Extras for Eclipse: Delete File in Editor

To navigate the sources I mostly use Open Type (Ctrl+Shift+T) or Open Declaration (F3) or the Quick Type Hierarchy (Ctrl+T) or the editors breadcrumb bar.

But to delete a file I have to go back to a navigation view, select the resource in question and hit the Del key.

This detour can be spared with yet another key binding, Alt+Del, that invokes the regular delete operation so that the behavior is the same as if the edited file was deleted from one of the navigation views.

Concluding Extras for Eclipse

This article describes the features that I found most noteworthy. For a complete list, please visit the project’s homepage.

For some of the extensions introduced here I have opened enhancement requests at Eclipse (see this Bugzilla query). If there are enough interest and support, I will eventually contribute them to the respective Eclipse projects.

I prefer a possibly slim IDE that consists only of those plug-ins that are actually necessary for the task at hand (mostly Java Tools, Plug-in Development Tools, MoreUnit, Maven integration, Git integration, EclEmma and Extras for Eclipse of course) – and in this environment the components have proven stable.

Therefore I would be grateful for hints if an Extras feature collides with plug-ins in a different setup. If you find a bug or would like to propose an enhancement please file an issue here:

Or if you even want to contribute to Extras for Eclipse, please read the Contributing Guidelines that list the few rules to contribute and explain how to set up the development environment.

Rüdiger Herrmann
Follow me
Latest posts by Rüdiger Herrmann (see all)

4 Comments so far:

  1. remerson says:

    These are really excellent features. They feel carefully considered, especially the key shortcuts, and the UI details are just right (my favourite is the little button next to the JUnit bar).

    I think they should all be included in Eclipse distributions as standard.

    Great work – thank you! :)

  2. mk says:

    Thanks for your efforts, really useful stuff.