boolean (@NotNull Document document) { VirtualFile virtualFile = FileDocumentManager.getInstance().getFile(document); if (virtualFile == null) return false; Project project = guessProject(virtualFile); return project != null && !project.isDisposed() && FileEditorManager.getInstance(project).isFileOpen(virtualFile); }