mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix custom severities order
This commit is contained in:
+14
-4
@@ -151,7 +151,7 @@ public class SeverityRegistrar implements Comparator<HighlightSeverity> {
|
||||
}
|
||||
else {
|
||||
//enforce include all known
|
||||
List<HighlightSeverity> list = getAllSeverities();
|
||||
List<HighlightSeverity> list = getSortedSeverities(orderMap);
|
||||
for (HighlightSeverity stdSeverity : knownSeverities) {
|
||||
if (!list.contains(stdSeverity)) {
|
||||
for (int oIdx = 0; oIdx < list.size(); oIdx++) {
|
||||
@@ -200,9 +200,14 @@ public class SeverityRegistrar implements Comparator<HighlightSeverity> {
|
||||
|
||||
@NotNull
|
||||
public List<HighlightSeverity> getAllSeverities() {
|
||||
return Arrays.stream(getOrderMap().keys())
|
||||
return getSortedSeverities(getOrderMap());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private List<HighlightSeverity> getSortedSeverities(OrderMap map) {
|
||||
return Arrays.stream(map.keys())
|
||||
.map(o -> (HighlightSeverity)o)
|
||||
.sorted(this)
|
||||
.sorted((o1, o2) -> compare(o1, o2, map))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -264,7 +269,12 @@ public class SeverityRegistrar implements Comparator<HighlightSeverity> {
|
||||
|
||||
@Override
|
||||
public int compare(@NotNull HighlightSeverity s1, @NotNull HighlightSeverity s2) {
|
||||
OrderMap orderMap = getOrderMap();
|
||||
return compare(s1, s2, getOrderMap());
|
||||
}
|
||||
|
||||
private int compare(@NotNull HighlightSeverity s1,
|
||||
@NotNull HighlightSeverity s2,
|
||||
@NotNull OrderMap orderMap) {
|
||||
int o1 = orderMap.getOrder(s1);
|
||||
int o2 = orderMap.getOrder(s2);
|
||||
return o1 - o2;
|
||||
|
||||
Reference in New Issue
Block a user