Search in sources :

Example 81 with CodeStyleSettings

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

the class ReplaceIteratorForEachLoopWithIteratorForLoopFixTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    if (getTestName(false).startsWith("Final")) {
        final CodeStyleSettings codeStyleSettings = CodeStyleSettingsManager.getSettings(getProject());
        myFinalLocals = codeStyleSettings.GENERATE_FINAL_LOCALS;
        codeStyleSettings.GENERATE_FINAL_LOCALS = true;
    }
}
Also used : CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings)

Example 82 with CodeStyleSettings

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

the class IndentTest method testParenthesizedContinuation2.

public void testParenthesizedContinuation2() throws Exception {
    defaultSettings();
    CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
    settings.ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION = true;
    doTest("ParenthesizedContinuation2.java", "ParenthesizedContinuation2_after.java");
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings) CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings)

Example 83 with CodeStyleSettings

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

the class IndentTest method testParenthesizedContinuation.

public void testParenthesizedContinuation() throws Exception {
    defaultSettings();
    CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
    settings.ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION = true;
    doTest("ParenthesizedContinuation.java", "ParenthesizedContinuation_after.java");
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings) CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings)

Example 84 with CodeStyleSettings

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

the class JavaEnterActionTest method testEnter_AfterLastChainedCall.

public void testEnter_AfterLastChainedCall() throws IOException {
    CodeStyleSettings settings = getCodeStyleSettings();
    CommonCodeStyleSettings javaCommon = settings.getCommonSettings(JavaLanguage.INSTANCE);
    javaCommon.ALIGN_MULTILINE_CHAINED_METHODS = true;
    setCodeStyleSettings(settings);
    doTextTest("java", "class T {\n" + "    public void main() {\n" + "        ActionBarPullToRefresh.from(getActivity())\n" + "                              .theseChildrenArePullable(eventsListView)\n" + "                              .listener(this)\n" + "                              .useViewDelegate(StickyListHeadersListView.class, new AbsListViewDelegate())<caret>\n" + "    }\n" + "}", "class T {\n" + "    public void main() {\n" + "        ActionBarPullToRefresh.from(getActivity())\n" + "                              .theseChildrenArePullable(eventsListView)\n" + "                              .listener(this)\n" + "                              .useViewDelegate(StickyListHeadersListView.class, new AbsListViewDelegate())\n" + "                              <caret>\n" + "    }\n" + "}");
}
Also used : JavaCodeStyleSettings(com.intellij.psi.codeStyle.JavaCodeStyleSettings) CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings) CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings) CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings)

Example 85 with CodeStyleSettings

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

the class JavaFormatterTest method testWrapParamsOnEveryItem.

public void testWrapParamsOnEveryItem() throws Exception {
    CodeStyleSettings codeStyleSettings = CodeStyleSettingsManager.getSettings(getProject());
    int oldMargin = codeStyleSettings.getCommonSettings(JavaLanguage.INSTANCE).RIGHT_MARGIN;
    boolean oldKeep = codeStyleSettings.KEEP_LINE_BREAKS;
    int oldWrap = codeStyleSettings.METHOD_PARAMETERS_WRAP;
    try {
        codeStyleSettings.setRightMargin(JavaLanguage.INSTANCE, 80);
        codeStyleSettings.KEEP_LINE_BREAKS = false;
        codeStyleSettings.METHOD_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_ON_EVERY_ITEM;
        doClassTest("public void foo(String p1,\n" + "                String p2,\n" + "                String p3,\n" + "                String p4,\n" + "                String p5,\n" + "                String p6,\n" + "                String p7) {\n" + "    //To change body of implemented methods use File | Settings | File Templates.\n" + "}", "public void foo(String p1,\n" + "                String p2,\n" + "                String p3,\n" + "                String p4,\n" + "                String p5,\n" + "                String p6,\n" + "                String p7) {\n" + "    //To change body of implemented methods use File | Settings | File Templates.\n" + "}");
    } finally {
        codeStyleSettings.setRightMargin(JavaLanguage.INSTANCE, oldMargin);
        codeStyleSettings.KEEP_LINE_BREAKS = oldKeep;
        codeStyleSettings.METHOD_PARAMETERS_WRAP = oldWrap;
    }
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings) CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings)

Aggregations

CodeStyleSettings (com.intellij.psi.codeStyle.CodeStyleSettings)190 CommonCodeStyleSettings (com.intellij.psi.codeStyle.CommonCodeStyleSettings)84 Project (com.intellij.openapi.project.Project)12 XmlCodeStyleSettings (com.intellij.psi.formatter.xml.XmlCodeStyleSettings)12 ECMA4CodeStyleSettings (com.intellij.lang.javascript.formatter.ECMA4CodeStyleSettings)9 JSCodeStyleSettings (com.intellij.lang.javascript.formatter.JSCodeStyleSettings)9 Document (com.intellij.openapi.editor.Document)9 JavaCodeStyleSettings (com.intellij.psi.codeStyle.JavaCodeStyleSettings)9 NotNull (org.jetbrains.annotations.NotNull)9 VirtualFile (com.intellij.openapi.vfs.VirtualFile)8 PsiFile (com.intellij.psi.PsiFile)5 Nullable (org.jetbrains.annotations.Nullable)5 FormattingModel (com.intellij.formatting.FormattingModel)4 PsiElement (com.intellij.psi.PsiElement)4 CodeStyleSettingsManager (com.intellij.psi.codeStyle.CodeStyleSettingsManager)4 File (java.io.File)4 FormattingModelBuilder (com.intellij.formatting.FormattingModelBuilder)3 ASTNode (com.intellij.lang.ASTNode)3 Language (com.intellij.lang.Language)3 JSTestOptions (com.intellij.lang.javascript.JSTestOptions)3