@Override public SliceNode getNextSibling(@NotNull SliceNode element) { AbstractTreeNode parent = element.getParent(); if (parent == null) return null; return element.getNext((List) parent.getChildren()); }
private static boolean addToPath( AbstractTreeNode<?> rootElement, Object element, ArrayList<AbstractTreeNode> result, Collection<Object> processedElements) { Object value = rootElement.getValue(); if (value instanceof StructureViewTreeElement) { value = ((StructureViewTreeElement) value).getValue(); } if (!processedElements.add(value)) { return false; } if (Comparing.equal(value, element)) { result.add(0, rootElement); return true; } Collection<? extends AbstractTreeNode> children = rootElement.getChildren(); for (AbstractTreeNode child : children) { if (addToPath(child, element, result, processedElements)) { result.add(0, rootElement); return true; } } return false; }
private void appendChildNodes( AbstractTreeNode node, TreeItem<Pair<AbstractUrl, String>> treeItem) { final Collection<? extends AbstractTreeNode> children = node.getChildren(); for (AbstractTreeNode child : children) { final TreeItem<Pair<AbstractUrl, String>> childTreeItem = new TreeItem<Pair<AbstractUrl, String>>(createPairForNode(child)); treeItem.addChild(childTreeItem); appendChildNodes(child, childTreeItem); } }