org.openide.nodes.Children.findChild()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中org.openide.nodes.Children.findChild()方法的一些代码示例,展示了Children.findChild()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Children.findChild()方法的具体详情如下:
包路径:org.openide.nodes.Children
类名称:Children
方法名:findChild

Children.findChild介绍

[英]Find a child node by name. This may be overridden in subclasses to provide a more advanced way of finding the child, but the default implementation simply scans through the list of nodes to find the first one with the requested name.

Normally the list of nodes should have been computed by the time this returns, but see #getNodes() for an important caveat as to why this may not be doing what you want and what to do instead.
[中]按名称查找子节点。这可以在子类中重写,以提供更高级的查找子类的方法,但默认实现只是扫描节点列表,以查找具有请求名称的第一个节点。
通常情况下,节点列表应该在返回时计算出来,但请参见#getNodes(),以了解重要的注意事项,说明为什么这可能不做您想要做的事情以及应该做什么。

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-nodes

public Node findChild(String name) {
  Node dontGC = original.getChildren().findChild(name);
  return Children.super.findChild(name);
}

代码示例来源:origin: org.netbeans.api/org-openide-nodes

public Node findChild(String name) {
  original.getChildren().findChild(name);
  return Children.super.findChild(name);
}

代码示例来源:origin: org.netbeans.api/org-openide-nodes

/** Look for a node child of given name.
* @param node node to search in
* @param name name of child to look for
* @return the found child, or <code>null</code> if there is no such child
*/
public static Node findChild(Node node, String name) {
  return node.getChildren().findChild(name);
}

代码示例来源:origin: org.netbeans.api/org-openide-nodes

@Override
public Node findChild(String name) {
  return getOriginal().findChild(name);
}

代码示例来源:origin: org.netbeans.api/org-openide-nodes

public Node[] getNodes(boolean optimalResult) {
  final boolean LOG_ENABLED = LOGGER.isLoggable(Level.FINER);
  ChildrenArray hold = null;
  Node find = null;
  if (optimalResult) {
    if (LOG_ENABLED) {
      LOGGER.finer("computing optimal result"); // NOI18N
    }
    hold = getArray(null);
    if (LOG_ENABLED) {
      LOGGER.finer("optimal result is here: " + hold); // NOI18N
    }
    find = children.findChild(null);
    if (LOG_ENABLED) {
      LOGGER.finer("Find child got: " + find); // NOI18N
    }
    Children.LOG.log(Level.FINEST, "after findChild: {0}", optimalResult);
  }
  return getNodes();
}

代码示例来源:origin: org.netbeans.api/org-openide-nodes

/** Find the node.
* @return the found node
* @exception IOException if the parent cannot be recreated
* @exception NodeNotFoundException if the path is not valid (exception may be examined for details)
*/
public Node getNode() throws java.io.IOException {
  Node parentNode = parent.getNode();
  Node child = parentNode.getChildren().findChild(path);
  if (child != null) {
    return child;
  } else {
    throw new NodeNotFoundException(parentNode, path, 0);
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-nodes

holder = children.findChild(null);

代码示例来源:origin: org.netbeans.api/org-openide-nodes

Node foundChild = parentNode.getChildren().findChild(childPath);
if (foundChild != node) {
  Logger.getLogger(DefaultHandle.class.getName()).log(Level.WARNING,

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Look for a node child of given name.
* @param node node to search in
* @param name name of child to look for
* @return the found child, or <code>null</code> if there is no such child
*/
public static Node findChild (Node node, String name) {
  return node.getChildren ().findChild (name);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-sun-ddui

public String getNewBeanId(String prefix) {
  String newId;
  int count = 0;
  // Create unique ID, but not too many tries (avoid infinite or long loops).
  do {
    newId = prefix + newBeanId.getAndIncrement();
  } while(getChildren().findChild(newId) != null && ++count < 100);
  
  return newId;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Look for a node child of given name.
* @param node node to search in
* @param name name of child to look for
* @return the found child, or <code>null</code> if there is no such child
*/
public static Node findChild (Node node, String name) {
  return node.getChildren ().findChild (name);
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

private Node[] findDropedNodes(Node folder, Node[] dragNodes) {
  if ((folder == null) || (dragNodes.length == 0)) {
    return null;
  }
  Node[] dropNodes = new Node[dragNodes.length];
  Children children = folder.getChildren();
  for (int i = 0; i < dragNodes.length; i++) {
    dropNodes[i] = children.findChild(dragNodes[i].getName());
  }
  return dropNodes;
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

private Node[] findDropedNodes(Node folder, Node[] dragNodes) {
  if ((folder == null) || (dragNodes.length == 0)) {
    return null;
  }
  Node[] dropNodes = new Node[dragNodes.length];
  Children children = folder.getChildren();
  for (int i = 0; i < dragNodes.length; i++) {
    dropNodes[i] = children.findChild(dragNodes[i].getName());
  }
  return dropNodes;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

private Node[] findDropedNodes (Node folder, Node[] dragNodes) {
  if (folder==null||dragNodes.length==0) {
    return null;
  }
  Node[] dropNodes = new Node[dragNodes.length];
  Children children = folder.getChildren ();
  for (int i=0; i<dragNodes.length; i++) {
    dropNodes[i] = children.findChild (dragNodes[i].getName ());
  }
  return dropNodes;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

private Node[] findDropedNodes (Node folder, Node[] dragNodes) {
  if (folder==null||dragNodes.length==0) {
    return null;
  }
  Node[] dropNodes = new Node[dragNodes.length];
  Children children = folder.getChildren ();
  for (int i=0; i<dragNodes.length; i++) {
    dropNodes[i] = children.findChild (dragNodes[i].getName ());
  }
  return dropNodes;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

public Node findChild (String name) {
  original.getChildren ().findChild (name);
  return super.findChild (name);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-templates

private Node findChild(Node node, String name, int i) {
  node.getChildren ().getNodes (true);
  Node newSubfolder = node.getChildren ().findChild (name);
  if (newSubfolder == null && i > 0) {
    try {
      Thread.sleep(333);
    } catch (InterruptedException ex) {
    }
    newSubfolder = findChild(node, name, i--);
  }
  return newSubfolder;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javaee-project

private Node findNodeInServerFiles(Node root, FileObject fo) {
  Node configFiles = root.getChildren().findChild("setup"); // NOI18N
  if (configFiles == null) {
    return null;
  }
  return NodeOp.findChild(configFiles, fo.getName());
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Find the node.
* @return the found node
* @exception IOException if the parent cannot be recreated
* @exception NodeNotFoundException if the path is not valid (exception may be examined for details)
*/
public Node getNode () throws java.io.IOException {
  Node parentNode = parent.getNode ();
  Node child = parentNode.getChildren ().findChild (path);
  if (child != null)
    return child;
  else
    throw new NodeNotFoundException (parentNode, path, 0);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-mercurial

public void run() {
    Node root = ptLogial.getExplorerManager().getRootContext();
    // Node projNode = root.getChildren ().findChild( p.getProjectDirectory().getName () );
    Node projNode = root.getChildren().findChild( ProjectUtils.getInformation( p ).getName() );
    if ( projNode != null ) {
      try {
        ptLogial.getExplorerManager().setSelectedNodes( new Node[] { projNode } );
      } catch (Exception ignore) {
        // may ignore it
      }
    }
  }
});

相关文章