本文整理汇总了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;
}
}
示例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();
}
示例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);
}
}
示例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);
}
}