score:-1

customize your eclipse formatter in both java and javascript. increase the max line with that fits your screen. windows>preferences

edit

score:0

in: window->preferences->java->code style->formater->edit->line wrapping->function call-> qualified invocation

select indentation policy as indent on column

score:3

if you are willing to do the formatting of those segments yourself, you can prevent eclipse from reformatting those segments by using:

// @formatter:off
...
// @formatter:on

you might need to enable this in your preferences: http://archive.eclipse.org/eclipse/downloads/drops/r-3.6-201006080911/eclipse-news-part2.html#javaformatter

see also: how to turn off the eclipse code formatter for certain sections of java code?

score:8

window > preferences > java > code style > formater > edit > line wrapping > function calls, set the 'line wrapping policy' as 'wrap all elements, every element on a new line'.

score:8

for those who have eclipse code formatting settings checked into source control (for consistent code formatting across the whole team), the .settings folder is checked in.

the property that will give you this formatting behavior is in the .settings/org.eclipse.jdt.core.prefs file.

the property is:

org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=80

score:15

window → preferences → java → code style → formater → edit → line wrapping → never join already wrapped lines

score:203

complementing deepak azad's answer, what you exactly need is the following:

windows: window → preferences → java → code style
→ formatter → edit → line wrapping (tab)

mac os: adt → preferences → java → code style
→ formatter → edit → line wrapping (tab)

then, in the list at the left, select:

function calls → qualified invocations

now below this list, set line wrapping policy to:

wrap all elements, except first element if not necessary

check:

force split, even if line shorter than maximum line width

finally, set indentation policy to (thanks @turbo):

indent on column

it should give you the exact behavior you asked for.


bonus: android studio / intellij idea:

mac os: android studio → preferences (cmd +,) → editor → code style → java → wrapping and braces tab → chained method calls

select

wrap always

and check

align when multiline


Related Query

More Query from same tag