Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Formatting array initializers with Eclipse

Is there any way I can instruct Eclipse's formatter to put each value in an array initializer on a new line?

like image 778
jilt3d Avatar asked Apr 05 '11 12:04

jilt3d


2 Answers

You can do it this way: windows/preferences/java/code style/formatter, then near the selected active profile click edit

then on the "Line Wrapping" tab

Choose "Expressions"->"Array initializers"

Under The list choose "Wrap all elements, every element an a new line"

like image 91
wutzebaer Avatar answered Nov 19 '22 20:11

wutzebaer


Go to windows/preferences/java/code style/formatter, then near the selected active profile click edit, then on the new lines tab there are 2 options for this.

like image 34
gberes Avatar answered Nov 19 '22 19:11

gberes