Search in sources :

Example 6 with CodeStyleSettingPresentation

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

the class CodeStyleSettingsNameProvider method addSetting.

protected void addSetting(@NotNull SettingsType settingsType, @NotNull SettingsGroup group, @NotNull CodeStyleSettingPresentation setting, @Nullable OptionAnchor anchor, @Nullable String anchorFieldName) {
    Map<CodeStyleSettingPresentation.SettingsGroup, List<CodeStyleSettingPresentation>> groups = mySettings.get(settingsType);
    if (groups == null) {
        groups = ContainerUtil.newLinkedHashMap();
    }
    List<CodeStyleSettingPresentation> settingsList = groups.get(group);
    if (settingsList == null) {
        settingsList = ContainerUtil.newLinkedList();
    }
    if (settingsList.contains(setting))
        return;
    if (anchor != null && anchorFieldName != null) {
        CodeStyleSettingPresentation anchorSettingRepresentation = new CodeStyleSettingPresentation(anchorFieldName, anchorFieldName);
        int insertIndex = settingsList.indexOf(anchorSettingRepresentation);
        if (insertIndex < 0) {
            insertIndex = settingsList.size();
        } else {
            switch(anchor) {
                case BEFORE:
                    break;
                case AFTER:
                    insertIndex++;
                    break;
                case NONE:
                    insertIndex = settingsList.size();
            }
        }
        settingsList.add(insertIndex, setting);
    } else {
        settingsList.add(setting);
    }
    groups.put(group, settingsList);
}
Also used : CodeStyleSettingPresentation(com.intellij.psi.codeStyle.presentation.CodeStyleSettingPresentation) SettingsGroup(com.intellij.psi.codeStyle.presentation.CodeStyleSettingPresentation.SettingsGroup)

Aggregations

CodeStyleSettingPresentation (com.intellij.psi.codeStyle.presentation.CodeStyleSettingPresentation)6 SettingsGroup (com.intellij.psi.codeStyle.presentation.CodeStyleSettingPresentation.SettingsGroup)3 SettingsType (com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider.SettingsType)2 Value (com.intellij.psi.codeStyle.extractor.values.Value)2 List (java.util.List)2 CodeStyleBoundedIntegerSettingPresentation (com.intellij.psi.codeStyle.presentation.CodeStyleBoundedIntegerSettingPresentation)1 CodeStyleSelectSettingPresentation (com.intellij.psi.codeStyle.presentation.CodeStyleSelectSettingPresentation)1 OptionGroup (com.intellij.ui.OptionGroup)1 SpeedSearchComparator (com.intellij.ui.SpeedSearchComparator)1 TreeTableSpeedSearch (com.intellij.ui.TreeTableSpeedSearch)1 JBScrollPane (com.intellij.ui.components.JBScrollPane)1 MultiMap (com.intellij.util.containers.MultiMap)1 AbstractTableCellEditor (com.intellij.util.ui.AbstractTableCellEditor)1 ColumnInfo (com.intellij.util.ui.ColumnInfo)1 Map (java.util.Map)1 TableCellEditor (javax.swing.table.TableCellEditor)1 TableCellRenderer (javax.swing.table.TableCellRenderer)1 TableColumn (javax.swing.table.TableColumn)1 Nullable (org.jetbrains.annotations.Nullable)1