mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
correctly compare default severities
This commit is contained in:
@@ -54,7 +54,7 @@ public class SeverityRegistrar implements JDOMExternalizable, Comparator<Highlig
|
||||
private final Map<String, Color> ourRendererColors = new THashMap<String, Color>();
|
||||
@NonNls private static final String COLOR = "color";
|
||||
|
||||
private final TObjectIntHashMap<HighlightSeverity> myOrder = new TObjectIntHashMap<HighlightSeverity>();
|
||||
private final OrderMap myOrder = new OrderMap();
|
||||
private JDOMExternalizableStringList myReadOrder;
|
||||
|
||||
private static final Map<String, HighlightInfoType> STANDARD_SEVERITIES = new THashMap<String, HighlightInfoType>();
|
||||
@@ -301,13 +301,15 @@ public class SeverityRegistrar implements JDOMExternalizable, Comparator<Highlig
|
||||
|
||||
@Override
|
||||
public int compare(final HighlightSeverity s1, final HighlightSeverity s2) {
|
||||
TObjectIntHashMap<HighlightSeverity> order = getOrder();
|
||||
return order.get(s1) - order.get(s2);
|
||||
OrderMap order = getOrder();
|
||||
int o1 = order.getOrder(s1, -1);
|
||||
int o2 = order.getOrder(s2, -1);
|
||||
return o1 - o2;
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
private TObjectIntHashMap<HighlightSeverity> getOrder() {
|
||||
private OrderMap getOrder() {
|
||||
if (myOrder.isEmpty()) {
|
||||
List<HighlightSeverity> order = getDefaultOrder();
|
||||
setFromList(order);
|
||||
@@ -414,4 +416,11 @@ public class SeverityRegistrar implements JDOMExternalizable, Comparator<Highlig
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
private static class OrderMap extends TObjectIntHashMap<HighlightSeverity> {
|
||||
private int getOrder(@NotNull HighlightSeverity severity, int defaultOrder) {
|
||||
int index = index(severity);
|
||||
return index < 0 ? defaultOrder : _values[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user