Last week I wrote a post reviewing some of the new features of Eclipse Europa. Since then, I had a chance to do some more heavy coding with the platform and experience it in greater depth. I feel my previous article did not do justice with one feature which I can single out as THE most important addition to Eclipse JDT in the Europa release: the "Save Actions".
Let me put it this way - this can completely change the way you write code.
The scenario is simple. You write your code, you don't need to worry about formating, imports and a whole bunch of other nuisances that just take too much time to worry about. You hit the "save" and that's it. Your file is as good as new. One keystroke, which you're already using today, fixes everything and aligns you with the standards. Amazing.
You need to give it a try in order to understand how radical it is and how much time it can save you.
Unfortunately, the feature is turned off by default. I can understand why, however, by all means, turn it on and see the wonder in action.
Here's a partial list of the fixes that can be done with the "save actions":
- Formating - indentation, braces, white spaces, blank lines, control statements structure, line wrapping, comment structure
- Organize imports - no more unnecessary imports in your file. EVER.
- Code style - enforce using blocks for if/while/for/do, automatically add final modifier, etc.
- Member access - automatically quality field and method access, etc.
- Unnecessary code - remove unused members, local variables, casts, etc.
- Missing code - add @Override and @Deprecated annotations.
- Code Organization - sort members, sort enum constants, remove white spaces
As I see it, this is a great start. This is just the initial version of this feature and I hope the list will grow longer. I would also like to see some customization options, but that's another issue.
Bottom line - this feature is a true hidden gem. Use it.