make sort more stable: EA-50594 - IAE: UsageViewImpl.rulesChanged

This commit is contained in:
Alexey Kudravtsev
2013-10-25 13:42:11 +04:00
parent 46c37ecc76
commit 632df82bbd
@@ -108,7 +108,9 @@ public class UsageViewImpl implements UsageView, UsageModelTracker.UsageModelTra
public static final Comparator<Usage> USAGE_COMPARATOR = new Comparator<Usage>() {
@Override
public int compare(final Usage o1, final Usage o2) {
if (o1 == NULL_NODE || o2 == NULL_NODE) return -1;
if (o1 == o2) return 0;
if (o1 == NULL_NODE) return -1;
if (o2 == NULL_NODE) return 1;
if (o1 instanceof Comparable && o2 instanceof Comparable) {
final int selfcompared = ((Comparable<Usage>)o1).compareTo(o2);
if (selfcompared != 0) return selfcompared;
@@ -127,7 +129,7 @@ public class UsageViewImpl implements UsageView, UsageModelTracker.UsageModelTra
return 0;
}
return -1;
return o1.toString().compareTo(o2.toString());
}
};
@NonNls private static final String HELP_ID = "ideaInterface.find";