当前位置: 首页>>代码示例>>Java>>正文


Java CommonCodeStyleSettings.WRAP_ALWAYS属性代码示例

本文整理汇总了Java中com.intellij.psi.codeStyle.CommonCodeStyleSettings.WRAP_ALWAYS属性的典型用法代码示例。如果您正苦于以下问题:Java CommonCodeStyleSettings.WRAP_ALWAYS属性的具体用法?Java CommonCodeStyleSettings.WRAP_ALWAYS怎么用?Java CommonCodeStyleSettings.WRAP_ALWAYS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.intellij.psi.codeStyle.CommonCodeStyleSettings的用法示例。


在下文中一共展示了CommonCodeStyleSettings.WRAP_ALWAYS属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testArrayInitializer

public void testArrayInitializer() throws IncorrectOperationException {
  // Inspired by IDEADEV-6787
  getSettings().ARRAY_INITIALIZER_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
  getSettings().ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE = true;
  getSettings().ARRAY_INITIALIZER_RBRACE_ON_NEXT_LINE = true;
  doTextTest(
             "public @interface Ann\n" +
             "{\n" +
             "int[] x = { 1, 2 };\n" +
             "\n" +
             "Mode[] modes () default { @Mode(value = 1), @Mode(value = 2) };\n" +
             "}",

             "public @interface Ann {\n" +
             "    int[] x = {\n" +
             "            1,\n" +
             "            2\n" +
             "    };\n" +
             "\n" +
             "    Mode[] modes() default {\n" +
             "            @Mode(value = 1),\n" +
             "            @Mode(value = 2)\n" +
             "    };\n" +
             "}"
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:JavaFormatterNewLineTest.java

示例2: test_LParen_OnNextLine_IfWrapped

public void test_LParen_OnNextLine_IfWrapped() {
  getSettings().CALL_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
  getSettings().CALL_PARAMETERS_LPAREN_ON_NEXT_LINE = true;

  doMethodTest("fuun(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\", \"cccccccccccccc\");",
               "fuun(\n" +
               "        \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n" +
               "        \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\",\n" +
               "        \"cccccccccccccc\");");


  getSettings().CALL_PARAMETERS_LPAREN_ON_NEXT_LINE = false;
  doMethodTest("fuun(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\", \"cccccccccccccc\");",
               "fuun(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n" +
               "        \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\",\n" +
               "        \"cccccccccccccc\");");

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:JavaFormatterWrapTest.java

示例3: test_RParen_OnNextLine_IfWrapped

public void test_RParen_OnNextLine_IfWrapped() {
  getSettings().CALL_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
  getSettings().CALL_PARAMETERS_RPAREN_ON_NEXT_LINE = true;

  doMethodTest("fuun(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\", \"cccccccccccccc\");",
               "fuun(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n" +
               "        \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\",\n" +
               "        \"cccccccccccccc\"" +
               "\n);");


  getSettings().CALL_PARAMETERS_RPAREN_ON_NEXT_LINE = false;
  doMethodTest("fuun(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\", \"cccccccccccccc\");",
               "fuun(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n" +
               "        \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\",\n" +
               "        \"cccccccccccccc\");");

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:JavaFormatterWrapTest.java

示例4: getWrapType

@NotNull
public static WrapType getWrapType(int wrap) {
  switch (wrap) {
    case CommonCodeStyleSettings.WRAP_ALWAYS:
      return WrapType.ALWAYS;
    case CommonCodeStyleSettings.WRAP_AS_NEEDED:
      return WrapType.NORMAL;
    case CommonCodeStyleSettings.DO_NOT_WRAP:
      return WrapType.NONE;
    default:
      return WrapType.CHOP_DOWN_IF_LONG;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:JavaFormatterUtil.java

示例5: testLabel1

public void testLabel1() throws Exception {
  CommonCodeStyleSettings settings = getSettings();

  settings.LABELED_STATEMENT_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
  settings.getRootSettings().getIndentOptions(StdFileTypes.JAVA).LABEL_INDENT_ABSOLUTE = true;
  settings.getRootSettings().getIndentOptions(StdFileTypes.JAVA).LABEL_INDENT_SIZE = 0;

  doTest("Label.java", "Label_after1.java");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:JavaFormatterTest.java

示例6: testSCR970

public void testSCR970() throws Exception {
  final CommonCodeStyleSettings settings = getSettings();
  settings.THROWS_KEYWORD_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
  settings.THROWS_LIST_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
  settings.METHOD_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
  doTest();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:JavaFormatterTest.java

示例7: testArrayInitializer

public void testArrayInitializer() throws IncorrectOperationException {
  // Inspired by IDEADEV-16136
  getSettings().ARRAY_INITIALIZER_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
  getSettings().ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION = true;

  doTextTest(
    "@SuppressWarnings({\"UseOfSystemOutOrSystemErr\", \"AssignmentToCollectionOrArrayFieldFromParameter\", \"ReturnOfCollectionOrArrayField\"})\n" +
    "public class Some {\n" +
    "}",
    "@SuppressWarnings({\"UseOfSystemOutOrSystemErr\",\n" +
    "                   \"AssignmentToCollectionOrArrayFieldFromParameter\",\n" +
    "                   \"ReturnOfCollectionOrArrayField\"})\n" +
    "public class Some {\n" +
    "}");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:JavaFormatterAlignmentTest.java

示例8: testChainedMethodCallsAfterFieldsChain_WithAlignment

public void testChainedMethodCallsAfterFieldsChain_WithAlignment() throws Exception {
  getSettings().ALIGN_MULTILINE_CHAINED_METHODS = true;
  getSettings().METHOD_CALL_CHAIN_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;

  doMethodTest(
    "a.current.current.current.getThis().getThis().getThis();",

    "a.current.current.current.getThis()\n" +
    "                         .getThis()\n" +
    "                         .getThis();"
  );

  doMethodTest(
    "a.current.current.current.getThis().getThis().getThis().current.getThis().getThis().getThis().getThis();",

    "a.current.current.current.getThis()\n" +
    "                         .getThis()\n" +
    "                         .getThis().current.getThis()\n" +
    "                                           .getThis()\n" +
    "                                           .getThis()\n" +
    "                                           .getThis();"
  );


  String onlyMethodCalls = "getThis().getThis().getThis();";
  String formatedMethodCalls = "getThis().getThis()\n" +
                               "         .getThis();";

  doMethodTest(onlyMethodCalls, formatedMethodCalls);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:JavaFormatterAlignmentTest.java

示例9: testChainedMethodCallsAfterFieldsChain_WithoutAlignment

public void testChainedMethodCallsAfterFieldsChain_WithoutAlignment() throws Exception {
  getSettings().ALIGN_MULTILINE_CHAINED_METHODS = false;
  getSettings().METHOD_CALL_CHAIN_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;

  doMethodTest(
    "a.current.current.current.getThis().getThis().getThis();",

    "a.current.current.current.getThis()\n" +
    "        .getThis()\n" +
    "        .getThis();"
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:JavaFormatterAlignmentTest.java

示例10: testIDEA123074

public void testIDEA123074() {
  getSettings().CALL_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
  String before = "final GeoZone geoZone1 = new GeoZone(APPROACHING, new Polygon(point(\"0.0\", \"0.0\"), point(\"10.0\", \"0.0\")," +
                  "point(\"10.0\", \"10.0\"), point(\"0.0\", \"10.0\")));";
  String after = "final GeoZone geoZone1 = new GeoZone(APPROACHING,\n" +
                 "        new Polygon(point(\"0.0\",\n" +
                 "                \"0.0\"),\n" +
                 "                point(\"10.0\",\n" +
                 "                        \"0.0\"),\n" +
                 "                point(\"10.0\",\n" +
                 "                        \"10.0\"),\n" +
                 "                point(\"0.0\",\n" +
                 "                        \"10.0\")));";
  doMethodTest(before, after);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:JavaFormatterWrapTest.java

示例11: testMethodAnnotationFollowedBySingleLineComment

public void testMethodAnnotationFollowedBySingleLineComment() {
  // Inspired by IDEA-22808
  getSettings().METHOD_ANNOTATION_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;

  String text =
    "@Test//my_comment\n" +
    "public void foo() {\n" +
    "}";

  // Expecting the code to be left as-is
  doClassTest(text, text);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:JavaFormatterWrapTest.java

示例12: test_ChainedCalls_FirstOnNewLine

public void test_ChainedCalls_FirstOnNewLine() {
  getSettings().METHOD_CALL_CHAIN_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
  getSettings().WRAP_FIRST_METHOD_IN_CALL_CHAIN = true;

  doMethodTest(
    "obj.call().call().call().call();",
    "obj\n" +
    "        .call()\n" +
    "        .call()\n" +
    "        .call()\n" +
    "        .call();"
  );

  doMethodTest(
    "call().call().call().call();",
    "call()\n" +
    "        .call()\n" +
    "        .call()\n" +
    "        .call();"
  );

  doMethodTest(
    "nestedCall(call().call().call().call());",
    "nestedCall(call()\n" +
    "        .call()\n" +
    "        .call()\n" +
    "        .call());"
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:JavaFormatterWrapTest.java

示例13: test_ChainedCalls_NoWrapOnSingleCall

public void test_ChainedCalls_NoWrapOnSingleCall() {
  getSettings().METHOD_CALL_CHAIN_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
  getSettings().WRAP_FIRST_METHOD_IN_CALL_CHAIN = true;

  doMethodTest(
    "obj.call(    )",
    "obj.call()"
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:JavaFormatterWrapTest.java

示例14: getWrapType

public static WrapType getWrapType(int setting) {
  switch (setting) {
    case CommonCodeStyleSettings.WRAP_ALWAYS:
      return WrapType.ALWAYS;
    case CommonCodeStyleSettings.WRAP_AS_NEEDED:
      return WrapType.NORMAL;
    case CommonCodeStyleSettings.DO_NOT_WRAP:
      return WrapType.NONE;
    default:
      return WrapType.CHOP_DOWN_IF_LONG;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:WrappingUtil.java

示例15: visitMethod

@Override
public void visitMethod(GrMethod method) {
  if (myType1 == GroovyTokenTypes.mRPAREN && myType2 == GroovyElementTypes.THROW_CLAUSE) {
    if (mySettings.THROWS_KEYWORD_WRAP == CommonCodeStyleSettings.WRAP_ALWAYS) {
      createLF(true);
    }
    else {
      createSpaceInCode(true);
    }
  }
  else if (isOpenBlock(myType2)) {
    PsiElement methodName = method.getNameIdentifier();
    int dependencyStart = methodName == null ? myParent.getTextRange().getStartOffset() : methodName.getTextRange().getStartOffset();
    createSpaceBeforeLBrace(mySettings.SPACE_BEFORE_METHOD_LBRACE, mySettings.METHOD_BRACE_STYLE,
                            new TextRange(dependencyStart, myChild1.getTextRange().getEndOffset()),
                            mySettings.KEEP_SIMPLE_METHODS_IN_ONE_LINE);
  }
  else if (myType2 == GroovyElementTypes.TYPE_PARAMETER_LIST) {
    createSpaceInCode(true);
  }
  else {
    processParentheses(GroovyTokenTypes.mLPAREN,
                       GroovyTokenTypes.mRPAREN,
                       mySettings.SPACE_WITHIN_METHOD_PARENTHESES,
                       mySettings.SPACE_WITHIN_EMPTY_METHOD_PARENTHESES,
                       mySettings.METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE,
                       mySettings.METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:GroovySpacingProcessor.java


注:本文中的com.intellij.psi.codeStyle.CommonCodeStyleSettings.WRAP_ALWAYS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。