void (@NotNull AnActionEvent event) { Presentation presentation = event.getPresentation(); TreeExpander expander = getExpander(event.getDataContext()); presentation.setVisible(expander == null || expander.isExpandAllVisible()); presentation.setEnabled(expander != null && expander.canExpand()); }