boolean (@NotNull VirtualFile vFile, @NotNull PsiElementVisitor visitor, @NotNull PsiManager psiManager, boolean needReadAction, boolean idempotent) { if (needReadAction && !ApplicationManager.getApplication().isDispatchThread()) { Project project = psiManager.getProject(); if (idempotent) { ReadAction .nonBlocking(() -> doProcessFile(visitor, psiManager, vFile)) .withDocumentsCommitted(project) .inSmartMode(project) .executeSynchronously(); } else { commitAndRunInSmartMode(() -> doProcessFile(visitor, psiManager, vFile), project); } } else { doProcessFile(visitor, psiManager, vFile); } ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator(); return indicator == null || !indicator.isCanceled(); }