String (@NotNull Project project, PsiFile file) { assert !ApplicationManager.getApplication().isWriteAccessAllowed() : "do not run under write action"; PsiFile targetFile = myFile == null ? file : myFile; List<ProblemDescriptor> descriptions; try { descriptions = ReadAction.nonBlocking(() -> ProgressManager.getInstance().runProcess(() -> { InspectionManager inspectionManager = InspectionManager.getInstance(project); return InspectionEngine.runInspectionOnFile(targetFile, myToolWrapper, inspectionManager.createNewGlobalContext()); }, new DaemonProgressIndicator())).submit(AppExecutorUtil.getAppExecutorService()).get(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } String message = null; if (!descriptions.isEmpty() && FileModificationService.getInstance().preparePsiElementForWrite(targetFile)) { AbstractPerformFixesTask fixesTask = CleanupInspectionUtil.getInstance() .applyFixes(project, LangBundle.message("apply.fixes"), descriptions, myQuickfix.getClass(), myQuickfix.startInWriteAction()); message = fixesTask.getResultMessage(myText); } return message; }