Alex Rivera | Logout

Reformat code style in Eclipse

Asked 2010-03-09T17:21:48.607
14

I'm looking for an automatic way in eclipse to reformat curly braces to K&R style, eliminating braces for single statements if, etc. Is there such a way?

Thanks.

Edit
Report

1 Answer

14

Before you reformat you need to customize the formatter settings in the Preferences Dialog Java/ Code Style / Formatter to your K&R settings if the default settings don't match your requirements.

The Preferences Dialog is opened from Mainmenu / Window / Preferences

You can even configure a save action Java / Editor / Save Action to format source code on save.

answered 2010-03-09T17:27:50.597

Your Answer