public void init() { HL7TreeNode node = (HL7TreeNode) this.getStructuredSelection().getFirstElement(); if (node == null) { this.setEnabled(false); } else { if (node.getParent() == null) { this.setEnabled(false); } else { this.setEnabled(true); } } }
/** * DOC ke Comment method "disconnectSubTree". * * @param node */ private void disconnectSubTree(HL7TreeNode node) { if (node == null) { return; } if (node.hasLink()) { node.setColumn(null); } List<HL7TreeNode> children = node.getChildren(); for (HL7TreeNode child : children) { disconnectSubTree(child); } }
/* * (non-Javadoc) * * @see org.eclipse.jface.action.Action#run() */ @Override public void run() { HL7TreeNode node = (HL7TreeNode) this.getStructuredSelection().getFirstElement(); if (node == null) { return; } HL7TreeNode parent = node.getParent(); if (parent == null) { return; } if (node instanceof Element) { disconnectSubTree(node); } parent.removeChild(node); xmlViewer.refresh(parent); }