use of com.intellij.psi.codeStyle.CodeStyleSettings in project intellij-community by JetBrains.
the class JsonCodeStyleSettingsProvider method createSettingsPage.
@NotNull
@Override
public Configurable createSettingsPage(CodeStyleSettings settings, CodeStyleSettings originalSettings) {
return new CodeStyleAbstractConfigurable(settings, originalSettings, "JSON") {
@Override
protected CodeStyleAbstractPanel createPanel(CodeStyleSettings settings) {
final Language language = JsonLanguage.INSTANCE;
final CodeStyleSettings currentSettings = getCurrentSettings();
return new TabbedLanguageCodeStylePanel(language, currentSettings, settings) {
@Override
protected void initTabs(CodeStyleSettings settings) {
addIndentOptionsTab(settings);
addSpacesTab(settings);
addBlankLinesTab(settings);
addWrappingAndBracesTab(settings);
addTab(new JsonCodeStylePanel(settings));
}
};
}
@Nullable
@Override
public String getHelpTopic() {
return "reference.settingsdialog.codestyle.json";
}
};
}
use of com.intellij.psi.codeStyle.CodeStyleSettings in project intellij-community by JetBrains.
the class ProblematicWhitespaceInspectionTest method testTabsInFile.
public void testTabsInFile() {
final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
settings.getIndentOptions(JavaFileType.INSTANCE).USE_TAB_CHARACTER = false;
doTest("/*File 'X.java' uses tabs for indentation*/class X {\n" + "\tString s;\n" + "}\n/**/");
}
use of com.intellij.psi.codeStyle.CodeStyleSettings in project intellij-community by JetBrains.
the class UnnecessaryFullyQualifiedNameFixTest method doTest.
private void doTest(@Language("JAVA") @NotNull @NonNls String before, @Language("JAVA") @NotNull @NonNls String after, @MagicConstant(intValues = { JavaCodeStyleSettings.FULLY_QUALIFY_NAMES_ALWAYS, JavaCodeStyleSettings.FULLY_QUALIFY_NAMES_IF_NOT_IMPORTED, JavaCodeStyleSettings.SHORTEN_NAMES_ALWAYS_AND_ADD_IMPORT }) int classNamesInJavadoc, String fileName) {
final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
final JavaCodeStyleSettings javaSettings = settings.getCustomSettings(JavaCodeStyleSettings.class);
final int oldClassNamesInJavadoc = javaSettings.CLASS_NAMES_IN_JAVADOC;
try {
javaSettings.CLASS_NAMES_IN_JAVADOC = classNamesInJavadoc;
doTest(InspectionGadgetsBundle.message("unnecessary.fully.qualified.name.replace.quickfix"), before, after, fileName);
} finally {
javaSettings.CLASS_NAMES_IN_JAVADOC = oldClassNamesInJavadoc;
}
}
use of com.intellij.psi.codeStyle.CodeStyleSettings in project intellij-community by JetBrains.
the class SuspiciousGetterSetterInspectionTest method testSuspiciousGetterSetter.
public void testSuspiciousGetterSetter() {
final CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(getProject()).getCurrentSettings();
final String oldPrefix = settings.FIELD_NAME_PREFIX;
try {
settings.FIELD_NAME_PREFIX = "my";
doTest();
} finally {
settings.FIELD_NAME_PREFIX = oldPrefix;
}
}
use of com.intellij.psi.codeStyle.CodeStyleSettings in project intellij-community by JetBrains.
the class ProblematicWhitespaceInspectionTest method testSmartTabsInFile2.
public void testSmartTabsInFile2() {
final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
final CommonCodeStyleSettings.IndentOptions options = settings.getIndentOptions(JavaFileType.INSTANCE);
options.USE_TAB_CHARACTER = true;
options.SMART_TABS = true;
doTest("class X {\n" + "\tvoid aaa(boolean a, boolean b, boolean c) {\n" + "\t\taaa(true,\n" + "\t\t true,\n" + "\t\t true);\n" + "\t}\n" + "}\n");
}
Aggregations