void (@NotNull Project project) { // validate all editors are disposed after fireProjectClosed() was called, because it's the place where editor should be released Disposer.register(project, () -> { Project[] openProjects = ProjectManager.getInstance().getOpenProjects(); boolean isLastProjectClosed = openProjects.length == 0; // EditorTextField.releaseEditorLater defer releasing its editor; invokeLater to avoid false positives about such editors. ApplicationManager.getApplication().invokeLater(() -> { try { validateEditorsAreReleased(project, isLastProjectClosed); } catch (Throwable e) { LOG.error(e); } }, ModalityState.any()); }); }