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

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

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

Children.getNodes介绍

[英]Get a (sorted) array of nodes in this list. If the children object is not yet initialized, it will be (using #addNotify) before the nodes are returned.

Warning: not all children implementations do a complete calculation at this point, see #getNodes(boolean)
[中]获取此列表中的节点(已排序)数组。如果子对象尚未初始化,则将在返回节点之前初始化(使用#addNotify)。
警告:此时并非所有子实现都进行完整计算,请参阅#getNodes(布尔值)

代码示例

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

/** Get the nodes as an enumeration.
* @return enumeration of nodes
*/
public final Enumeration<Node> nodes() {
  return Enumerations.array(getNodes());
}

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

/** 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.
* <p>Normally the list of nodes should have been computed by the time this returns,
* but see {@link #getNodes()} for an important caveat as to why this may not
* be doing what you want and what to do instead.
* @param name (code) name of child node to find or <code>null</code> if any arbitrary child may
*    be returned
* @return the node or <code>null</code> if it could not be found
*/
public Node findChild(String name) {
  Node[] list = getNodes();
  if (list.length == 0) {
    return null;
  }
  if (name == null) {
    // return any node
    return list[0];
  }
  for (int i = 0; i < list.length; i++) {
    if (name.equals(list[i].getName())) {
      // ok, we have found it
      return list[i];
    }
  }
  return null;
}

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

public Node[] callGetNodes(boolean optimalResult) {
  Node[] hold = null;
  if (optimalResult) {
    hold = original.getChildren().getNodes(true);
  }
  hold = Children.this.getNodes();
  return hold;
}

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

public Node[] callGetNodes(boolean optimalResult) {
  Node[] hold = null;
  if (optimalResult) {
    hold = original.getChildren().getNodes(true);
  }
  hold = Children.this.getNodes();
  return hold;
}

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

Throwable t = null;
try {
  parentNodes = Arrays.toString(parent.getNodes());
  chNodes = Arrays.toString(ch.getNodes());
} catch (StackOverflowError e) {
  t = e;

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

private void updateKeys() {
  final boolean LOG_ENABLED = LOGGER.isLoggable(Level.FINER);
  if (LOG_ENABLED) {
    LOGGER.finer("updateKeys() " + this); // NOI18N
  }
  ChildrenAdapter cha = nodeL;
  if (cha != null) {
    if (LOG_ENABLED) {
      LOGGER.finer("    getting original nodes"); // NOI18N
    }
    Node[] arr = original.getChildren().getNodes();
    if (LOG_ENABLED) {
      LOGGER.finer("    setKeys(), keys: " + Arrays.toString(arr)); // NOI18N
    }
    setKeys(arr);
    if (!origSupport.isInitialized()) {
      origSupport.notifySetEntries();
    }
  }
}

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

@Override
  public void run() {
    children.remove(children.getNodes());
  }
});

代码示例来源:origin: it.tidalwave.netbeans/it-tidalwave-netbeans-nodes

@Override
 public void run()
  {
   logger.finest(">>>> removing current children...");
   children.remove(children.getNodes());
  }
});

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

private void refreshChildren() {
    Node[] origChildren = original.getChildren().getNodes();
    for (Node node : origChildren) {
      refreshKey(node);
    }
  }
}

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

private void refreshChildren() {
    Node[] origChildren = original.getChildren().getNodes();
    for (Node node : origChildren) {
      refreshKey(node);
    }
  }
}

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

/** Selects the added nodes */
public void select () {
  if (added != null) {
    // if initialized => wait till finished update
    node.getChildren().getNodes(true);
    // and select the right nodes
    org.openide.nodes.Children.MUTEX.readAccess (this);
  }
}

代码示例来源:origin: nl.cloudfarming.client/nbtaskfocus-core

public Node findNode(FileObject objectToSelect) {
  Node[] nodes = getChildren().getNodes();
  for( Node node : nodes) {
    ProjectItemNode projectItemNode = (ProjectItemNode) node;
    Node foundNode = projectItemNode.findNode(objectToSelect);
    if( null != foundNode ) {
      return foundNode;
    }
  }
  return null;
}

代码示例来源:origin: nl.cloudfarming.client/nbtaskfocus-core

public ContextNode findNode(FileObject objectToSelect) {
    Node[] nodes = getChildren().getNodes();
    for( Node node : nodes) {
      ContextNode foundNode = ((ContextNode)node).findNode(objectToSelect);
      if( null != foundNode ) {
        return foundNode;
      }
    }
    return null;
  }
}

代码示例来源:origin: it.tidalwave.semantic/it-tidalwave-semantic-node

public void actionPerformed (@Nonnull final ActionEvent event)
  {
   final Node[] all = containerNode.getChildren().getNodes();
   containerNode.getChildren().remove(all);
  }
};

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

private void sortNodes() {
    Node[] origNodes = original.getChildren().getNodes();
    if (isSortingActive()) {
      Node[] sortedNodes = new Node[origNodes.length];
      System.arraycopy(origNodes, 0, sortedNodes, 0, origNodes.length);
      Collections.sort(Arrays.asList(sortedNodes), getRowComparator());
      setKeys(sortedNodes);
    } else {
      setKeys(origNodes);
    }
  }
}

代码示例来源: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-j2ee-sun-ddui

@Override
public void refreshView() {
  Node [] rootNodes = getRoot().getChildren().getNodes();
  if(rootNodes != null) {
    for(Node n: rootNodes) {
      if(n instanceof SectionNode) {
        ((SectionNode) n).refreshSubtree();
      }
    }
  }
}

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

/** Synchronize the root context from the manager of this Explorer.
*/
final void synchronizeRootContext() {
  NodeTableModel ntm = (NodeTableModel)table.getModel();
  ntm.setNodes(manager.getRootContext().getChildren().getNodes());
}

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

private int getNodePosition (Node n) {
  Index supp = getIndexSupport (n);
  DataFolder df = n.getParentNode ().getLookup ().lookup (DataFolder.class);
  df.getNodeDelegate ().getChildren ().getNodes (true);
  int pos = supp.indexOf (n);          
  // #141851: getNodes()/getNodePosition() is not called under Children.MUTEX 
  // therefore it is not guaranteed that node will be found (node could be deleted meanwhile)
  // assert pos != -1 : "Node " + n + " has position " + pos + " in children " + Arrays.asList (n.getParentNode ().getChildren ().getNodes ());
  return pos;
}

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

@Override
protected void storeToDataModel() {
  for (Node n : getExplorerManager().getRootContext().getChildren().getNodes()) {
    ModeNode mn = (ModeNode)n;
    if (mn.isSelected()) {
      data.defineMode(mn.getName(), mn.text);
    }
  }
}

相关文章