Eclipse: Set maximum line length for auto formatting?

In preferences Java -> Code Style -> Formatter, edit the profile. Under the Line Wrapping tab is the primary option for line width (Maximum line width:). In the Comments tab you have a separate option Maximum line width for comments:, which will also need to be changed to affect comment wrapping.

You will need to make your own profile to make these changes in if you using one of the [Built-in] ones. Just click "New..." on the formatter preferences page.


Take a look of following image:

Java->Code style->Formatter-> Edit

enter image description here


Comments have their own line length setting at the bottom of the setting page java->code style->formatter-> Edit... ->comments


for XML line width, update preferences > XML > XML Files > Editor > Line width


For HTML / PHP / JSP / JSPF: Web -> HTML Files -> Editor -> Line width