public static UsageGroupingRule @NotNull [] getAllRules(@NotNull Project project,
                                                          @NotNull UsageViewSettings usageViewSettings,
                                                          @Nullable UsageViewPresentation presentation,
                                                          boolean supportsNonCodeRule,
                                                          boolean supportsScopesRule,
                                                          boolean supportsModuleRule) {
    List<UsageGroupingRule> rules = new ArrayList<>();
    if (supportsNonCodeRule) {
      rules.add(new NonCodeUsageGroupingRule(presentation));
    }
    if (supportsScopesRule) {
      rules.add(new UsageScopeGroupingRule());
    }

    rules.add(new UsageTypeGroupingRule());

    if (supportsModuleRule) {
      rules.add(new ModuleGroupingRule(project, usageViewSettings.isFlattenModules()));
    }

    UsageGroupingRule packageRule = DirectoryGroupingRule.getInstance(project);
    if (presentation != null) {
      for (PackageGroupRuleProvider ruleProvider : PackageGroupRuleProvider.EP_NAME.getExtensionList()) {
        UsageGroupingRule rule = ruleProvider.getUsageGroupingRule(project, usageViewSettings, presentation.isDetachedMode());
        if (rule == null) continue;
        if (!(rule instanceof UsageGroupingRuleEx)) {
          rule = new PackageGroupingRuleExWrapper(rule);
        }
        packageRule = rule;
        break;
      }
    }
    rules.add(packageRule);

    rules.add(new DirectoryStructureGroupingRule(project, usageViewSettings.isCompactMiddleDirectories()));

    for (FileStructureGroupRuleProvider ruleProvider : FileStructureGroupRuleProvider.EP_NAME.getExtensionList()) {
      UsageGroupingRule rule = ruleProvider.getUsageGroupingRule(project, usageViewSettings);
      if (rule == null) continue;
      if (!(rule instanceof UsageGroupingRuleEx)) {
        rule = new FileStructureGroupingRuleExWrapper(rule);
      }
      rules.add(rule);
    }

    rules.add(new FileGroupingRule(project));

    return rules.toArray(UsageGroupingRule.EMPTY_ARRAY);
  }
public static UsageGroupingRule @NotNull [] getAllRules(@NotNull Project project,
                                                          @NotNull UsageViewSettings usageViewSettings,
                                                          @Nullable UsageViewPresentation presentation,
                                                          boolean supportsNonCodeRule,
                                                          boolean supportsScopesRule,
                                                          boolean supportsModuleRule)