问题
I have a questions regarding the Eclipse code formatter in JDT:
How can I make Eclipse format the following code in the given way:
BEFORE
if (objectA.getFoo().equals(objectB.getFoo()) && (objectA.getBar().equals(objectB.getBar()) || resultOfAnotherTest)){
...
}
AFTER
if (objectA.getFoo().equals(objectB.getFoo())
&& (objectA.getBar().equals(objectB.getBar())
|| resultOfAnotherTest)){
...
}
A second example:
BEFORE
if (foo1 == foo2 && bar1 == bar2 && blub1 == blub2 && !braindead){
...
}
AFTER
if (foo1 == foo2
&& bar1 == bar2
&& blub1 == blub2
&& !braindead){
...
}
Logical operators shall signal line wrapping. Structuring brackets shall signal indention depth.
来源:https://stackoverflow.com/questions/24336653/eclipse-jdt-code-formatter-indent-parameter-in-if-statement