void (final @NotNull PsiFile psiFile) { CommandProcessor.getInstance().executeCommand( psiFile.getProject(), () -> { final Runnable action = () -> { try { psiFile.putUserData(runningValidationKey, ""); PsiDocumentManager.getInstance(psiFile.getProject()).commitAllDocuments(); getHandler(psiFile).doValidate((XmlFile)psiFile); } finally { psiFile.putUserData(runningValidationKey, null); } }; ApplicationManager.getApplication().runWriteAction(action); }, getCommandName(), null ); }