本文整理汇总了Java中com.intellij.ide.util.treeView.AbstractTreeNode.setParent方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractTreeNode.setParent方法的具体用法?Java AbstractTreeNode.setParent怎么用?Java AbstractTreeNode.setParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ide.util.treeView.AbstractTreeNode
的用法示例。
在下文中一共展示了AbstractTreeNode.setParent方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: replicate
import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
private void replicate(DefaultMutableTreeNode source, AbstractTreeNode destination, final List<AbstractTreeNode<Object>> destinationChildren) {
final ArrayList<AbstractTreeNode<Object>> copyChildren = new ArrayList<AbstractTreeNode<Object>>();
AbstractTreeNode<Object> copy = new AbstractTreeNode<Object>(myProject, source.getUserObject()) {
@NotNull
@Override
public Collection<? extends AbstractTreeNode> getChildren() {
return copyChildren;
}
@Override
protected void update(PresentationData presentation) {
}
};
for (int i = 0; i < source.getChildCount(); i++) {
final TreeNode treeNode = source.getChildAt(i);
if (treeNode instanceof DefaultMutableTreeNode) {
final DefaultMutableTreeNode sourceChild = (DefaultMutableTreeNode)treeNode;
replicate(sourceChild, copy, copyChildren);
}
}
if (checkNavigatable(copy)) {
destinationChildren.add(copy);
copy.setParent(destination);
}
}
示例2: setChildren
import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
protected void setChildren(Collection<AbstractTreeNode> children) {
clearChildren();
for (AbstractTreeNode node : children) {
myChildren.add((CachingChildrenTreeNode)node);
node.setParent(this);
}
}
示例3: updateChildren
import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
private void updateChildren() {
if (myProject.isDisposed()) return;
myChildren.clear();
List<Bookmark> bookmarks = myBookmarkManager.getValidBookmarks();
for (final Bookmark bookmark : bookmarks) {
AbstractTreeNode<Bookmark> child = new AbstractTreeNode<Bookmark>(myProject, bookmark) {
@NotNull
@Override
public Collection<? extends AbstractTreeNode> getChildren() {
return Collections.emptyList();
}
@Override
public boolean canNavigate() {
return bookmark.canNavigate();
}
@Override
public boolean canNavigateToSource() {
return bookmark.canNavigateToSource();
}
@Override
public void navigate(boolean requestFocus) {
bookmark.navigate(requestFocus);
}
@Override
protected void update(PresentationData presentation) {
presentation.setPresentableText(bookmark.toString());
presentation.setIcon(bookmark.getIcon());
}
};
child.setParent(myNode);
myChildren.add(child);
}
myFavoritesManager.fireListeners(getListName(myProject));
}
示例4: traverseDepth
import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
private static boolean traverseDepth(final AbstractTreeNode node, final TreeUtil.Traverse traverse) {
if (!traverse.accept(node)) return false;
final Collection<? extends AbstractTreeNode> children = node.getChildren();
for (AbstractTreeNode child : children) {
child.setParent(node);
if (!traverseDepth(child, traverse)) return false;
}
return true;
}
示例5: processUrls
import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的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: getChildrenNodes
import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
@Override
public List<AbstractTreeNode> getChildrenNodes(AbstractTreeNode node) {
List<AbstractTreeNode> children = new ArrayList<AbstractTreeNode>();
if (node instanceof CoverageListNode) {
final Object val = node.getValue();
if (val instanceof PsiFile) return Collections.emptyList();
final PsiDirectory psiDirectory = (PsiDirectory)val;
final PsiDirectory[] subdirectories = ApplicationManager.getApplication().runReadAction(new Computable<PsiDirectory[]>() {
@Override
public PsiDirectory[] compute() {
return psiDirectory.getSubdirectories();
}
});
for (PsiDirectory subdirectory : subdirectories) {
children.add(new CoverageListNode(myProject, subdirectory, mySuitesBundle, myStateBean));
}
final PsiFile[] psiFiles = ApplicationManager.getApplication().runReadAction(new Computable<PsiFile[]>() {
@Override
public PsiFile[] compute() {
return psiDirectory.getFiles();
}
});
for (PsiFile psiFile : psiFiles) {
children.add(new CoverageListNode(myProject, psiFile, mySuitesBundle, myStateBean));
}
for (AbstractTreeNode childNode : children) {
childNode.setParent(node);
}
}
return children;
}
示例7: getTopLevelPackages
import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
private List<AbstractTreeNode> getTopLevelPackages(CoverageSuitesBundle bundle, CoverageViewManager.StateBean stateBean, Project project) {
if (myTopLevelPackages == null) {
myTopLevelPackages = bundle.getCoverageEngine().createCoverageViewExtension(project, bundle, stateBean).createTopLevelNodes();
for (AbstractTreeNode abstractTreeNode : myTopLevelPackages) {
abstractTreeNode.setParent(this);
}
}
return myTopLevelPackages;
}
示例8: addChild
import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
public void addChild(final AbstractTreeNode node) {
myChildren.add(node);
node.setParent(this);
}
示例9: getChildrenNodes
import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
@Override
public List<AbstractTreeNode> getChildrenNodes(final AbstractTreeNode node) {
List<AbstractTreeNode> children = new ArrayList<AbstractTreeNode>();
if (node instanceof CoverageListNode) {
final Object val = node.getValue();
if (val instanceof PsiClass) return Collections.emptyList();
//append package classes
if (val instanceof PsiPackage) {
final PsiPackage psiPackage = (PsiPackage) val;
if (ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
public Boolean compute() {
return isInCoverageScope(psiPackage);
}
})) {
final PsiPackage[] subPackages = ApplicationManager.getApplication().runReadAction(new Computable<PsiPackage[]>() {
public PsiPackage[] compute() {
return psiPackage.isValid()
? psiPackage.getSubPackages(mySuitesBundle.getSearchScope(node.getProject()))
: PsiPackage.EMPTY_ARRAY;
}
});
for (PsiPackage subPackage: subPackages) {
processSubPackage(subPackage, children);
}
final PsiFile[] childFiles = ApplicationManager.getApplication().runReadAction(new Computable<PsiFile[]>() {
public PsiFile[] compute() {
return psiPackage.isValid()
? psiPackage.getFiles(mySuitesBundle.getSearchScope(node.getProject()))
: PsiFile.EMPTY_ARRAY;
}
});
for (final PsiFile file : childFiles) {
collectFileChildren(file, node, children);
}
}
else if (!myStateBean.myFlattenPackages) {
collectSubPackages(children, (PsiPackage)val);
}
}
if (node instanceof CoverageListRootNode) {
for (CoverageSuite suite : mySuitesBundle.getSuites()) {
final List<PsiClass> classes = ((JavaCoverageSuite)suite).getCurrentSuiteClasses(myProject);
for (PsiClass aClass : classes) {
children.add(new CoverageListNode(myProject, aClass, mySuitesBundle, myStateBean));
}
}
}
for (AbstractTreeNode childNode : children) {
childNode.setParent(node);
}
}
return children;
}