From 9f79cc04c748e8d49ee09a6a9a01f328c1b4563a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Kubitz?= Date: Tue, 9 Jul 2024 14:24:32 +0200 Subject: [PATCH] fix MarkerPriorityField.compare() #2041 https://github.com/eclipse-platform/eclipse.platform.ui/issues/2041 --- .../ui/internal/views/markers/MarkerComparator.java | 7 +++---- .../ui/internal/views/markers/MarkerPriorityField.java | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerComparator.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerComparator.java index 5e0bf1d2ad5..e84d3254602 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerComparator.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerComparator.java @@ -100,17 +100,16 @@ public int compare(MarkerItem item1, MarkerItem item2) { * @return int */ public int compareFields(MarkerItem item0, MarkerItem item1) { - int value = 0; for (MarkerField field : fields) { - value = field.compare(item0, item1); + int value = field.compare(item0, item1); if (value != 0) { if (descendingFields.contains(field)) { value = -value; } - break; + return value; } } - return value; + return 0; } /** * Comparator to compare the two MarkerEntry(s) by various fields diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerPriorityField.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerPriorityField.java index 02e8a3e651a..3bcb9218cd8 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerPriorityField.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerPriorityField.java @@ -101,7 +101,7 @@ public MarkerPriorityField() { @Override public int compare(MarkerItem item1, MarkerItem item2) { return Integer.compare(item1.getAttributeValue(IMarker.PRIORITY, IMarker.PRIORITY_NORMAL), - item1.getAttributeValue(IMarker.PRIORITY, IMarker.PRIORITY_NORMAL)); + item2.getAttributeValue(IMarker.PRIORITY, IMarker.PRIORITY_NORMAL)); } @Override