Auto-complete |
Ctrl-Space helps you
complete some code you've started. Examples include (a) completing
partial variables, method names and class names, (b) showing available
constructors or parameters and (c) showing methods to override.
|
Organize import statements |
Ctrl-Shift-O (that's
O as in Organize) updates the import
statements at the top of your class, adding classes that need to
be imported and removing classes that you're no longer using. If a
class name is ambiguous — e.g., List might be either
java.util.List and java.awt.List —
Eclipse asks which you want. |
Look up
Java API documentation |
Shift-F2 when your cursor
is on a class or method name. (You have to configure this feature with
the location of the API documentation.) |
Comment or uncomment a block of code
|
Ctrl-/ comments the
highlighted region. Ctrl-\ uncomments the region. |
Rename or
move packages, classes, etc. |
Alt-Shift-R (Rename) or
Alt-Shift-V (Move) renames or moves the package, class,
method or variable your cursor is over, updating all references
automatically. |
Delete current line |
Ctrl-D when cursor is in
the line to be deleted. |
Mark TODO items as reminders for
yourself |
If you start a comment with
TODO Eclipse automatically puts the comment in the Tasks
pane (which also shows your compile errors). You can jump to
TODO items or compile errors in your code quickly by
double-clicking on them. |
Generate get() and
set() methods |
Make sure the fields are declared in the class, then right-click and
use Source » Generate Getter and Setter . |
Run
recently run classes or unit tests |
The little "play" icon on the toolbar
runs the most recently run class or unit test. Pull-down its menu to
select another recent run. |
Turn off
console autoraise |
When a program writes to standard out
(say, via println ), Eclipse raises the "console"
perspective. This may be annoying when you run tests, for example. To
turn this off, go to Window » Preferences » Run/Debug »
Console and uncheck Show when program writes to standard
out . |
Emacs key bindings |
If you prefer to use Emacs key
bindings, use
Window » Preferences... » General » Keys
» Modify
and set to
Emacs . |