Eclipse JDT Code Formatter: Indent parameter in IF-Statement

独自空忆成欢 提交于 2019-12-11 03:34:52

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!