Search in sources :

Example 26 with CodeStyleSettings

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

the class JoinLinesTest method testWrongWrapping.

public void testWrongWrapping() throws Exception {
    CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
    settings.setDefaultRightMargin(80);
    settings.CALL_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
    settings.ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
    doTest();
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings) CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings)

Example 27 with CodeStyleSettings

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

the class JoinLinesTest method testReformatInsertsNewlines.

public void testReformatInsertsNewlines() throws Exception {
    CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
    final Element root = new Element("fake");
    settings.writeExternal(root);
    try {
        settings.getIndentOptions(StdFileTypes.JAVA).USE_TAB_CHARACTER = true;
        settings.getIndentOptions(StdFileTypes.JAVA).SMART_TABS = true;
        settings.IF_BRACE_FORCE = CommonCodeStyleSettings.FORCE_BRACES_ALWAYS;
        settings.METHOD_BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
        doTest();
    } finally {
        settings.readExternal(root);
    }
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings) CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings) Element(org.jdom.Element)

Example 28 with CodeStyleSettings

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

the class JoinLinesTest method testSCR3493.

public void testSCR3493() throws Exception {
    CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
    boolean use_tab_character = settings.useTabCharacter(null);
    boolean smart_tabs = settings.isSmartTabs(null);
    try {
        settings.getIndentOptions(StdFileTypes.JAVA).USE_TAB_CHARACTER = true;
        settings.getIndentOptions(StdFileTypes.JAVA).SMART_TABS = true;
        doTest();
    } finally {
        settings.getIndentOptions(StdFileTypes.JAVA).USE_TAB_CHARACTER = use_tab_character;
        settings.getIndentOptions(StdFileTypes.JAVA).SMART_TABS = smart_tabs;
    }
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings) CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings)

Example 29 with CodeStyleSettings

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

the class JoinLinesTest method testSCR3493c.

public void testSCR3493c() throws Exception {
    CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
    boolean use_tab_character = settings.useTabCharacter(null);
    boolean smart_tabs = settings.isSmartTabs(null);
    try {
        settings.getIndentOptions(StdFileTypes.JAVA).USE_TAB_CHARACTER = true;
        settings.getIndentOptions(StdFileTypes.JAVA).SMART_TABS = true;
        doTest();
    } finally {
        settings.getIndentOptions(StdFileTypes.JAVA).USE_TAB_CHARACTER = use_tab_character;
        settings.getIndentOptions(StdFileTypes.JAVA).SMART_TABS = smart_tabs;
    }
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings) CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings)

Example 30 with CodeStyleSettings

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

the class JoinLinesTest method testSCR3493b.

public void testSCR3493b() throws Exception {
    CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
    boolean use_tab_character = settings.useTabCharacter(null);
    boolean smart_tabs = settings.isSmartTabs(null);
    try {
        settings.getIndentOptions(StdFileTypes.JAVA).USE_TAB_CHARACTER = true;
        settings.getIndentOptions(StdFileTypes.JAVA).SMART_TABS = true;
        doTest();
    } finally {
        settings.getIndentOptions(StdFileTypes.JAVA).USE_TAB_CHARACTER = use_tab_character;
        settings.getIndentOptions(StdFileTypes.JAVA).SMART_TABS = smart_tabs;
    }
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings) CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings)

Aggregations

CodeStyleSettings (com.intellij.psi.codeStyle.CodeStyleSettings)194 CommonCodeStyleSettings (com.intellij.psi.codeStyle.CommonCodeStyleSettings)85 Project (com.intellij.openapi.project.Project)13 XmlCodeStyleSettings (com.intellij.psi.formatter.xml.XmlCodeStyleSettings)12 Document (com.intellij.openapi.editor.Document)10 ECMA4CodeStyleSettings (com.intellij.lang.javascript.formatter.ECMA4CodeStyleSettings)9 JSCodeStyleSettings (com.intellij.lang.javascript.formatter.JSCodeStyleSettings)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 IOException (java.io.IOException)4 CodeStyleAbstractConfigurable (com.intellij.application.options.CodeStyleAbstractConfigurable)3 TabbedLanguageCodeStylePanel (com.intellij.application.options.TabbedLanguageCodeStylePanel)3 FormattingModelBuilder (com.intellij.formatting.FormattingModelBuilder)3