void (@NotNull AnActionEvent e) { Project project = e.getData(CommonDataKeys.PROJECT); if (project == null) { e.getPresentation().setEnabled(false); return; } FileEditor fileEditor = e.getData(PlatformCoreDataKeys.FILE_EDITOR); Editor editor = fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() : e.getData(CommonDataKeys.EDITOR); boolean enabled = fileEditor != null && (!Boolean.TRUE.equals(EditorTextField.SUPPLEMENTARY_KEY.get(editor))) && fileEditor.getStructureViewBuilder() != null; e.getPresentation().setEnabled(enabled); }