Keyboard shortcuts

Table of Contents

Eclipse Tips David Matuszek

Some people like to learn all the keystroke "shortcuts," so they never have to take their hands from the keyboard. I'm not one of them. Research has consistently shown:

Nevertheless, there are some keystroke "shortcuts" that I think you should learn. Not only are they very useful, but some of them are buried in sub-menus that are not easy to find, so the keystrokes probably really are faster. Here they are, most important ones first:

F3 F3. This will bring you immediately to the place that that name is declared or defined, even if it is in a different .javafile. Ctrl-K Alt-Shift-J Ctrl-/ //at the beginning of each line in the selection. Ctrl-I Ctrl-Shift-F

Go to Window → Preferences... → General → Appearance → Colors and Fonts → Java → Java Editor Text Font and click Change....

Here's what you want in a font:

0and O(zero and capital o) Iand 1and land |(capital i, one, lowercase L, and vertical bar) :and ;(colon and semicolon) ,and .(comma and period) (and {and [and )and }and ](parentheses, braces, and brackets).

Consolas and Menlo are some of the best fonts for programming; Courier or Courier New is generally OK. In Moore 207, I like bitstream vera sans mono at 10 point.

Go to Window → Preferences... → Java → Editor → Typing and check everything. Then try some editing and see if you like the way it behaves. Give it a chance--don't reject it immediately just because it's different.

Hint: Some things, like putting semicolons at the end of a line, can be undone by hitting the backspace key.

When I run a program, I don't like always having to say yes, save the files first. To avoid this dialog box, go to Window → Preferences... → Run/Debug → Launching and under Save required dirty editors before launching, choose Always. Under General Options, check Build (if required) before launching.

Source: cis.upenn.edu