« Game Review: Command & Conquer 3 | Main | H2 Database engine: a developer presepective »

Aug 09, 2007

Eclipse Europa JDT: "Save Actions" rocks!

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.

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/t/trackback/2460116/20707570

Listed below are links to weblogs that reference Eclipse Europa JDT: "Save Actions" rocks!:

Comments

Welcome to the real world! :) You should really give IntelliJ Idea a try.

I finally took the time to set up my own code formatting template, and reviewed and tweaked every single option. Then I turned format-source-code, organize-imports, and several additional-actions in the save actions prefs. Open file, hit space, backspace, and Ctrl+S. It's just like magic! Very nice.

I'm pretty OCD about some aspects of code formatting (I *hate* whitespace on empty lines almost as much as curly brackets on the wrong line), so this will save me lots of time.

There's still a couple formatting options that would be nice to have, but this is a huge step in the right direction. I do agree with you: save actions rock!

Followed the link in your reply on DZone. Haven't tried save actions, didn't know about it so thanks for this info. Those things it does are not things I miss at the moment but it sounds as you had the same idea before you tried it. Will check it out as soon as I upgrade Eclipse.

Post a comment

If you have a TypeKey or TypePad account, please Sign In