10 Things Everybody Should Try in Eclipse

[great tips duplicated from Michael Bolin]

Forget the vi/emacs text editor war, when it comes to writing Java code, you should be working in Eclipse. Eclipse is an extensible, open-source IDE. There are thousands of plugins for Eclipse out there, but its primary use is as a superior Java IDE. You will quickly see how it is more powerful, and more importantly, more efficient than using a plain text editor to write Java code.

  1. Control-Space: used for identifier completion, template insertion. Try typing "pub" then Ctrl-Space, or "for" then Ctrl-Space, or a prefix of one of your variables then Ctrl-Space.
  2. Ctrl-F6: switches to another editor tab. It's a stupid default change it to Ctrl-Tab in Window/Preferences.
  3. Scrapbook pages. File/New/Scrapbook page. Type some Java code, SELECT IT, and then right-click to run it immediately (Inspect, Display, or Execute). Don't use this to test your own code, since it makes you lazy. But it's great for learning how to use somebody else's code, like Java API classes.
  4. Rename/move. Right-click on any package, class, method or variable in the Package Explorer and select Refactor/Rename to rename it or Refactor/Move to put it in another package or class.
  5. Organize imports. Don't write an import statement anymore. Just use Ctrl-Shift-O (Source/Organize Imports) to update the import statements automatically. Missing imports will be added (with help from you if there are ambiguities); unneeded imports are deleted. It normally won't use * in import statements, so some classes will have too many import statements for easy reading. Go to Window/Preferences/Java/Organize Imports and change "Number of imports needed for *" to some lower number. I use 4.
  6. Project sets. File/Export/Team Project Set saves some or all of a workspace configuration (i.e., multiple projects fetched from multiple CVS repositories) for easy import into somebody else's workspace. I haven't tried this yet, but it seems like the best way to bring new people into the LAPIS group.
  7. Source/Override Methods. Pops up a dialog box letting you pick which methods of the superclass you want to override, and inserts templates for them automatically.
  8. Source/Generate Getter & Setter. Creates get/set methods for a field.
  9. Ctrl-1: fires up Quick Fix. Offers a range of instant fixes for each error message.
  10. Fast View. Drag any view window (not an editor) to the vertical toolbar on the left. It will drop there as an icon, so you can pop it open quickly, use it, and close it.