void (@NotNull FileEditorManager source, @NotNull VirtualFile file) { if (Boolean.TRUE.equals(file.getUserData(FileEditorManagerImpl.CLOSING_TO_REOPEN))) return; if (ApplicationManager.getApplication().isUnitTestMode()) return; if (!isToBeDeletedOnClose(file)) return; Project project = source.getProject(); ApplicationManager.getApplication().invokeLater(() -> { if (!file.isValid() || source.isFileOpen(file)) return; PsiFile psiFile = PsiManager.getInstance(project).findFile(file); if (psiFile == null) return; DeleteHandler.deletePsiElement(new PsiElement[]{psiFile}, project, false); }, project.getDisposed()); }