protected void launchInspections(@NotNull AnalysisScope scope) {
    ApplicationManager.getApplication().assertWriteIntentLockAcquired();
    PsiDocumentManager.getInstance(myProject).commitAllDocuments();

    LOG.info("Code inspection started");
    InspectionProfileImpl profile = getCurrentProfile();
    String title = profile.getSingleTool() == null
                   ? AnalysisBundle.message("inspection.progress.profile.title", profile.getName())
                   : AnalysisBundle.message("inspection.progress.single.inspection.title", profile.getName());
    boolean modalProgress =
      Registry.is("batch.inspections.modal.progress.when.building.global.reference.graph") && needsGlobalReferenceGraph();
    if (modalProgress) {
      ProgressManager.getInstance().run(new Task.Modal(getProject(), title, true) {
        @Override
        public void run(@NotNull ProgressIndicator indicator) {
          performInspectionsWithProgress(scope, false, false);
        }

        @Override
        public void onSuccess() {
          notifyInspectionsFinished(scope);
        }

        @Override
        public void onCancel() {
          // execute cleanup in EDT because of myTools
          cleanup();
        }
      });
    }
    else {
      ProgressManager.getInstance().run(new Task.Backgroundable(getProject(), title, true, createOption()) {
        @Override
        public void run(@NotNull ProgressIndicator indicator) {
          performInspectionsWithProgress(scope, false, false);
        }

        @Override
        public void onSuccess() {
          notifyInspectionsFinished(scope);
        }

        @Override
        public void onCancel() {
          // execute cleanup in EDT because of myTools
          cleanup();
        }
      });
    }
  }
protected void launchInspections(@NotNull AnalysisScope scope)