12 Tips to make you more productive using Eclipse
Integrated development environments make developing application fair easier. They highlight syntax, let you know if you have a compilation error, and allow you to step through your code among so many other things. Like all IDEs Eclipse has a bunch of little shortcuts and tools that can make your life a lot easier, I've compiled a list of several that I use on a daily basis:
1. Auto-complete – Eclipse has an auto-complete feature that can be accessed with ctrl + space. When clicked a small pop-up box is displayed with a list of context sensitive suggestions. If there is only one possibility then Eclipse completes it for you.
2. Quickly format your code – Code that is being heavily modified can quickly become an ugly sight. Without proper indention it can become extremely difficult to determine what is happening in code. Code can be quickly formatted using the shortcut: Ctrl + shift + F. You can even setup your own style rules by going to: Project>Preferences>Java Code Style>Formatter, check “enable project specific settings” edit the profile and then save it under a new name.
3. Get rid of unnecessary code – Heavily worked on projects that aren't maintained well can quickly build up a bunch of unnecessary imports, casts, among other common easily detectable coding mistakes. Quickly remove these mistakes by running a code clean up. Right click on your project folder>source>clean up. Like the code formatter you can also customize your code clean up.
4. Go to declaration – Want to know where that method, variable, or class is declared? This can easily be done by holding down ctrl and then clicking on the reference.
5. Find all references – If you need to find all the references for a method, variable, or class highlight the desired reference right click>reference and select the desired search scope.
6. Quickly select groups of characters – Need to delete an entire string, or everything within a method's argument declaration? Select the enclosing character (e.g. the “ or "(" respectively), this will select everything within the enclosing characters. This even works with the bodies of classes and methods. You can also select an entire line by triple clicking.
7. Rename all instances – If you need to rename a method, variable, or class you can rename ever instance by highlighting a reference and pressing alt + shift + r an box will highlight the reference and you can rename it. Upon pressing enter all instance will be renamed in your project.
8. Change a method signature – If you need to change any part of a methods signature; a methods name, its arguments, or return type, you can quickly make a change to all references of the method in the project by highlighting the method and pressing alt + shift + c a pop-up box will appear giving you options to change the method's signature.
9. Automatically generate getters and setters – Writing getters and setters is for suckers. After you write out all the members of a class right click anywhere in the code screen>source>generate getters and setters. Select the variables you want to have getters and setters made for.
10. Javadoc is a cinch – Eclipse makes writing Javadoc easy, just type “/**” and press eneter above a declaration. Eclipse automatically creates context sensitive Javadoc annotations (i.e. a methods parameters, or the author of a class). After that you only have to write out what the method actually does.
11. Run a unit test – To run a unit test highlight the unit test and press alt + shift + x followed by t. You can also run a unit test in the debugger by pressing alt + shift + d followed by t.
12. Comment out code – If you need to quickly comment out a chunk of code, highlight the corresponding lines and press ctrl + /, you can uncomment code the say way.
Chime in with your own Eclipse shortcuts.
Related posts:

October 20th, 2009 - 06:22
Pretty sure that item 11 – Run a unit test is ALT-SHIFT-D (not T) followed by T. At least that’s how it is in my key bindings and I have no memory of customizing it.
October 20th, 2009 - 09:09
You’re right, thanks for catching the typo.
October 21st, 2009 - 12:21
ALT-SHIFT-D is for debugging, ALT-SHIFT-X is for executing
October 20th, 2009 - 10:10
item 7 shoud be alt-shift-r
October 20th, 2009 - 11:01
Ack! Need to proof this a little more next time.
October 20th, 2009 - 11:23
Pretty Lame List
October 20th, 2009 - 11:43
Make a better one then and I’ll link to it.
November 4th, 2009 - 01:44
thanks for replying in a civil manner to a lame comment.
makes me regain faith in humanity
October 20th, 2009 - 13:22
Very Helpful. Many thanks
October 20th, 2009 - 20:47
ctrl-shift-t : Open Java Type
ctrl-shift-r : open resource (i.e. any file in project)
ctrl-alt-t: Refactor menu
…and you should probably memorise all the shortcuts in that menu.
October 21st, 2009 - 02:03
Ad 5. ctrl + H on method or type (who uses mouse) ;]
Also ctrl + t to look for type hierarchy
October 21st, 2009 - 08:21
crtl-shift-L : all keyboard shortcuts.
November 3rd, 2009 - 01:25
Good list. Sadly the getter/setter generation doesn’t work for PHP. Have to use templates, a bit cumbersome.
November 3rd, 2009 - 04:58
The ultimate shortcut: Control-3 -> opens a quickfilter popup with almost every action possible
October 18th, 2010 - 17:10
Highlight a literal and use alt+shift+l to extract an local constant.
Highlight a block of code and use alt+shift+m to extract method.
ctrl+d do delete an entire line
ctrl+alt+down to clone current line
alt+down/up to move current selection down/up
These are my favs.
October 22nd, 2010 - 06:26
issue 12 can also be achieved by ctrl+shift+c