當前位置: 首頁>>代碼示例>>Java>>正文


Java TreeItem.getChildren方法代碼示例

本文整理匯總了Java中com.intellij.util.TreeItem.getChildren方法的典型用法代碼示例。如果您正苦於以下問題:Java TreeItem.getChildren方法的具體用法?Java TreeItem.getChildren怎麽用?Java TreeItem.getChildren使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.util.TreeItem的用法示例。


在下文中一共展示了TreeItem.getChildren方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: TreeNodeAdapter

import com.intellij.util.TreeItem; //導入方法依賴的package包/類
public TreeNodeAdapter(TreeNodeAdapter parent, TreeItem<VcsFileRevision> revision, List<TreeItem<VcsFileRevision>> children) {
  if (parent != null) {
    parent.add(this);
  }
  myRevision = revision;
  for (TreeItem<VcsFileRevision> treeItem : children) {
    new TreeNodeAdapter(this, treeItem, treeItem.getChildren());
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:CompareWithSelectedRevisionAction.java

示例2: findListToRemoveFrom

import com.intellij.util.TreeItem; //導入方法依賴的package包/類
private <T> boolean findListToRemoveFrom(@NotNull String name, @NotNull final List<T> elements,
                                         final Convertor<T, AbstractUrl> convertor) {
  Collection<TreeItem<Pair<AbstractUrl, String>>> list = getFavoritesListRootUrls(name);
  if (elements.size() > 1) {
    final List<T> sublist = elements.subList(0, elements.size() - 1);
    for (T obj : sublist) {
      AbstractUrl objUrl = convertor.convert(obj);
      final TreeItem<Pair<AbstractUrl, String>> item = findNextItem(objUrl, list);
      if (item == null || item.getChildren() == null) return false;
      list = item.getChildren();
    }
  }

  TreeItem<Pair<AbstractUrl, String>> found = null;
  AbstractUrl url = convertor.convert(elements.get(elements.size() - 1));
  if (url == null) return false;
  for (TreeItem<Pair<AbstractUrl, String>> pair : list) {
    if (url.equals(pair.getData().getFirst())) {
      found = pair;
      break;
    }
  }

  if (found != null) {
    list.remove(found);
    rootsChanged();
    return true;
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:31,代碼來源:FavoritesManager.java

示例3: writeRoots

import com.intellij.util.TreeItem; //導入方法依賴的package包/類
private static void writeRoots(Element element, Collection<TreeItem<Pair<AbstractUrl, String>>> roots) {
  for (TreeItem<Pair<AbstractUrl, String>> root : roots) {
    final AbstractUrl url = root.getData().getFirst();
    if (url == null) continue;
    final Element list = new Element(FAVORITES_ROOT);
    url.write(list);
    list.setAttribute(CLASS_NAME, root.getData().getSecond());
    element.addContent(list);
    final List<TreeItem<Pair<AbstractUrl, String>>> children = root.getChildren();
    if (children != null && !children.isEmpty()) {
      writeRoots(list, children);
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:FavoritesManager.java

示例4: iterateTreeItems

import com.intellij.util.TreeItem; //導入方法依賴的package包/類
private static void iterateTreeItems(final Collection<TreeItem<Pair<AbstractUrl, String>>> coll,
                                     Consumer<TreeItem<Pair<AbstractUrl, String>>> consumer) {
  final ArrayDeque<TreeItem<Pair<AbstractUrl, String>>> queue = new ArrayDeque<TreeItem<Pair<AbstractUrl, String>>>();
  queue.addAll(coll);
  while (!queue.isEmpty()) {
    final TreeItem<Pair<AbstractUrl, String>> item = queue.removeFirst();
    consumer.consume(item);
    final List<TreeItem<Pair<AbstractUrl, String>>> children = item.getChildren();
    if (children != null && !children.isEmpty()) {
      queue.addAll(children);
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:FavoritesManager.java

示例5: processUrls

import com.intellij.util.TreeItem; //導入方法依賴的package包/類
private static void processUrls(Project project,
                                Collection<TreeItem<Pair<AbstractUrl, String>>> urls,
                                Collection<AbstractTreeNode> result, final AbstractTreeNode me) {
  for (TreeItem<Pair<AbstractUrl, String>> pair : urls) {
    AbstractUrl abstractUrl = pair.getData().getFirst();
    final Object[] path = abstractUrl.createPath(project);
    if (path == null || path.length < 1 || path[0] == null) {
      continue;
    }
    try {
      final String className = pair.getData().getSecond();

      @SuppressWarnings("unchecked")
      final Class<? extends AbstractTreeNode> nodeClass = (Class<? extends AbstractTreeNode>)Class.forName(className);

      final AbstractTreeNode node = ProjectViewNode
        .createTreeNode(nodeClass, project, path[path.length - 1], FavoritesManager.getInstance(project).getViewSettings());
      node.setParent(me);
      node.setIndex(result.size());
      result.add(node);

      if (node instanceof ProjectViewNodeWithChildrenList) {
        final List<TreeItem<Pair<AbstractUrl, String>>> children = pair.getChildren();
        if (children != null && !children.isEmpty()) {
          Collection<AbstractTreeNode> childList = new ArrayList<AbstractTreeNode>();
          processUrls(project, children, childList, node);
          for (AbstractTreeNode treeNode : childList) {
            ((ProjectViewNodeWithChildrenList)node).addChild(treeNode);
          }
        }
      }
    }
    catch (Exception ignored) {
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:37,代碼來源:FavoritesListNode.java

示例6: findListToRemoveFrom

import com.intellij.util.TreeItem; //導入方法依賴的package包/類
private <T> boolean findListToRemoveFrom(@Nonnull String name, @Nonnull final List<T> elements, final Convertor<T, AbstractUrl> convertor) {
  Collection<TreeItem<Pair<AbstractUrl, String>>> list = getFavoritesListRootUrls(name);
  if (elements.size() > 1) {
    final List<T> sublist = elements.subList(0, elements.size() - 1);
    for (T obj : sublist) {
      AbstractUrl objUrl = convertor.convert(obj);
      final TreeItem<Pair<AbstractUrl, String>> item = findNextItem(objUrl, list);
      if (item == null || item.getChildren() == null) return false;
      list = item.getChildren();
    }
  }

  TreeItem<Pair<AbstractUrl, String>> found = null;
  AbstractUrl url = convertor.convert(elements.get(elements.size() - 1));
  if (url == null) return false;
  for (TreeItem<Pair<AbstractUrl, String>> pair : list) {
    if (url.equals(pair.getData().getFirst())) {
      found = pair;
      break;
    }
  }

  if (found != null) {
    list.remove(found);
    rootsChanged();
    return true;
  }
  return false;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:30,代碼來源:FavoritesManager.java

示例7: iterateTreeItems

import com.intellij.util.TreeItem; //導入方法依賴的package包/類
private static void iterateTreeItems(final Collection<TreeItem<Pair<AbstractUrl, String>>> coll, Consumer<TreeItem<Pair<AbstractUrl, String>>> consumer) {
  final ArrayDeque<TreeItem<Pair<AbstractUrl, String>>> queue = new ArrayDeque<TreeItem<Pair<AbstractUrl, String>>>();
  queue.addAll(coll);
  while (!queue.isEmpty()) {
    final TreeItem<Pair<AbstractUrl, String>> item = queue.removeFirst();
    consumer.consume(item);
    final List<TreeItem<Pair<AbstractUrl, String>>> children = item.getChildren();
    if (children != null && !children.isEmpty()) {
      queue.addAll(children);
    }
  }
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:13,代碼來源:FavoritesManager.java


注:本文中的com.intellij.util.TreeItem.getChildren方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。