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);
}
Aggregations