CIT 590 Eclipse Settings
Spring 2009, David Matuszek
Required settings:
Formatting according to Eclipse's Java Conventions
[built-in] is mostly correct, but there is one problem:
it indents using both tabs and spaces, which means that your
formatting will look seriously messed up if
someone views your program with different tab settings. Tabs should
never occur in a Java file.
Fix this as follows:
- Go to Eclipse -> Preferences...
(or Window -> Preferences... in some
versions)
- Open Java -> Code Style -> Formatter
- Choose Java Conventions [built-in]
as the "Active Profile", and click Edit...
- In the "Indentation" tab, set "Tab policy:" to "Spaces only",
and set both "Indentation size:" and "Tab size:" to
4
- At the top, enter a new "Profile name:", for example,
Java Conventions [corrected]
- Hit Apply and OK
until you are out of the Preferences dialog
Also,
- Go to Eclipse -> Preferences...
(or Window -> Preferences... in some
versions)
- Open General -> Editors -> Text Editors
- Set the "Displayed tab width:" to 4 and check
"Insert spaces for tabs"
- While you are here, you may also wish to check "Show line numbers"
- Hit Apply and OK
until you are out of the Preferences dialog
This matters because good indentation matters!
Finally,
- In Preferences... -> Java -> Compiler,
set your "JDK Compliance" to 1.6 (or, if you must, 1.5)
Recommended settings:
In Preferences,
- In General -> Editors -> Text Editors,
check "Show line numbers:"
- In Run/Debug -> Launching,
- Set "Save required dirty editors before launching" to "Always"
- Set "Wait for ongoing build to complete before launching" to "Always"
- Set "Launch in debug mode when workspace contains breakpoints" to "Prompt"
- Set "Continue launch if project contains errors" to "Prompt"
- Check everything under "General Options"
- In "Launch Operation" set "Always launch the previously launched application"
- In Java -> Editor -> Content Assist, the "Auto
activation delay" controls how long Eclipse waits after you type a dot, an @
sign, or a # character, before popping up with suggestions. You can adjust this
number (in milliseconds) to whatever you find most comfortable.
- In Java -> Editor -> Typing, check
everything, and notice what you are checking.
- Inserting semicolons at the "correct position" does it right about
95% of the time. The other 5%, hit Control-Z to move the semicolon
back to where you typed it
- If you don't like these automatic features at first, try them for
a few days before cancelling them--you may learn to like them
Eclipse is highly configurable. If there is something it does that you don't
like (or something that it doesn't do that you wish it would), spend some
time looking through the preferences--it's probably already there somewhere!