mr.nothing
mr.nothing

Reputation: 5399

Eclipse formatter settings

Could anybody share their eclipse formatter settings file or point me to such a file which will prevent my eclipse from doing the following thing:

when I press ctrl+shift+F to format my code, eclipse from this string:

dayArrayList.add(new Day(WeekDay.SATURDAY));

the following string:

dayArrayList.  
            add(new Day  
                       (WeekDay.SATURDAY));  

So I want only really looooooooooong code strings be moved to next line (those, which don't fit into the eclipse window), but eclipse do this almost with all strings.
Thanks in advance!

Upvotes: 0

Views: 1891

Answers (3)

Eugenio Cuevas
Eugenio Cuevas

Reputation: 11078

You can set the maximum line width in eclipse by:

Window -> Preferences -> Java -> Code style -> Formatter -> Edit

On line wrapping tab, change the default 80 to your preference. Note that you will have to save as a new profile if you are changing the default one.

Upvotes: 0

Diego D
Diego D

Reputation: 1755

In Eclipse go to Window->Preferences->Java->Code Style->Formatter

Then Create a new profile and in the Line Weapping Tab you have the Parameter "Maximum line width"

Upvotes: 0

Guillaume Polet
Guillaume Polet

Reputation: 47608

Simply increase the Maximum line width to let's say 140 chars?

The following formatter does this.

Upvotes: 1

Related Questions