本文整理汇总了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());
}
}
示例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;
}
示例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);
}
}
}
示例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);
}
}
}
示例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) {
}
}
}
示例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;
}
示例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);
}
}
}