Search in sources :

Example 71 with CommonCodeStyleSettings

use of com.intellij.psi.codeStyle.CommonCodeStyleSettings in project intellij-community by JetBrains.

the class JavaFormatterTest method testLabel.

public void testLabel() throws Exception {
    final CommonCodeStyleSettings settings = getSettings();
    settings.getRootSettings().getIndentOptions(StdFileTypes.JAVA).LABEL_INDENT_ABSOLUTE = true;
    settings.SPECIAL_ELSE_IF_TREATMENT = true;
    settings.FOR_BRACE_FORCE = CommonCodeStyleSettings.FORCE_BRACES_ALWAYS;
    myTextRange = new TextRange(59, 121);
    doTextTest("public class Foo {\n" + "    public void foo() {\n" + "label2:\n" + "        for (int i = 0; i < 5; i++)\n" + "        {doSomething(i);\n" + "        }\n" + "    }\n" + "}", "public class Foo {\n" + "    public void foo() {\n" + "label2:\n" + "        for (int i = 0; i < 5; i++) {\n" + "            doSomething(i);\n" + "        }\n" + "    }\n" + "}");
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings) TextRange(com.intellij.openapi.util.TextRange)

Example 72 with CommonCodeStyleSettings

use of com.intellij.psi.codeStyle.CommonCodeStyleSettings in project intellij-community by JetBrains.

the class JavaFormatterTest method testTernaryExpression.

public void testTernaryExpression() throws Exception {
    final CommonCodeStyleSettings settings = getSettings();
    settings.ALIGN_MULTILINE_TERNARY_OPERATION = true;
    doTest();
    settings.ALIGN_MULTILINE_TERNARY_OPERATION = false;
    doTest("TernaryExpression.java", "TernaryExpression_DoNotAlign_after.java");
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings)

Example 73 with CommonCodeStyleSettings

use of com.intellij.psi.codeStyle.CommonCodeStyleSettings in project intellij-community by JetBrains.

the class JavaFormatterTest method testSCR879.

public void testSCR879() throws Exception {
    final CommonCodeStyleSettings settings = getSettings();
    settings.BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
    doTest();
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings)

Example 74 with CommonCodeStyleSettings

use of com.intellij.psi.codeStyle.CommonCodeStyleSettings in project intellij-community by JetBrains.

the class WrapperTest method testExtendsListWrappingNormal.

public void testExtendsListWrappingNormal() throws Exception {
    CommonCodeStyleSettings settings = getSettings(JavaLanguage.INSTANCE);
    defaultCodeStyle();
    settings.EXTENDS_KEYWORD_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP;
    settings.EXTENDS_LIST_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
    settings.RIGHT_MARGIN = 45;
    doTest("ExtendsListWrapping", "ExtendsListWrapping_normal");
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings)

Example 75 with CommonCodeStyleSettings

use of com.intellij.psi.codeStyle.CommonCodeStyleSettings in project intellij-community by JetBrains.

the class WrapperTest method testForStatementLParenMoved.

public void testForStatementLParenMoved() throws Exception {
    CommonCodeStyleSettings settings = getSettings(JavaLanguage.INSTANCE);
    defaultCodeStyle();
    settings.FOR_STATEMENT_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED | CommonCodeStyleSettings.WRAP_ON_EVERY_ITEM;
    settings.FOR_STATEMENT_LPAREN_ON_NEXT_LINE = true;
    settings.RIGHT_MARGIN = 80;
    doTest("ForStatement", "ForStatement_lparen");
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings)

Aggregations

CommonCodeStyleSettings (com.intellij.psi.codeStyle.CommonCodeStyleSettings)202 CodeStyleSettings (com.intellij.psi.codeStyle.CodeStyleSettings)19 TextRange (com.intellij.openapi.util.TextRange)5 PsiElement (com.intellij.psi.PsiElement)5 ASTNode (com.intellij.lang.ASTNode)4 Editor (com.intellij.openapi.editor.Editor)4 JavaCodeStyleSettings (com.intellij.psi.codeStyle.JavaCodeStyleSettings)4 EditorSettingsExternalizable (com.intellij.openapi.editor.ex.EditorSettingsExternalizable)3 PsiFile (com.intellij.psi.PsiFile)3 File (java.io.File)3 Matcher (java.util.regex.Matcher)3 NonNls (org.jetbrains.annotations.NonNls)3 NotNull (org.jetbrains.annotations.NotNull)3 Document (com.intellij.openapi.editor.Document)2 Project (com.intellij.openapi.project.Project)2 CodeStyleManager (com.intellij.psi.codeStyle.CodeStyleManager)2 ArrangementGroupingRule (com.intellij.psi.codeStyle.arrangement.group.ArrangementGroupingRule)2 IElementType (com.intellij.psi.tree.IElementType)2 Nullable (org.jetbrains.annotations.Nullable)2 GroovyCodeStyleSettings (org.jetbrains.plugins.groovy.codeStyle.GroovyCodeStyleSettings)2