void (@NotNull AnalysisScope scope, boolean runGlobalToolsOnly, boolean isOfflineInspections) { myProgressIndicator = ProgressManager.getInstance().getProgressIndicator(); if (!(myProgressIndicator instanceof ProgressIndicatorEx) || !(myProgressIndicator instanceof ProgressIndicatorWithDelayedPresentation)) { throw new IllegalStateException("Inspections must be run under ProgressWindow but got: "+myProgressIndicator); } myProgressIndicator.setIndeterminate(false); ((ProgressIndicatorEx)myProgressIndicator).addStateDelegate(new AbstractProgressIndicatorExBase(){ @Override public void cancel() { super.cancel(); canceled(); } }); PsiManager psiManager = PsiManager.getInstance(myProject); //init manager in read action ((RefManagerImpl)getRefManager()).runInsideInspectionReadAction(() -> psiManager.runInBatchFilesMode(() -> { try { getStdJobDescriptors().BUILD_GRAPH.setTotalAmount(scope.getFileCount()); getStdJobDescriptors().LOCAL_ANALYSIS.setTotalAmount(scope.getFileCount()); getStdJobDescriptors().FIND_EXTERNAL_USAGES.setTotalAmount(0); runTools(scope, runGlobalToolsOnly, isOfflineInspections); } catch (ProcessCanceledException | IndexNotReadyException e) { throw e; } catch (Throwable e) { LOG.error(e); } return null; }) ); }