Search in sources :

Example 1 with CodeStyleSettingsProvider

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

the class XmlCodeStyleMainPanel method initTabs.

@Override
protected void initTabs(CodeStyleSettings settings) {
    addIndentOptionsTab(settings);
    addTab(new CodeStyleXmlPanel(settings));
    addTab(new XmlArrangementPanel(settings));
    for (CodeStyleSettingsProvider provider : Extensions.getExtensions(CodeStyleSettingsProvider.EXTENSION_POINT_NAME)) {
        if (provider.getLanguage() == XMLLanguage.INSTANCE && !provider.hasSettingsPage()) {
            createTab(provider);
        }
    }
}
Also used : XmlArrangementPanel(com.intellij.xml.arrangement.XmlArrangementPanel) CodeStyleSettingsProvider(com.intellij.psi.codeStyle.CodeStyleSettingsProvider)

Example 2 with CodeStyleSettingsProvider

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

the class Utils method getLanguageSettings.

@Nullable
public static CustomCodeStyleSettings getLanguageSettings(@NotNull CodeStyleSettings settings, @NotNull Language language) {
    for (CodeStyleSettingsProvider provider : CodeStyleSettingsProvider.EXTENSION_POINT_NAME.getExtensions()) {
        if (language.equals(provider.getLanguage())) {
            CustomCodeStyleSettings modelSettings = provider.createCustomSettings(settings);
            if (modelSettings == null)
                continue;
            CustomCodeStyleSettings customSettings = settings.getCustomSettings(modelSettings.getClass());
            if (customSettings != null) {
                return customSettings;
            }
        }
    }
    logError("Failed to load CustomCodeStyleSettings for " + language);
    return null;
}
Also used : CodeStyleSettingsProvider(com.intellij.psi.codeStyle.CodeStyleSettingsProvider) CustomCodeStyleSettings(com.intellij.psi.codeStyle.CustomCodeStyleSettings) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with CodeStyleSettingsProvider

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

the class JavaCodeStyleMainPanel method initTabs.

@Override
protected void initTabs(CodeStyleSettings settings) {
    super.initTabs(settings);
    addTab(new JavaDocFormattingPanel(settings));
    addTab(new CodeStyleImportsPanelWrapper(settings));
    addTab(new JavaArrangementPanel(settings));
    for (CodeStyleSettingsProvider provider : Extensions.getExtensions(CodeStyleSettingsProvider.EXTENSION_POINT_NAME)) {
        if (provider.getLanguage() == JavaLanguage.INSTANCE && !provider.hasSettingsPage()) {
            createTab(provider);
        }
    }
}
Also used : CodeStyleSettingsProvider(com.intellij.psi.codeStyle.CodeStyleSettingsProvider)

Example 4 with CodeStyleSettingsProvider

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

the class CodeStyleSchemesConfigurable method buildConfigurables.

@Override
protected Configurable[] buildConfigurables() {
    myPanels = new ArrayList<>();
    final List<CodeStyleSettingsProvider> providers = Arrays.asList(Extensions.getExtensions(CodeStyleSettingsProvider.EXTENSION_POINT_NAME));
    Collections.sort(providers, (p1, p2) -> {
        if (!p1.getPriority().equals(p2.getPriority())) {
            return p1.getPriority().compareTo(p2.getPriority());
        }
        String name1 = p1.getConfigurableDisplayName();
        if (name1 == null)
            name1 = "";
        String name2 = p2.getConfigurableDisplayName();
        if (name2 == null)
            name2 = "";
        return name1.compareToIgnoreCase(name2);
    });
    for (final CodeStyleSettingsProvider provider : providers) {
        if (provider.hasSettingsPage()) {
            CodeStyleConfigurableWrapper e = ConfigurableFactory.Companion.getInstance().createCodeStyleConfigurable(provider, ensureModel(), this);
            myPanels.add(e);
        }
    }
    int size = myPanels.size();
    Configurable[] result = new Configurable[size > 0 ? size - 1 : 0];
    for (int i = 0; i < result.length; i++) {
        result[i] = myPanels.get(i + 1);
    }
    return result;
}
Also used : CodeStyleSettingsProvider(com.intellij.psi.codeStyle.CodeStyleSettingsProvider) Configurable(com.intellij.openapi.options.Configurable) SearchableConfigurable(com.intellij.openapi.options.SearchableConfigurable)

Example 5 with CodeStyleSettingsProvider

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

the class GroovyCodeStyleMainPanel method initTabs.

@Override
protected void initTabs(CodeStyleSettings settings) {
    super.initTabs(settings);
    addTab(new GrCodeStyleImportsPanelWrapper(settings));
    for (CodeStyleSettingsProvider provider : Extensions.getExtensions(CodeStyleSettingsProvider.EXTENSION_POINT_NAME)) {
        if (provider.getLanguage() == GroovyLanguage.INSTANCE && !provider.hasSettingsPage()) {
            createTab(provider);
        }
    }
}
Also used : CodeStyleSettingsProvider(com.intellij.psi.codeStyle.CodeStyleSettingsProvider)

Aggregations

CodeStyleSettingsProvider (com.intellij.psi.codeStyle.CodeStyleSettingsProvider)5 Configurable (com.intellij.openapi.options.Configurable)1 SearchableConfigurable (com.intellij.openapi.options.SearchableConfigurable)1 CustomCodeStyleSettings (com.intellij.psi.codeStyle.CustomCodeStyleSettings)1 XmlArrangementPanel (com.intellij.xml.arrangement.XmlArrangementPanel)1 Nullable (org.jetbrains.annotations.Nullable)1