private void buildRefGraphIfNeeded(List<? extends Tools> globalTools) {
    for (Tools tools : globalTools) {
      for (ScopeToolState state : tools.getTools()) {
        if (!state.isEnabled()) continue;
        NamedScope stateScope = state.getScope(getProject());
        if (stateScope == null) continue;

        InspectionToolWrapper<?, ?> toolWrapper = state.getTool();
        GlobalInspectionTool tool = (GlobalInspectionTool)toolWrapper.getTool();
        if (tool.isGraphNeeded()) {
          try {
            InspectionEventsKt.reportToQodanaWhenActivityFinished(
              getInspectionEventPublisher(),
              "REFERENCE_SEARCH",
              getProject(),
              () -> ((RefManagerImpl)getRefManager()).findAllDeclarations());
          }
          catch (Throwable e) {
            getStdJobDescriptors().BUILD_GRAPH.setDoneAmount(0);
            throw e;
          }
          return;
        }
      }
    }
  }
private void buildRefGraphIfNeeded(List<? extends Tools> globalTools)