Eclipse – Useful Eclipse features?

eclipse

I have been using Eclipse as an IDE for a short amount of time (about 3 months of full use) and almost every day I learn about some shortcut or feature that I had absolutely no idea about. For instance, just today I learned that Ctrl+3 was the shortcut for a Quick Access window.

I was wondering what your most useful/favorite Eclipse features are. With the IDE being so big, it would be helpful to learn about the more commonly used parts of the program.

Best Solution

My most commonly used features are

ctrl+1 quick-fix / spell-checker

opening files

  • ctrl+shift+t load class file by classname
  • ctrl+shift+r load any file by filename

matches are made on the start of the class/filename. start your search pattern with a * to search anywhere within the filename/classname.

Formatting

  • ctrl+shift+f Format source file (set up your formatting style in Window | preferences | java | code style | formatter)
  • ctrl+shift+o Organise imports

Generated code

  • alt+s,r to generate getters and setters
  • alt+s,v to insert method signatures for overidden methods from superclass or interface

Refactorings

  • alt+shift+l Extract text-selection as local variable (really handy in that it determines and inserts the type for you.
  • alt+shift+m Extract text-selection as a method
  • alt+shift+i inline selected method

Running and debugging.

alt+shift+x is a really handy prefix to run stuff in your current file.

  • alt+shift+x, t run unit tests in current file
  • alt+shift+x, j run main in current file
  • alt+shift+x, r run on server

There are more. The options are shown to you in the lower-right popup after hitting alt+shift+x.

alt+shift+x can be switched for alt+shift+d in all the above examples to run in the debugger.

Validation

As of the recent Ganymede release, you can now switch of validation in specified files and folders. I've been waiting for this feature for ages.

  • Go to Project | Properties | Validation
  • click on the ... button in the settings column of the validator you want to shut up
  • Add a rule to the exclude group

code navigation

  • hold down ctrl to make all variables, methods and classnames hyperlinks to their definitions.
  • alt+left to navigate back to where you clicked ctrl
  • alt+right to go "forwards" again