My Top 10 Tips on how to be more productive with the Eclipse IDE

October 26, 2012 | 5 min Read

I’ve met many programmers over the years who had just started using Eclipse or already had “some experience” – but they used Eclipse just as a text editor or handled it in a very cumbersome way. The main problem was that they hadn’t yet learned about Eclipse’s capabilities and how to leverage its powerful features.

So, I thought I would write about my top 10 recommendations that will make your programming life easier and make you more productive.

Note: Click on the images to reveal a larger screenshot.

1. Text File Encoding

Workspace` or in your project specific settings.

2. Save automatically before build

Workspace`

3. Type Filters (for PDE / RCP developers)

Type Filters remove suggestions for certain types (e.g. classes, interfaces) from the “Open Type” dialog, content assist and quick fix proposals. Especially as an RCP / SWT developer you most likely don’t want suggestions for Swing components like Button, Label, etc.

You’ll find this setting in: Preferences > Java > Appearance > Type Filters

4. Use “Step Filtering” for Debugging

With “Step Filters” you can filter out types that you do not wish to see, or step through while debugging. This helps you to stay focused on the actual code and does not expose you to the inner workings where you might not even have the source. Have a look at Holger’s Effective Mockito post about Step Filtering in conjunction with Mockito.

You’ll find this in: Preferences > Java > Debug > Step Filtering

5. Always launch the previously launched application

Launching`

If you want to automatically stop running instances when you start a new one, have a look at Launch an OSGi app and automatically kill its running instance.

6. Store your Launch Configuration in a Project

You probably spend a good amount of time crafting your launch configuration. You can actually store it as a file in one of your projects so you can check it in. This way you can share it with colleagues and save them from reinventing the wheel.

You’ll find this Preference in: `Menu:` Run `>` Run Configurations… `> Launch Configuration Tab:` Common

Hint: You can access the Launch Configurations dialog by clicking the Launch/Debug action in the Toolbar while holding the ctrl key or cmd on a Mac.

7. Make a Launch Configuration always appear in the Menu

If you have multiple Launch Configurations, you can choose your favorite ones and stick them permanently to your Launch/Debug menu.

Go to: `Menu:` Run `>` Run Configurations… `> Launch Configuration Tab:` Common

8. Organize imports on save

Save Actions` or in your project specific settings.

9. Format edited lines on save

The code formatter in Eclipse is a very useful thing. It ensures that the code looks consistent in your projects – no matter who wrote it – and can be easily read and understood by anyone else. But, formatting the whole file can seriously mess up a diff between two versions of the file. So ‘format only edited lines on save’ might be the right choice if you want the have your code formatted and still be able to see what was changed in your code later on.

You’ll find this in: Preferences > Java > Editor > Save Actions or in your project specific settings.

You might also want to take a look at the Eclipse Checkstyle Plug-In. This will help you to enforce your coding guidelines.

10. Let Eclipse do the typing

A good IDE should support the developer in writing his code at nearly the speed of thought. And Eclipse comes quite close to this with Refactorings, Quick Fixes, Code Assist/Code completion and more. So don’t type too much yourself – you will, here and there, type something wrong, overlook something, scroll through code, which costs a lot of time. Force yourself to use shortcuts!

Here is an example. If you want to store a method parameter in a field, just set the cursor on the parameter name, hit the Quick Fix shortcut and select Assign parameter to new field. And poof, you’re done. If you need a getter, type get somewhere in your class (outside of a method declaration) and use Content Assist to let Eclipse create the method for you. The same applies for creating setters, the main method, the constructor and more.

  • Quick Fix: ctrl+1 or cmd+1 on a Mac
  • Content Assist: ctrl+space (for Mac and PC)
  • Quick Access: ctrl+3 or cmd+3 on a Mac

aka ctrl+awesome

  • Open Type: shift+ctrl+T or shift+cmd+T on a Mac

Use the Mousefeed Plug-In, to learn keyboard shortcuts.  It gives you a message showing the keyboard shortcut for the action you just performed with the mouse.

11. (Bonus Tip) Get a Solid-State Drive

Eclipse has to handle many small files: source code, compiled files, metadata, local history, git, etc.  And, the hard drive you use has a massive impact on most of the actions you perform throughout the day. A major performance boost , and therefore a productivity boost, can be achieved by upgrading to an SSD. Here is an article from Dr. Dobb’s on that topic.

If you have feedback or something to add, please feel free to leave a comment below.