private void applyExpanded(final TreeFacade tree, final Object root) { tree.getIntialized() .doWhenDone( new Runnable() { public void run() { _applyExpanded(tree, root); } }); }
private static boolean applyTo( final int positionInPath, final List<PathElement> path, final Object root, final TreeFacade tree) { if (!(root instanceof DefaultMutableTreeNode)) return false; final DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) root; final Object userObject = treeNode.getUserObject(); final PathElement pathElement = path.get(positionInPath); if (userObject instanceof NodeDescriptor) { if (!pathElement.matchedWith((NodeDescriptor) userObject)) return false; } else { if (!pathElement.matchedWithByObject(userObject)) return false; } tree.expand(treeNode) .doWhenDone( new Runnable() { public void run() { if (positionInPath == path.size() - 1) { return; } for (int j = 0; j < treeNode.getChildCount(); j++) { final TreeNode child = treeNode.getChildAt(j); final boolean resultFromChild = applyTo(positionInPath + 1, path, child, tree); if (resultFromChild) { break; } } } }); return true; }