int (@NotNull ActionWrapper o) { int compared = myMode.compareTo(o.getMode()); if (compared != 0) return compared; Presentation myPresentation = myAction.getTemplatePresentation(); Presentation oPresentation = o.getAction().getTemplatePresentation(); String myText = StringUtil.notNullize(myActionText); String oText = StringUtil.notNullize(o.getActionText()); int byText = StringUtil.compare(StringUtil.trimEnd(myText, "..."), StringUtil.trimEnd(oText, "..."), true); if (byText != 0) return byText; int byTextLength = StringUtil.notNullize(myText).length() - StringUtil.notNullize(oText).length(); if (byTextLength != 0) return byTextLength; int byGroup = Comparing.compare(myGroupMapping, o.myGroupMapping); if (byGroup != 0) return byGroup; int byDesc = StringUtil.compare(myPresentation.getDescription(), oPresentation.getDescription(), true); if (byDesc != 0) return byDesc; int byClassHashCode = Integer.compare(myAction.getClass().hashCode(), o.myAction.getClass().hashCode()); if (byClassHashCode != 0) return byClassHashCode; int byInstanceHashCode = Integer.compare(myAction.hashCode(), o.myAction.hashCode()); if (byInstanceHashCode != 0) return byInstanceHashCode; return 0; }