void (@NotNull AnActionEvent e) { Project project = e.getProject(); History history = e.getData(History.KEY); boolean isModalContext = e.getData(PlatformCoreDataKeys.IS_MODAL_CONTEXT) == Boolean.TRUE; Presentation presentation = e.getPresentation(); if (history != null) { presentation.setEnabled(history.canGoBack()); } else if (project != null && !project.isDisposed()) { presentation.setEnabled(!isModalContext && IdeDocumentHistory.getInstance(project).isBackAvailable()); } else { presentation.setEnabled(false); } }