Formatting chaining methods in Eclipse

I would like to configure the Eclipse java formatter to format chain calls of such methods:

lblName
        .setX(last.getX() + last.getWidth())
        .setY(0)
        .setHeight(this.height)
        .setWidth(80);

My problem is that I do not know how to do this, just format it as if the first method call was already placed on the second line. This call should not be affected:

lblName.setX(last.getX() + last.getWidth()).setY(0).setHeight(this.height).setWidth(80);
+5
source share
2 answers

You speak:

...if the first method call already is placed...call should be untouched...

If you do not want the formatter to wrap already wrapped lines, look at this panel:

enter image description here

+13
source

It's impossible. You can either break the line after each method call, after a certain character limit on the line, or not at all.

, . (, ) .

+1

All Articles