use of com.intellij.openapi.util.JDOMExternalizableStringList in project intellij-community by JetBrains.
the class HtmlUnknownElementInspection method reparseProperties.
protected static JDOMExternalizableStringList reparseProperties(@NotNull final String properties) {
final JDOMExternalizableStringList result = new JDOMExternalizableStringList();
final StringTokenizer tokenizer = new StringTokenizer(properties, ",");
while (tokenizer.hasMoreTokens()) {
result.add(tokenizer.nextToken().toLowerCase().trim());
}
return result;
}
use of com.intellij.openapi.util.JDOMExternalizableStringList in project intellij-community by JetBrains.
the class PyCompatibilityInspectionAdvertiser method getLatestConfiguredCompatiblePythonVersion.
@Nullable
private static LanguageLevel getLatestConfiguredCompatiblePythonVersion(@NotNull PsiElement anchor) {
final InspectionProfile profile = InspectionProfileManager.getInstance(anchor.getProject()).getCurrentProfile();
final PyCompatibilityInspection inspection = (PyCompatibilityInspection) profile.getUnwrappedTool(getCompatibilityInspectionShortName(), anchor);
final JDOMExternalizableStringList versions = inspection.ourVersions;
if (versions.isEmpty()) {
return null;
}
final String maxVersion = Collections.max(versions);
return LanguageLevel.fromPythonVersion(maxVersion);
}
use of com.intellij.openapi.util.JDOMExternalizableStringList in project intellij-community by JetBrains.
the class SeverityRegistrar method readExternal.
public void readExternal(@NotNull Element element) {
myMap.clear();
myRendererColors.clear();
for (Element infoElement : element.getChildren(INFO_TAG)) {
SeverityBasedTextAttributes highlightInfo = new SeverityBasedTextAttributes(infoElement);
String colorStr = infoElement.getAttributeValue(COLOR_ATTRIBUTE);
@SuppressWarnings("UseJBColor") Color color = colorStr == null ? null : new Color(Integer.parseInt(colorStr, 16));
registerSeverity(highlightInfo, color);
}
myReadOrder = new JDOMExternalizableStringList();
myReadOrder.readExternal(element);
List<HighlightSeverity> read = new ArrayList<>(myReadOrder.size());
final List<HighlightSeverity> knownSeverities = getDefaultOrder();
for (String name : myReadOrder) {
HighlightSeverity severity = getSeverity(name);
if (severity != null && knownSeverities.contains(severity)) {
read.add(severity);
}
}
myOrderMap = ensureAllStandardIncluded(read, knownSeverities);
severitiesChanged();
}
use of com.intellij.openapi.util.JDOMExternalizableStringList in project intellij-community by JetBrains.
the class EntryPointsConverterTest method doTest.
private static void doTest(String type, String fqName, String expectedFQName) throws Exception {
final Element entryPoints = setUpEntryPoint(type, fqName);
final HashMap<String, SmartRefElementPointer> persistentEntryPoints = new HashMap<>();
EntryPointsManagerBase.convert(entryPoints, persistentEntryPoints);
final Element testElement = new Element("comp");
EntryPointsManagerBase.writeExternal(testElement, persistentEntryPoints, new JDOMExternalizableStringList());
final Element expectedEntryPoints = setUpEntryPoint(type, expectedFQName);
expectedEntryPoints.setAttribute("version", "2.0");
final Element expected = new Element("comp");
expected.addContent(expectedEntryPoints);
assertTrue(JDOMUtil.areElementsEqual(testElement, expected));
}
use of com.intellij.openapi.util.JDOMExternalizableStringList in project intellij-community by JetBrains.
the class SeverityRegistrar method writeExternal.
public void writeExternal(Element element) {
List<HighlightSeverity> list = getOrderAsList(getOrderMap());
for (HighlightSeverity severity : list) {
Element info = new Element(INFO_TAG);
String severityName = severity.getName();
final SeverityBasedTextAttributes infoType = getAttributesBySeverity(severity);
if (infoType != null) {
infoType.writeExternal(info);
final Color color = myRendererColors.get(severityName);
if (color != null) {
info.setAttribute(COLOR_ATTRIBUTE, Integer.toString(color.getRGB() & 0xFFFFFF, 16));
}
element.addContent(info);
}
}
if (myReadOrder != null && !myReadOrder.isEmpty()) {
myReadOrder.writeExternal(element);
} else if (!getDefaultOrder().equals(list)) {
final JDOMExternalizableStringList ext = new JDOMExternalizableStringList(Collections.nCopies(getOrderMap().size(), ""));
getOrderMap().forEachEntry(new TObjectIntProcedure<HighlightSeverity>() {
@Override
public boolean execute(HighlightSeverity orderSeverity, int oIdx) {
ext.set(oIdx, orderSeverity.getName());
return true;
}
});
ext.writeExternal(element);
}
}
Aggregations