void (@NotNull final AnActionEvent e) { final Presentation presentation = e.getPresentation(); presentation.setEnabled(false); final DefaultMutableTreeNode[] selectedNodes = myRootsTree.getSelectedNodes(DefaultMutableTreeNode.class, null); for (DefaultMutableTreeNode node : selectedNodes) { final Object userObject = node.getUserObject(); if (!(userObject instanceof MigrationNode migrationNode)) return; //disable include if parent was excluded if (migrationNode.getParent() instanceof MigrationNode parentNode && parentNode.getInfo().isExcluded()) return; } presentation.setEnabled(true); }