Search in sources :

Example 46 with CodeStyleSettings

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

the class DataPointHolderConversionIntentionTest method tearDown.

@Override
protected void tearDown() throws Exception {
    final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
    settings.STATIC_FIELD_NAME_PREFIX = "";
    settings.STATIC_FIELD_NAME_SUFFIX = "";
    super.tearDown();
}
Also used : CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings)

Example 47 with CodeStyleSettings

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

the class ExtractMethodTest method doTestReturnTypeChanged.

private void doTestReturnTypeChanged(PsiType type) throws PrepareFailedException {
    final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
    settings.ELSE_ON_NEW_LINE = true;
    settings.CATCH_ON_NEW_LINE = myCatchOnNewLine;
    configureByFile(BASE_PATH + getTestName(false) + ".java");
    boolean success = performExtractMethod(true, true, getEditor(), getFile(), getProject(), false, type, false, null);
    assertTrue(success);
    checkResultByFile(BASE_PATH + getTestName(false) + "_after.java");
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings) CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings)

Example 48 with CodeStyleSettings

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

the class ExtractMethodTest method testDefaultNamesConflictResolution.

public void testDefaultNamesConflictResolution() throws Exception {
    final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
    final String oldPrefix = settings.LOCAL_VARIABLE_NAME_PREFIX;
    try {
        settings.LOCAL_VARIABLE_NAME_PREFIX = "_";
        doTest();
    } finally {
        settings.LOCAL_VARIABLE_NAME_PREFIX = oldPrefix;
    }
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings) CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings)

Example 49 with CodeStyleSettings

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

the class ExtractMethodTest method testReassignedVarAfterCall.

public void testReassignedVarAfterCall() throws Exception {
    final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
    boolean oldGenerateFinalLocals = settings.GENERATE_FINAL_LOCALS;
    try {
        settings.GENERATE_FINAL_LOCALS = true;
        doTest();
    } finally {
        settings.GENERATE_FINAL_LOCALS = oldGenerateFinalLocals;
    }
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings) CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings)

Example 50 with CodeStyleSettings

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

the class ExtractMethodTest method doTestPassFieldsAsParams.

private void doTestPassFieldsAsParams() throws PrepareFailedException {
    final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
    settings.ELSE_ON_NEW_LINE = true;
    settings.CATCH_ON_NEW_LINE = myCatchOnNewLine;
    configureByFile(BASE_PATH + getTestName(false) + ".java");
    boolean success = performExtractMethod(true, true, getEditor(), getFile(), getProject(), false, null, true, null);
    assertTrue(success);
    checkResultByFile(BASE_PATH + getTestName(false) + "_after.java");
}
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