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


Java CommonCodeStyleSettings.FORCE_BRACES_IF_MULTILINE属性代码示例

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


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

示例1: testUnwrapCodeBlock1

public void testUnwrapCodeBlock1() throws Exception {
  CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
  boolean use_tab_character = settings.useTabCharacter(null);
  boolean smart_tabs = settings.isSmartTabs(null);
  int old = settings.IF_BRACE_FORCE;
  try {
    settings.getIndentOptions(StdFileTypes.JAVA).USE_TAB_CHARACTER = true;
    settings.getIndentOptions(StdFileTypes.JAVA).SMART_TABS = true;
    settings.getCommonSettings(JavaLanguage.INSTANCE).IF_BRACE_FORCE = CommonCodeStyleSettings.FORCE_BRACES_IF_MULTILINE;
    doTest();
  } finally {
    settings.getIndentOptions(StdFileTypes.JAVA).USE_TAB_CHARACTER = use_tab_character;
    settings.getIndentOptions(StdFileTypes.JAVA).SMART_TABS = smart_tabs;
    settings.getCommonSettings(JavaLanguage.INSTANCE).IF_BRACE_FORCE = old;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:JoinLinesTest.java

示例2: testIfElse

public void testIfElse() throws Exception {
  final CommonCodeStyleSettings settings = getSettings();
  settings.IF_BRACE_FORCE = CommonCodeStyleSettings.DO_NOT_FORCE;
  settings.FOR_BRACE_FORCE = CommonCodeStyleSettings.FORCE_BRACES_IF_MULTILINE;
  settings.WHILE_BRACE_FORCE = CommonCodeStyleSettings.FORCE_BRACES_IF_MULTILINE;
  settings.DOWHILE_BRACE_FORCE = CommonCodeStyleSettings.FORCE_BRACES_IF_MULTILINE;

  settings.ELSE_ON_NEW_LINE = true;
  settings.SPECIAL_ELSE_IF_TREATMENT = false;
  settings.WHILE_ON_NEW_LINE = true;
  settings.CATCH_ON_NEW_LINE = true;
  settings.FINALLY_ON_NEW_LINE = true;
  settings.ALIGN_MULTILINE_BINARY_OPERATION = true;
  settings.ALIGN_MULTILINE_TERNARY_OPERATION = true;
  settings.ALIGN_MULTILINE_ASSIGNMENT = true;
  settings.ALIGN_MULTILINE_EXTENDS_LIST = true;
  settings.ALIGN_MULTILINE_THROWS_LIST = true;
  settings.ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION = true;
  settings.ALIGN_MULTILINE_FOR = true;
  settings.ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
  settings.ALIGN_MULTILINE_PARAMETERS = true;
  settings.KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;
  settings.WHILE_ON_NEW_LINE = true;
  settings.BRACE_STYLE = CommonCodeStyleSettings.END_OF_LINE;
  doTest();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:JavaFormatterTest.java

示例3: processStatement

private void processStatement(PsiStatement statement, PsiStatement blockCandidate, int options) {
  if (blockCandidate instanceof PsiBlockStatement || blockCandidate == null) return;
  if (options == CommonCodeStyleSettings.FORCE_BRACES_ALWAYS
      || (options == CommonCodeStyleSettings.FORCE_BRACES_IF_MULTILINE && PostFormatProcessorHelper.isMultiline(statement)))
  {
    replaceWithBlock(statement, blockCandidate);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:BraceEnforcer.java

示例4: processStatement

private void processStatement(GrStatement statement, @Nullable GrStatement blockCandidate, int options) {
  if (blockCandidate instanceof GrCodeBlock || blockCandidate instanceof GrBlockStatement || blockCandidate == null) return;
  if (options == CommonCodeStyleSettings.FORCE_BRACES_ALWAYS ||
      options == CommonCodeStyleSettings.FORCE_BRACES_IF_MULTILINE && PostFormatProcessorHelper.isMultiline(statement)) {
    replaceWithBlock(statement, blockCandidate);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:GroovyBraceEnforcer.java


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