From f064ec8d8452fa8e8d4f81037b5af6a5407b74d4 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Wed, 9 Mar 2011 13:42:27 +0100 Subject: [PATCH] compare element name before line number to get consistent results for files containing multiple classes --- .../ui/InspectionResultsViewComparator.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsViewComparator.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsViewComparator.java index fd143315a1ab..826ed7730b8e 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsViewComparator.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsViewComparator.java @@ -127,10 +127,14 @@ public class InspectionResultsViewComparator implements Comparator { } private static int compareEntities(final RefEntity entity1, final RefEntity entity2) { + if (entity1 != null && entity2 != null) { + final int nameComparison = entity1.getName().compareToIgnoreCase(entity2.getName()); + if (nameComparison != 0) { + return nameComparison; + } + } if (entity1 instanceof RefElement && entity2 instanceof RefElement) { return PsiUtilBase.compareElementsByPosition(((RefElement)entity1).getElement(), ((RefElement)entity2).getElement()); - } else if (entity1 != null && entity2 != null) { - return entity1.getName().compareToIgnoreCase(entity2.getName()); } return 0; }