Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Formatting Java enums using one line for every enum value with Eclipse

I have a Java code like this:

private enum Operation {
        SAVE, LOAD, DELETE, UPDATE, REVISE 
};

I would like to customize Eclipse Indigo formatter to do something like this:

private enum Operation {
                SAVE, 
                LOAD, 
                DELETE, 
                UPDATE, 
                REVISE 
};

I could not find any option suitable for my needs, what am I missing? Or is not possible at all with this version of IDE?

like image 533
giampaolo Avatar asked Sep 04 '25 17:09

giampaolo


1 Answers

Under Preferences > Java > Code Style > Formatter, edit the active formatting profile, and set the Line wrapping policy for Line Wrapping > 'enum' declaration > Constants to Wrap all elements, every element on a new line.

like image 151
thSoft Avatar answered Sep 07 '25 18:09

thSoft