private static UsageGroupingRule[] getActiveGroupingRules(final Project project) {
    final UsageGroupingRuleProvider[] providers =
        Extensions.getExtensions(UsageGroupingRuleProvider.EP_NAME);
    List<UsageGroupingRule> list = new ArrayList<UsageGroupingRule>(providers.length);
    for (UsageGroupingRuleProvider provider : providers) {
      ContainerUtil.addAll(list, provider.getActiveRules(project));
    }

    Collections.sort(
        list,
        new Comparator<UsageGroupingRule>() {
          @Override
          public int compare(final UsageGroupingRule o1, final UsageGroupingRule o2) {
            return getRank(o1) - getRank(o2);
          }

          private int getRank(final UsageGroupingRule rule) {
            if (rule instanceof OrderableUsageGroupingRule) {
              return ((OrderableUsageGroupingRule) rule).getRank();
            }

            return Integer.MAX_VALUE;
          }
        });

    return list.toArray(new UsageGroupingRule[list.size()]);
  }
 private AnAction[] createGroupingActions() {
   final UsageGroupingRuleProvider[] providers =
       Extensions.getExtensions(UsageGroupingRuleProvider.EP_NAME);
   List<AnAction> list = new ArrayList<AnAction>(providers.length);
   for (UsageGroupingRuleProvider provider : providers) {
     ContainerUtil.addAll(list, provider.createGroupingActions(this));
   }
   return list.toArray(new AnAction[list.size()]);
 }