/** Traverse a path from a parent node down, by an enumeration of names. * @param start node to start searching at * @param names names of nodes * along the path * @return the node with such a path from the start node * @exception NodeNotFoundException if the node with such name * does not exists; the exception contains additional information * about the failure. */ public static Node findPath(Node start, String[] names) throws NodeNotFoundException { return findPath(start, Enumerations.array(names)); }
private Node findNode(Node[] nodes, String[] path) { for (Node node : nodes) { try { return NodeOp.findPath(node, path); } catch (NodeNotFoundException e) { // Will select the first node } } return null; }
private Node findNode(Node start, String[] path) { Node found = null; try { found = NodeOp.findPath(start, path); } catch (NodeNotFoundException ex) { // ignored } return found; }
private static Node findNode(Node start, String[] path) { Node found = null; try { found = NodeOp.findPath(start, path); } catch (NodeNotFoundException ex) { // ignored } return found; }
/** Finds node by given path */ static Node findPath(Node r, String[] path) { try { return NodeOp.findPath(r, path); } catch (NodeNotFoundException ex) { return ex.getClosestNode(); } }
/** Finds node by given path */ static Node findPath(Node r, String[] path) { try { return NodeOp.findPath(r, path); } catch (NodeNotFoundException ex) { return ex.getClosestNode(); } }
/** Finds node by given path */ static Node findPath(Node r, String[] path) { try { return NodeOp.findPath(r, path); } catch (NodeNotFoundException ex) { return ex.getClosestNode(); } }
/** Traverse a path from a parent node down, by an enumeration of names. * @param start node to start searching at * @param names names of nodes * along the path * @return the node with such a path from the start node * @exception NodeNotFoundException if the node with such name * does not exists; the exception contains additional information * about the failure. */ public static Node findPath (Node start, String[] names) throws NodeNotFoundException { return findPath (start, org.openide.util.Enumerations.array (names)); }
/** Traverse a path from a parent node down, by an enumeration of names. * @param start node to start searching at * @param names names of nodes * along the path * @return the node with such a path from the start node * @exception NodeNotFoundException if the node with such name * does not exists; the exception contains additional information * about the failure. */ public static Node findPath (Node start, String[] names) throws NodeNotFoundException { return findPath (start, org.openide.util.Enumerations.array (names)); }
/** Converts path of strings to TreePath if exists null otherwise */ private TreePath stringPath2TreePath(String[] sp) { try { Node n = NodeOp.findPath(getRootContext(), sp); // Create the tree path TreeNode tns[] = new TreeNode[sp.length + 1]; for (int i = sp.length; i >= 0; i--) { tns[i] = Visualizer.findVisualizer(n); n = n.getParentNode(); } return new TreePath(tns); } catch (NodeNotFoundException e) { return null; } } }
private void selectLibrary(Collection<Library> libraries) { Node root = explorer.getRootContext(); List<Node> selection = new ArrayList<Node>(); for (Library lib : libraries) { String[] path = {lib.getManager().getDisplayName(), lib.getName()}; try { Node node = NodeOp.findPath(root, path); if (node != null) { selection.add(node); } } catch (NodeNotFoundException e) { //Ignore it } } try { explorer.setSelectedNodes(selection.toArray(new Node[selection.size()])); } catch (PropertyVetoException e) { //Ignore it } }
return NodeOp.findPath( root, Collections.enumeration( path ) );
private Node findPathPlain(FileObject fo, FileObject groupRoot, Node rootNode) { FileObject folder = fo.isFolder() ? fo : fo.getParent(); String relPath = FileUtil.getRelativePath(groupRoot, folder); List<String> path = new ArrayList<String>(); StringTokenizer strtok = new StringTokenizer(relPath, "/"); // NOI18N while (strtok.hasMoreTokens()) { String token = strtok.nextToken(); path.add(token); } try { Node folderNode = folder.equals(groupRoot) ? rootNode : NodeOp.findPath(rootNode, Collections.enumeration(path)); if (fo.isFolder()) { return folderNode; } else { Node[] childs = folderNode.getChildren().getNodes(true); for (int i = 0; i < childs.length; i++) { DataObject dobj = childs[i].getLookup().lookup(DataObject.class); if (dobj != null && dobj.getPrimaryFile().getNameExt().equals(fo.getNameExt())) { return childs[i]; } } } } catch (NodeNotFoundException e) { e.printStackTrace(); } return null; }
Node folderNode = folder.equals(groupRoot) ? rootNode : NodeOp.findPath(rootNode, Collections.enumeration(path)); if (fo.isFolder()) { return folderNode;
sel = NodeOp.findPath( nodes[i], (Enumeration) new StringTokenizer( preselectedFileName, "/" ) ); break;
sel = NodeOp.findPath(node, preselectedFileName.split("/")); // NOI18N break; } catch (NodeNotFoundException e) {
node = NodeOp.findPath( manager.getRootContext(), NbCollections.checkedEnumerationByFilter(st, String.class, true) ); // NOI18N
public void setSelectedLibrary (LibraryImplementation library) { if (library == null) { return; } ExplorerManager currentManager = this.getExplorerManager(); Node root = currentManager.getRootContext(); String[] path = {library.getType(), library.getName()}; try { Node node = NodeOp.findPath(root, path); if (node != null) { currentManager.setSelectedNodes(new Node[] {node}); } } catch (NodeNotFoundException e) { //Ignore it } catch (PropertyVetoException e) { //Ignore it } }
sel = NodeOp.findPath(nodes[i], NbCollections.checkedEnumerationByFilter(new StringTokenizer(preselectedFileName, "/"), String.class, true)); // NOI18N break;
sel = NodeOp.findPath( nodes[i], NbCollections.checkedEnumerationByFilter( new java.util.StringTokenizer( preselectedFileName, "/" ), String.class, false ) ); break;