AnalysisScope (Project project, GlobalInspectionContextEx context, Runnable analysisRunner) { VirtualFile[] changes = ChangesUtil.getFilesFromChanges(ChangeListManager.getInstance(project).getAllChanges()); setupFirstAnalysisHandler(context); DumbService dumbService = DumbService.getInstance(project); while (dumbService.isDumb()) { LockSupport.parkNanos(50_000_000); } if (ProjectLevelVcsManager.getInstance(project).getAllVcsRoots().length == 0) { try { isMappingLoaded.blockingGet(60000); } catch (TimeoutException | ExecutionException e) { onFailure(InspectionsBundle.message("inspection.application.cannot.initialize.vcs.mapping")); } } runAnalysisAfterShelvingSync( project, ChangeListManager.getInstance(project).getAffectedFiles(), createProgressIndicator(), () -> { syncProject(project, changes); analysisRunner.run(); } ); syncProject(project, changes); // new added files becomes invalid after unshelving, so we need to update our scope List<VirtualFile> files = ChangeListManager.getInstance(project).getAffectedFiles(); if (myVerboseLevel == 3) { for (VirtualFile file : files) { reportMessage(1, "modified after unshelving: " + file.getPath()); } } return new AnalysisScope(project, files); }