Configuration

In the menu Windows>Preferences, search for

  • label decorations : some labels such as the project's maven version, the branch of the project can be very useful
  • validation : HTML, XML and JSP files are very, very, very long to validate and the errors raised are not always relevant. Therefore I generally check the "Suspend all validators" option.
  • save actions : enable some operations to be always made when a file is saved. For example, organizing imports. Available since Eclipse 3.4 only.
  • import : select the one in Content Assist > Favorites. Eclipse can't automatically import the static imports with CTRL+SHIFT+O if they aren't declared here. Add new Types with theses values :
import static org.junit.Assert // for assertThat
import static org.hamcrest.CoreMatchers // for is, equalTo, notNull, etc.

You can have more information about matchers on xebia's site : http://blog.xebia.fr/2008/04/02/simplifier-les-assertions-junit-et-ameliorer-vos-tests/

About Java > Editor

  • Content Assist : when Completion overwrites is checked, the former choice is overwrited when a suggestion of the autocompletion (got with CTRL+SPACE) is selected.
  • Mark occurences highlights all the same occurences in the same file.
  • Templates : I do feel kind of lost when I am working on another computer and don't have them. I have one for log4J logger, for mocking classes, to generate comments... all prefixed with "my_".
  • in Typing, when semicolons is checked, they are automatically inserted at the correct position (in other words, at the end of the line). No need to type end of line before typing ";".

About General > Editors > Text Editor

  • Print margin column : draw a line in the Xe character
  • Show line numbers : to display the line numbers in the left of the file

Shortcuts

From the most to the least used :

  • CTRL+leftClick : to go to the declaration of the item selected (instance, class...). F3 would do the same.
  • CTRL+SPACE : autocompletion, the only must !
  • CTRL+SHIFT+T : open a class
  • CTRL+SHIFT+R : open a resource
  • CTRL+T on a method or a class X : displays the implementations of X and its children
  • CTRL+SHIFT+/ : put or remove comments on the selection
  • CTRL+D : delete the current line
  • CTRL+ALT+(up|down) : copy the selected block up | down. Preserves whatever has been copied with CTRL+C before!
  • ALT+(up|down) : move the block up | down
  • SHIFT+ALT+X, then T : run the tests of the current test class
  • CTRL+O : to display the methods of the class and go to one of them
  • CTRL+O(twice) : to display the methods of the class and the super class and go there
  • CTRL+1 : display the quick fix
  • ALT+SHIFT+A then SHIFT+up|down : to edit a block vertically (available since Eclipse 3.5)
  • CTRL+L : to go to a specific line number
  • CTRL+SHIFT+F : autoformats a selection of code or the whole class if nothing is selected
  • CTRL+K : to go to the next occurence of the selection
  • CTRL+SHIFT+K : to go to the previous occurence of the selection
  • CTRL+H : search functions
  • SHIFT+ALT+S, then V : to oVerride a method
  • SHIFT+ALT+S, then R : to geneRate getters and setters
  • CTRL+E : search in the open tab names
  • CTRL+J : incremental search
  • CTRL+M : make the window wider
  • CTRL+SHIFT+(up|down) : go to the next/previous method
  • CTRL+SHIFT+O : organize imports automatically. I don't use it anymore because these action is automatically done each time I save a file (thanks to the save actions module).

For refactoring :

  • ALT+SHIFT+R : rename a class/object
  • ALT+SHIFT+L : extract local variable
  • ALT+SHIFT+M : extract method

Plugins

  • Maven to have dependencies management
  • Spring IDE to have autocompletion and bean references
  • Subclipse to be able to synchronize versions easily.