private void rulesChanged() {
    ThreadingAssertions.assertEventDispatchThread();
    if (!shouldTreeReactNowToRuleChanges()) {
      rulesChanged = true;
      return;
    }

    List<UsageState> states = new ArrayList<>();
    if (myTree != null) {
      captureUsagesExpandState(new TreePath(myTree.getModel().getRoot()), states);
    }
    List<Usage> allUsages = new ArrayList<>(myUsageNodes.keySet());
    allUsages.sort(USAGE_COMPARATOR_BY_FILE_AND_OFFSET);
    Set<Usage> excludedUsages = getExcludedUsages();
    reset();
    myGroupingRules = getActiveGroupingRules(myProject, getUsageViewSettings(), getPresentation());

    myBuilder.setGroupingRules(myGroupingRules);
    myBuilder.setFilteringRules(getActiveFilteringRules(myProject));

    for (int i = allUsages.size() - 1; i >= 0; i--) {
      Usage usage = allUsages.get(i);
      if (!usage.isValid()) {
        allUsages.remove(i);
        continue;
      }
      if (usage instanceof MergeableUsage) {
        ((MergeableUsage)usage).reset();
      }
    }
    appendUsagesInBulk(allUsages).thenRun(() -> SwingUtilities.invokeLater(() -> {
      if (isDisposed()) return;
      if (myTree != null) {
        excludeUsages(excludedUsages.toArray(Usage.EMPTY_ARRAY));
        restoreUsageExpandState(states);
        updateImmediately();
        if (myCentralPanel != null) {
          updateUsagesContextPanels();
        }
      }
    }));
  }
private void rulesChanged()