-
Notifications
You must be signed in to change notification settings - Fork 1
Good to Know Eclipse Features
Here are some Good-to-Know-Eclipse-Features
All of these features can be enabled per project or workspace wide. To set them workspace wide go to Window -> Preferences To set them per project right click the project and go to Properties.
You can enable save actions in eclipse. These actions are triggered whenever you save your code. There are nearly 50 different save actions you can enable or disable, and there are even more you can define by yourself.
Here is how to set them up:
- go to
Window -> Preferences
- go to
Java -> Code Style -> Formatter
- Select the code formatter you want to use (for K&R indentation style use
Eclipse [builtin]
) - Hit
apply
- go to
Java -> Editor -> Save Actions
- Check
Perform the selected actions on save
- Check
Format source code
-Format all lines
- Check
Organize imports
- Check
Additional actions
- Click on
Configure
- In
Code Organizer
checkRemove trailing whitespace from All lines
- In
Code Style
checkUse blocks in if/while/for/do statements
-Always
- In
Member Access
checkUse this qualifier for field access - Always
,Use this qualifier for method access - Always
- In
Missing Code
check all options - In
Unnecessary Code
checkRemove unused imports
,Remove unused local variables
,Remove unnecessary casts
- Click on
ok
- Click on
ok
once again
Javadoc is essential for good documentation. But a programmer is a lazy being and will stop writing javadoc even if he did it the first week.
To force javadocs do the following:
- Go to
Window -> Preferences
- Go to
Java -> Compiler -> Javadoc
- Set the warning levels to
error
- Set the visiblitiy to
private
- Set Missing tag description to
Validate all tags
- Click
ok
and confirm your selection
Instead of using eclipse's automatic build options you can set eclipse to always use the ant build.xml for building and executing your code. Go to your Project Properties and select Builders. Create a new Ant Builder and fill in the options needed.