Promise<Object> (@NotNull final PlaybackContext context) { final ActionCallback actionCallback = new ActionCallbackProfilerStopper(); String extension = extractCommandArgument(PREFIX); @NotNull Project project = context.getProject(); DumbService.getInstance(project).smartInvokeLater(() -> { InspectionManagerEx inspectionManagerEx = (InspectionManagerEx)InspectionManager.getInstance(project); //noinspection TestOnlyProblems GlobalInspectionContextImpl inspectionContext = new GlobalInspectionContextImpl(project, inspectionManagerEx.getContentManager()) { @Override protected void notifyInspectionsFinished(@NotNull AnalysisScope scope) { super.notifyInspectionsFinished(scope); context.message(PerformanceTestingBundle.message("command.inspection.finish"), getLine()); actionCallback.setDone(); } }; //set up list of files AnalysisScope scope = getAnalysisScope(extension, project); if (scope == null) { context.message(PerformanceTestingBundle.message("command.inspection.extension") + " " + extension, getLine()); } else { inspectionContext.doInspections(scope); } }); return Promises.toPromise(actionCallback); }