void (@NotNull AnActionEvent e) { final DefaultMutableTreeNode selectedNode = getSelectedNode(); boolean enabled = selectedNode != null && selectedNode.getUserObject() instanceof Configuration && selectedNode.isNodeAncestor(myUserTemplatesNode); e.getPresentation().setEnabled(enabled); }