@Override public boolean isEnableForComponent(Component invoker) { treeSite = getTree(invoker); if (treeSite != null) { SiteNode node = (SiteNode) treeSite.getLastSelectedPathComponent(); if (node != null && !node.isRoot()) { this.setEnabled(true); } else { this.setEnabled(false); } return true; } return false; }
@Override public boolean isEnableForComponent(Component invoker) { contextId = -1; if (invoker instanceof JTree && SiteMapPanel.CONTEXT_TREE_COMPONENT_NAME.equals(invoker.getName())) { JTree contextTree = (JTree) invoker; SiteNode node = (SiteNode) contextTree.getLastSelectedPathComponent(); if (node == null || node.isRoot()) { return false; } contextId = ((Target) node.getUserObject()).getContext().getIndex(); return isEnabledForContext(contextId); } return false; }