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


Java CommonCodeStyleSettings.NEXT_LINE属性代码示例

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


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

示例1: testSCR1703

public void testSCR1703() throws Exception {
    getSettings().BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
    doTextTest("class Foo{\n" +
               "    void foo() {\n" +
               "        for (Object o : localizations) {\n" +
               "            //do something \n" +
               "        }\n" +
               "    }\n" +
"}", "class Foo {\n" +
     "    void foo() {\n" +
     "        for (Object o : localizations)\n" +
     "        {\n" +
     "            //do something \n" +
     "        }\n" +
     "    }\n" +
     "}");
  }
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JavaFormatterTest.java

示例2: testIfStatementElseBranchIsOnNewLine

public void testIfStatementElseBranchIsOnNewLine() throws Exception {
  getSettings().KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;
  getSettings().BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
  String before = "if (2 > 3) {\n" +
                  "    System.out.println(\"AA!\");\n" +
                  "} else {\n" +
                  "    int a = 3;\n" +
                  "}";
  String after = "if (2 > 3)\n" +
                 "{\n" +
                 "    System.out.println(\"AA!\");\n" +
                 "} else\n" +
                 "{\n" +
                 "    int a = 3;\n" +
                 "}";
  doMethodTest(before, after);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JavaFormatterBracesTest.java

示例3: testLongCallChainAfterElse

public void testLongCallChainAfterElse() throws Exception {
    getSettings().BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
    getSettings().KEEP_CONTROL_STATEMENT_IN_ONE_LINE = true;
    getSettings().KEEP_SIMPLE_METHODS_IN_ONE_LINE = true;
    getSettings().ELSE_ON_NEW_LINE = false;
    getSettings().RIGHT_MARGIN = 110;
    getSettings().KEEP_LINE_BREAKS = false;
    doTextTest("class Foo {\n" +
               "    void foo() {\n" +
               "        if (types.length > 1) // returns multiple columns\n" +
               "        {\n" +
               "        } else\n" +
               "            result.add(initializeObject(os, types[0], initializeCollections, initializeAssociations, initializeChildren));" +
               "    }\n" +
"}", "class Foo {\n" +
     "    void foo() {\n" +
     "        if (types.length > 1) // returns multiple columns\n" +
     "        {\n" +
     "        } else\n" +
     "            result.add(initializeObject(os, types[0], initializeCollections, initializeAssociations, initializeChildren));\n" +
     "    }\n" +
     "}");
  }
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:JavaFormatterTest.java

示例4: testMoveBraceOnNextLineForAnnotatedMethod

public void testMoveBraceOnNextLineForAnnotatedMethod() throws Exception {
  // Inspired by IDEA-59336
  getSettings().METHOD_BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
  getSettings().KEEP_SIMPLE_METHODS_IN_ONE_LINE = true;

  doClassTest(
    "@Override\n" +
    "public int hashCode() {\n" +
    "}\n" +
    "@Deprecated\n" +
    "void foo() {\n" +
    "}",
    "@Override\n" +
    "public int hashCode()\n" +
    "{\n" +
    "}\n" +
    "\n" +
    "@Deprecated\n" +
    "void foo()\n" +
    "{\n" +
    "}"
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:JavaFormatterBracesTest.java

示例5: testSCR1535

public void testSCR1535() throws Exception {
    final CommonCodeStyleSettings settings = getSettings();
    settings.BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
    settings.CLASS_BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
    settings.METHOD_BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
    doTextTest("public class Foo {\n" +
               "    public int foo() {\n" +
               "        if (a) {\n" +
               "            return;\n" +
               "        }\n" +
               "    }\n" +
"}", "public class Foo\n" +
     "{\n" +
     "    public int foo()\n" +
     "    {\n" +
     "        if (a)\n" +
     "        {\n" +
     "            return;\n" +
     "        }\n" +
     "    }\n" +
     "}");
  }
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:JavaFormatterTest.java

示例6: testKeepSimpleBlocksInOneLine_OnIfStatementsThenBlock

public void testKeepSimpleBlocksInOneLine_OnIfStatementsThenBlock() throws Exception {
  getSettings().KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;
  String singleLine = "if (2 > 3) { System.out.println(\"AA!\"); }";

  getSettings().BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
  doMethodTest(singleLine, singleLine);

  getSettings().BRACE_STYLE = CommonCodeStyleSettings.END_OF_LINE;
  doMethodTest(singleLine, singleLine);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JavaFormatterBracesTest.java

示例7: valueToInt

private static int valueToInt(@NotNull String value) {
  if (VALUE_END_OF_LINE.equals(value)) return CommonCodeStyleSettings.END_OF_LINE;
  if (VALUE_NEXT_LINE.equals(value)) return CommonCodeStyleSettings.NEXT_LINE;
  if (VALUE_NEXT_LINE_SHIFTED.equals(value)) return CommonCodeStyleSettings.NEXT_LINE_SHIFTED;
  if (VALUE_NEXT_LINE_IF_WRAPPED.equals(value)) return CommonCodeStyleSettings.NEXT_LINE_IF_WRAPPED;
  return Integer.parseInt(value);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:EclipseCodeStyleImportWorker.java

示例8: testAlreadyCompleteCatch

public void testAlreadyCompleteCatch() throws Exception {
  CommonCodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject()).getCommonSettings(JavaLanguage.INSTANCE);
  int old = settings.BRACE_STYLE;
  settings.BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
  try {
    doTest();
  }
  finally {
    settings.BRACE_STYLE = old;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:CompleteStatementTest.java

示例9: doTestBracesNextLineStyle

private void doTestBracesNextLineStyle() throws Exception {
  CommonCodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject()).getCommonSettings(JavaLanguage.INSTANCE);
  settings.BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
  settings.METHOD_BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
  settings.CLASS_BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
  try {
    doTest();
  }
  finally {
    settings.BRACE_STYLE = CommonCodeStyleSettings.END_OF_LINE;
    settings.METHOD_BRACE_STYLE = CommonCodeStyleSettings.END_OF_LINE;
    settings.CLASS_BRACE_STYLE = CommonCodeStyleSettings.END_OF_LINE;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:CompleteStatementTest.java

示例10: testReformatInsertsNewlines

public void testReformatInsertsNewlines() throws Exception {
  CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
  final Element root = new Element("fake");
  settings.writeExternal(root);
  try {
    settings.getIndentOptions(StdFileTypes.JAVA).USE_TAB_CHARACTER = true;
    settings.getIndentOptions(StdFileTypes.JAVA).SMART_TABS = true;
    settings.IF_BRACE_FORCE = CommonCodeStyleSettings.FORCE_BRACES_ALWAYS;
    settings.METHOD_BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
    doTest();
  } finally {
    settings.readExternal(root);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:JoinLinesTest.java

示例11: testSpacesBeforeResourceList

public void testSpacesBeforeResourceList() {
  getSettings().KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;
  getSettings().BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;

  getSettings().SPACE_BEFORE_TRY_PARENTHESES = true;
  getSettings().SPACE_BEFORE_TRY_LBRACE = true;
  doMethodTest("try(AutoCloseable r = null){ }",
               "try (AutoCloseable r = null) { }");

  getSettings().SPACE_BEFORE_TRY_PARENTHESES = false;
  getSettings().SPACE_BEFORE_TRY_LBRACE = false;
  doMethodTest("try (AutoCloseable r = null) { }",
               "try(AutoCloseable r = null){ }");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:JavaFormatterSpaceTest.java

示例12: testIf

public void testIf() throws Exception {
  final CommonCodeStyleSettings settings = getSettings();
  settings.BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
  doTest();
  settings.BRACE_STYLE = CommonCodeStyleSettings.END_OF_LINE;
  doTest("If.java", "If.java");
  settings.BRACE_STYLE = CommonCodeStyleSettings.END_OF_LINE;
  settings.KEEP_LINE_BREAKS = false;
  doTest("If_after.java", "If.java");

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

示例13: testStaticBlockBraces

public void testStaticBlockBraces() throws Exception {
  getSettings().BRACE_STYLE = CommonCodeStyleSettings.END_OF_LINE;
  doTextTest("class Foo {\n" + "    static {\n" + "        //comment\n" + "        i = foo();\n" + "    }\n" + "}",
             "class Foo {\n" + "    static {\n" + "        //comment\n" + "        i = foo();\n" + "    }\n" + "}");

  getSettings().BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE_IF_WRAPPED;
  doTextTest("class Foo {\n" + "    static {\n" + "        //comment\n" + "        i = foo();\n" + "    }\n" + "}",
             "class Foo {\n" + "    static {\n" + "        //comment\n" + "        i = foo();\n" + "    }\n" + "}");

  getSettings().BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
  doTextTest("class Foo {\n" + "    static {\n" + "        //comment\n" + "        i = foo();\n" + "    }\n" + "}",
             "class Foo {\n" + "    static\n" + "    {\n" + "        //comment\n" + "        i = foo();\n" + "    }\n" + "}");


  getSettings().BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE_SHIFTED;
  doTextTest("class Foo {\n" + "    static {\n" + "        //comment\n" + "        i = foo();\n" + "        }\n" + "}",
             "class Foo {\n" + "    static\n" + "        {\n" + "        //comment\n" + "        i = foo();\n" + "        }\n" + "}");


  getSettings().BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE_SHIFTED2;
  doTextTest("class Foo {\n" + "    static {\n" + "        //comment\n" + "        i = foo();\n" + "    }\n" + "}", "class Foo {\n" +
                                                                                                                    "    static\n" +
                                                                                                                    "        {\n" +
                                                                                                                    "            //comment\n" +
                                                                                                                    "            i = foo();\n" +
                                                                                                                    "        }\n" +
                                                                                                                    "}");


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

示例14: testSCR11799

public void testSCR11799() throws Exception {
  final CommonCodeStyleSettings settings = getSettings();
  settings.getRootSettings().getIndentOptions(StdFileTypes.JAVA).CONTINUATION_INDENT_SIZE = 4;
  settings.CLASS_BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
  settings.METHOD_BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
  doTest();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:JavaFormatterTest.java

示例15: testIfStatement_WhenBraceOnNextLine_AndKeepSimpleBlockInOneLineEnabled

public void testIfStatement_WhenBraceOnNextLine_AndKeepSimpleBlockInOneLineEnabled() throws Exception {
  getSettings().KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;
  getSettings().BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
  String before = "if (2 > 3) {\n" +
                  "    System.out.println(\"AA!\");\n" +
                  "}";
  String after = "if (2 > 3)\n" +
                 "{\n" +
                 "    System.out.println(\"AA!\");\n" +
                 "}";
  doMethodTest(before, after);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:JavaFormatterBracesTest.java


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