Reputation: 21962
So assuming that in our work environment we've decided that the One True Faith forbids this:
if (something)
doSomething();
And instead we want:
if (something) {
doSomething();
}
Is there a tool that will do that automagically? Awesomest would be to have eclipse just do it, but since we're really just recovering from one ex-employee that thought he was too pretty for coding conventions, a less-friendly tool that would do it right just once would suffice.
Upvotes: 2
Views: 2360
Reputation: 10320
I think you can set this in Eclipse's formatting rules and run the built-in formatter.. e.g. the "Use blocks" option:
(source: ibm.com)
Of course, you need the rest of the formatting options to be set how you want them, since I don't think you can selectively apply only a single rule/option..
Upvotes: 3
Reputation: 1601
I believe that GreatCode can do this for you (along with a ton of other options)
Upvotes: 0
Reputation: 21962
Ah, it's actually not a formatter, but a "Clean Up": Preferences -> Java -> Code Style -> Clean Up
And then to execute. Source -> Clean Up As opposed to Source -> Format
Upvotes: 3