private static List<TreePath> getPaths(BreakpointTree tree, final Object[] userObjects) { final List<TreePath> paths = new ArrayList<TreePath>(userObjects.length); for (Object descriptor : userObjects) { final CheckedTreeNode node = tree.myDescriptorToNodeMap.get(descriptor); if (node != null) { paths.add(new TreePath(node.getPath())); } } return paths; }
public void selectBreakpoints(Breakpoint[] breakpoints) { final List<CheckedTreeNode> nodes = new ArrayList<CheckedTreeNode>(breakpoints.length); for (Breakpoint breakpoint : breakpoints) { final CheckedTreeNode node = myDescriptorToNodeMap.get(new BreakpointDescriptor(breakpoint)); if (node != null) { nodes.add(node); } } clearSelection(); for (CheckedTreeNode node : nodes) { addSelectionPath(new TreePath(node.getPath())); } }
/** * @param parentDescriptor a descriptor of the childNode (possibly not existing) to attach to * @param childNode the childNode to be attached * @return either parent node if it has just been created or null, if the node has been attached * to already existing childNode */ private CheckedTreeNode attachNodeToParent( final TreeDescriptor parentDescriptor, final CheckedTreeNode childNode) { CheckedTreeNode parentNode = myDescriptorToNodeMap.get(parentDescriptor); try { if (parentNode != null) { parentNode.add(childNode); return null; // added to already existing, so stop iteration over appenders } parentNode = createNode(parentDescriptor); parentNode.add(childNode); return parentNode; } finally { if (parentNode != null && parentNode.getChildCount() == 1) { expandPath(new TreePath(parentNode.getPath())); } } }