Search in sources :

Example 1 with TObjectIntProcedure

use of gnu.trove.TObjectIntProcedure 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);
    }
}
Also used : HighlightSeverity(com.intellij.lang.annotation.HighlightSeverity) JDOMExternalizableStringList(com.intellij.openapi.util.JDOMExternalizableStringList) Element(org.jdom.Element) TObjectIntProcedure(gnu.trove.TObjectIntProcedure)

Aggregations

HighlightSeverity (com.intellij.lang.annotation.HighlightSeverity)1 JDOMExternalizableStringList (com.intellij.openapi.util.JDOMExternalizableStringList)1 TObjectIntProcedure (gnu.trove.TObjectIntProcedure)1 Element (org.jdom.Element)1