当前位置: 首页>>代码示例>>Java>>正文


Java TreeItem类代码示例

本文整理汇总了Java中com.intellij.util.TreeItem的典型用法代码示例。如果您正苦于以下问题:Java TreeItem类的具体用法?Java TreeItem怎么用?Java TreeItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TreeItem类属于com.intellij.util包,在下文中一共展示了TreeItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addRoots

import com.intellij.util.TreeItem; //导入依赖的package包/类
public boolean addRoots(final String name, final Collection<AbstractTreeNode> nodes) {
  final Collection<TreeItem<Pair<AbstractUrl, String>>> list = getFavoritesListRootUrls(name);

  final HashSet<AbstractUrl> set =
    new HashSet<AbstractUrl>(ContainerUtil.map(list, new Function<TreeItem<Pair<AbstractUrl,String>>, AbstractUrl>() {
      @Override
      public AbstractUrl fun(TreeItem<Pair<AbstractUrl, String>> item) {
        return item.getData().getFirst();
      }
    }));
  for (AbstractTreeNode node : nodes) {
    final Pair<AbstractUrl, String> pair = createPairForNode(node);
    if (pair != null) {
      if (set.contains(pair.getFirst())) continue;
      final TreeItem<Pair<AbstractUrl, String>> treeItem = new TreeItem<Pair<AbstractUrl, String>>(pair);
      list.add(treeItem);
      set.add(pair.getFirst());
      appendChildNodes(node, treeItem);
    }
  }
  rootsChanged();
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:FavoritesManager.java

示例2: canAddRoots

import com.intellij.util.TreeItem; //导入依赖的package包/类
public boolean canAddRoots(@NotNull String name, @NotNull Collection<AbstractTreeNode> nodes) {
  final Collection<TreeItem<Pair<AbstractUrl, String>>> list = getFavoritesListRootUrls(name);

  final HashSet<AbstractUrl> set =
    new HashSet<AbstractUrl>(ContainerUtil.map(list, new Function<TreeItem<Pair<AbstractUrl,String>>, AbstractUrl>() {
      @Override
      public AbstractUrl fun(TreeItem<Pair<AbstractUrl, String>> item) {
        return item.getData().getFirst();
      }
    }));
  for (AbstractTreeNode node : nodes) {
    final Pair<AbstractUrl, String> pair = createPairForNode(node);
    if (pair != null && !set.contains(pair.getFirst())) return true;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:FavoritesManager.java

示例3: createTreeOn

import com.intellij.util.TreeItem; //导入依赖的package包/类
public List<TreeItem<VcsFileRevision>> createTreeOn(List<VcsFileRevision> allRevisions) {
  Collections.sort(allRevisions, VcsFileRevisionComparator.INSTANCE);

  final List<TreeItem<VcsFileRevision>> result = new ArrayList<TreeItem<VcsFileRevision>>();

  TreeItem<VcsFileRevision> prevRevision = null;
  for (final VcsFileRevision sortedRevision : allRevisions) {
    final CvsFileRevisionImpl cvsFileRevision = (CvsFileRevisionImpl)sortedRevision;
    final TreeItem<VcsFileRevision> treeItem = new TreeItem<VcsFileRevision>(cvsFileRevision);
    final TreeItem<VcsFileRevision> commonParent = getCommonParent(prevRevision, treeItem);
    if (commonParent != null) {
      commonParent.addChild(treeItem);
    }
    else {
      result.add(treeItem);
    }
    prevRevision = treeItem;
  }

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:CvsHistoryProvider.java

示例4: addRoots

import com.intellij.util.TreeItem; //导入依赖的package包/类
public boolean addRoots(final String name, final Collection<AbstractTreeNode> nodes) {
  final Collection<TreeItem<Pair<AbstractUrl, String>>> list = getFavoritesListRootUrls(name);

  final HashSet<AbstractUrl> set =
    new HashSet<AbstractUrl>(ObjectsConvertor.convert(list, new Convertor<TreeItem<Pair<AbstractUrl, String>>, AbstractUrl>() {
      @Override
      public AbstractUrl convert(TreeItem<Pair<AbstractUrl, String>> o) {
        return o.getData().getFirst();
      }
    }));
  for (AbstractTreeNode node : nodes) {
    final Pair<AbstractUrl, String> pair = createPairForNode(node);
    if (pair != null) {
      if (set.contains(pair.getFirst())) continue;
      final TreeItem<Pair<AbstractUrl, String>> treeItem = new TreeItem<Pair<AbstractUrl, String>>(pair);
      list.add(treeItem);
      set.add(pair.getFirst());
      appendChildNodes(node, treeItem);
    }
  }
  rootsChanged();
  return true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:FavoritesManager.java

示例5: renameFavoritesList

import com.intellij.util.TreeItem; //导入依赖的package包/类
private boolean renameFavoritesList(@NotNull String oldName, @NotNull String newName) {
  List<TreeItem<Pair<AbstractUrl, String>>> list = myName2FavoritesRoots.remove(oldName);
  if (list != null && newName.length() > 0) {
    int index = myListOrder.indexOf(oldName);
    if (index == -1) {
      index = myListOrder.size();
    }
    myListOrder.set(index, newName);
    myName2FavoritesRoots.put(newName, list);
    String description = myDescriptions.remove(oldName);
    if (description != null) {
      myDescriptions.put(newName, description);
    }
    rootsChanged();
    return true;
  }
  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:FavoritesManager.java

示例6: addRoots

import com.intellij.util.TreeItem; //导入依赖的package包/类
public boolean addRoots(final String name, final Collection<AbstractTreeNode> nodes) {
  final Collection<TreeItem<Pair<AbstractUrl, String>>> list = getFavoritesListRootUrls(name);

  final HashSet<AbstractUrl> set = new HashSet<AbstractUrl>(ContainerUtil.map(list, new Function<TreeItem<Pair<AbstractUrl, String>>, AbstractUrl>() {
    @Override
    public AbstractUrl fun(TreeItem<Pair<AbstractUrl, String>> item) {
      return item.getData().getFirst();
    }
  }));
  for (AbstractTreeNode node : nodes) {
    final Pair<AbstractUrl, String> pair = createPairForNode(node);
    if (pair != null) {
      if (set.contains(pair.getFirst())) continue;
      final TreeItem<Pair<AbstractUrl, String>> treeItem = new TreeItem<Pair<AbstractUrl, String>>(pair);
      list.add(treeItem);
      set.add(pair.getFirst());
      appendChildNodes(node, treeItem);
    }
  }
  rootsChanged();
  return true;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:FavoritesManager.java

示例7: renameFavoritesList

import com.intellij.util.TreeItem; //导入依赖的package包/类
private boolean renameFavoritesList(@Nonnull String oldName, @Nonnull String newName) {
  List<TreeItem<Pair<AbstractUrl, String>>> list = myName2FavoritesRoots.remove(oldName);
  if (list != null && newName.length() > 0) {
    int index = myListOrder.indexOf(oldName);
    if (index == -1) {
      index = myListOrder.size();
    }
    myListOrder.set(index, newName);
    myName2FavoritesRoots.put(newName, list);
    String description = myDescriptions.remove(oldName);
    if (description != null) {
      myDescriptions.put(newName, description);
    }
    rootsChanged();
    return true;
  }
  return false;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:FavoritesManager.java

示例8: showTreePopup

import com.intellij.util.TreeItem; //导入依赖的package包/类
private static void showTreePopup(final List<TreeItem<VcsFileRevision>> roots, final VirtualFile file, final Project project, final DiffProvider diffProvider) {
  final TreeTableView treeTable = new TreeTableView(new ListTreeTableModelOnColumns(new TreeNodeAdapter(null, null, roots),
                                                                                    new ColumnInfo[]{BRANCH_COLUMN, REVISION_COLUMN,
                                                                                    DATE_COLUMN, AUTHOR_COLUMN}));
  Runnable runnable = new Runnable() {
    @Override
    public void run() {
      int index = treeTable.getSelectionModel().getMinSelectionIndex();
      if (index == -1) {
        return;
      }
      VcsFileRevision revision = getRevisionAt(treeTable, index);
      if (revision != null) {
        DiffActionExecutor.showDiff(diffProvider, revision.getRevisionNumber(), file, project, VcsBackgroundableActions.COMPARE_WITH);
      }
    }
  };

  treeTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

  new PopupChooserBuilder(treeTable).
    setTitle(VcsBundle.message("lookup.title.vcs.file.revisions")).
    setItemChoosenCallback(runnable).
    setSouthComponent(createCommentsPanel(treeTable)).
    setResizable(true).
    setDimensionServiceKey("Vcs.CompareWithSelectedRevision.Popup").
    createPopup().
    showCenteredInCurrentWindow(project);

  final int lastRow = treeTable.getRowCount() - 1;
  if (lastRow < 0) return;
  treeTable.getSelectionModel().addSelectionInterval(lastRow, lastRow);
  treeTable.scrollRectToVisible(treeTable.getCellRect(lastRow, 0, true));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:CompareWithSelectedRevisionAction.java

示例9: 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

示例10: appendChildNodes

import com.intellij.util.TreeItem; //导入依赖的package包/类
private void appendChildNodes(AbstractTreeNode node, TreeItem<Pair<AbstractUrl, String>> treeItem) {
  final Collection<? extends AbstractTreeNode> children = node.getChildren();
  for (AbstractTreeNode child : children) {
    final TreeItem<Pair<AbstractUrl, String>> childTreeItem = new TreeItem<Pair<AbstractUrl, String>>(createPairForNode(child));
    treeItem.addChild(childTreeItem);
    appendChildNodes(child, childTreeItem);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:FavoritesManager.java

示例11: 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

示例12: findNextItem

import com.intellij.util.TreeItem; //导入依赖的package包/类
private TreeItem<Pair<AbstractUrl, String>> findNextItem(AbstractUrl url, Collection<TreeItem<Pair<AbstractUrl, String>>> list) {
  for (TreeItem<Pair<AbstractUrl, String>> pair : list) {
    if (url.equals(pair.getData().getFirst())) {
      return pair;
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:FavoritesManager.java

示例13: renameFavoritesList

import com.intellij.util.TreeItem; //导入依赖的package包/类
private boolean renameFavoritesList(@NotNull String oldName, @NotNull String newName) {
  List<TreeItem<Pair<AbstractUrl, String>>> list = myName2FavoritesRoots.remove(oldName);
  if (list != null && newName.length() > 0) {
    myName2FavoritesRoots.put(newName, list);
    String description = myDescriptions.remove(oldName);
    if (description != null) {
      myDescriptions.put(newName, description);
    }
    rootsChanged();
    return true;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:FavoritesManager.java

示例14: readExternal

import com.intellij.util.TreeItem; //导入依赖的package包/类
@Override
public void readExternal(Element element) throws InvalidDataException {
  myName2FavoritesRoots.clear();
  for (Object list : element.getChildren(ELEMENT_FAVORITES_LIST)) {
    final String name = ((Element)list).getAttributeValue(ATTRIBUTE_NAME);
    List<TreeItem<Pair<AbstractUrl, String>>> roots = readRoots((Element)list, myProject);
    myName2FavoritesRoots.put(name, roots);
  }
  DefaultJDOMExternalizer.readExternal(this, element);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:FavoritesManager.java

示例15: readFavoritesOneLevel

import com.intellij.util.TreeItem; //导入依赖的package包/类
private static void readFavoritesOneLevel(Element list, Project project, Collection<TreeItem<Pair<AbstractUrl, String>>> result) {
  final List listChildren = list.getChildren(FAVORITES_ROOT);
  if (listChildren == null || listChildren.isEmpty()) return;

  for (Object favorite : listChildren) {
    final Element favoriteElement = (Element)favorite;
    final String className = favoriteElement.getAttributeValue(CLASS_NAME);
    final AbstractUrl abstractUrl = readUrlFromElement(favoriteElement, project);
    if (abstractUrl != null) {
      final TreeItem<Pair<AbstractUrl, String>> treeItem = new TreeItem<Pair<AbstractUrl, String>>(Pair.create(abstractUrl, className));
      result.add(treeItem);
      readFavoritesOneLevel(favoriteElement, project, treeItem.getChildren());
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:FavoritesManager.java


注:本文中的com.intellij.util.TreeItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。