use of com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider.SettingsType in project intellij-community by JetBrains.
the class CodeStyleSettingsNameProvider method moveStandardOption.
@Override
public void moveStandardOption(String fieldName, String newGroup) {
for (SettingsType settingsType : SettingsType.values()) {
Map<SettingsGroup, List<CodeStyleSettingPresentation>> standardGroups = mySettings.get(settingsType);
if (standardGroups == null) {
standardGroups = ContainerUtil.newLinkedHashMap();
mySettings.put(settingsType, standardGroups);
}
for (Map.Entry<SettingsGroup, List<CodeStyleSettingPresentation>> entry : standardGroups.entrySet()) {
CodeStyleSettingPresentation moveSetting = null;
for (CodeStyleSettingPresentation setting : entry.getValue()) {
if (setting.getFieldName().equals(fieldName)) {
moveSetting = setting;
break;
}
}
if (moveSetting != null) {
entry.getValue().remove(moveSetting);
addSetting(new SettingsGroup(newGroup), moveSetting, null, null);
}
}
}
}
use of com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider.SettingsType in project intellij-community by JetBrains.
the class CodeStyleSettingsNameProvider method getSettings.
public String getSettings(List<Value> values) {
StringBuilder builder = new StringBuilder();
for (SettingsType settingsType : LanguageCodeStyleSettingsProvider.SettingsType.values()) {
builder.append("<br><b><u>").append(getSettingsTypeName(settingsType)).append("</u></b>");
Map<SettingsGroup, List<CodeStyleSettingPresentation>> groups = mySettings.get(settingsType);
if (groups != null) {
for (Map.Entry<SettingsGroup, List<CodeStyleSettingPresentation>> entry : groups.entrySet()) {
boolean firstSettingGroupTop = entry.getKey().isNull();
boolean groupReported = false;
for (final CodeStyleSettingPresentation setting : entry.getValue()) {
Value myValue = ContainerUtil.find(values, value -> value.state == Value.STATE.SELECTED && value.name.equals(setting.getFieldName()));
if (myValue == null) {
continue;
}
if (!groupReported) {
if (firstSettingGroupTop) {
builder.append("<b>");
} else {
builder.append("<br><b>").append(entry.getKey().name).append("</b>");
}
}
builder.append("<br>");
String postNameSign = setting.getUiName().endsWith(":") ? " " : ": ";
builder.append(setting.getUiName()).append(postNameSign).append(setting.getValueUiName(myValue.value));
if (!groupReported) {
if (firstSettingGroupTop) {
builder.append("</b>");
}
}
groupReported = true;
}
}
}
}
return builder.toString();
}
use of com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider.SettingsType in project intellij-community by JetBrains.
the class CodeErrorReport method getSamplesToTest.
private List<CodeSampleInfo> getSamplesToTest(@NotNull LanguageCodeStyleSettingsProvider provider) {
Set<String> processedSamples = ContainerUtil.newHashSet();
List<CodeSampleInfo> sampleInfos = ContainerUtil.newArrayList();
for (SettingsType setting : mySettingValues) {
String sample = provider.getCodeSample(setting);
if (StringUtil.isEmpty(sample) || processedSamples.contains(sample)) {
continue;
}
processedSamples.add(sample);
sampleInfos.add(new CodeSampleInfo(setting, sample));
}
return sampleInfos;
}
Aggregations