本文整理汇总了Java中com.intellij.ide.util.treeView.AbstractTreeNode.getParent方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractTreeNode.getParent方法的具体用法?Java AbstractTreeNode.getParent怎么用?Java AbstractTreeNode.getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ide.util.treeView.AbstractTreeNode
的用法示例。
在下文中一共展示了AbstractTreeNode.getParent方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLogicalIndexPathTo
import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
public static List<Integer> getLogicalIndexPathTo(TreePath selectionPath) {
final List<Integer> result = new ArrayList<Integer>();
final Object component = selectionPath.getLastPathComponent();
if (component instanceof DefaultMutableTreeNode) {
final Object uo = ((DefaultMutableTreeNode)component).getUserObject();
if (uo instanceof FavoritesTreeNodeDescriptor) {
AbstractTreeNode treeNode = ((FavoritesTreeNodeDescriptor)uo).getElement();
while ((!(treeNode instanceof FavoritesListNode)) && treeNode != null) {
// final int idx = getIndex(treeNode.getParent().getChildren(), treeNode);
// if (idx == -1) return null;
result.add(treeNode.getIndex());
treeNode = treeNode.getParent();
}
Collections.reverse(result);
return result;
}
}
return Collections.emptyList();
}
示例2: getLogicalPathTo
import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
public static List<AbstractTreeNode> getLogicalPathTo(List<AbstractTreeNode> result, TreePath selectionPath) {
final Object component = selectionPath.getLastPathComponent();
if (component instanceof DefaultMutableTreeNode) {
final Object uo = ((DefaultMutableTreeNode)component).getUserObject();
if (uo instanceof FavoritesTreeNodeDescriptor) {
AbstractTreeNode treeNode = ((FavoritesTreeNodeDescriptor)uo).getElement();
while ((!(treeNode instanceof FavoritesListNode)) && treeNode != null) {
result.add(treeNode);
treeNode = treeNode.getParent();
}
Collections.reverse(result);
return result;
}
}
return Collections.emptyList();
}
示例3: isParentGrouped
import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
private static boolean isParentGrouped(AbstractTreeNode parent) {
while (parent != null) {
if (parent.getValue() instanceof SuperTypeGroup) return true;
parent = parent.getParent();
}
return false;
}
示例4: selectElement
import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
public final void selectElement(final Object element, VirtualFile virtualFile) {
if (element == null) {
return;
}
try {
AbstractTreeNode node = goDownToElement(element, virtualFile);
if (node == null) return;
AbstractTreeNode parentElement = node.getParent();
if (parentElement == null) return;
buildList(parentElement);
for (int i = 0; i < myModel.getSize(); i++) {
if (myModel.getElementAt(i) instanceof AbstractTreeNode) {
final AbstractTreeNode desc = (AbstractTreeNode)myModel.getElementAt(i);
if (desc.getValue() instanceof StructureViewTreeElement) {
StructureViewTreeElement treeelement = (StructureViewTreeElement)desc.getValue();
if (element.equals(treeelement.getValue())) {
selectItem(i);
break;
}
}
else {
if (element.equals(desc.getValue())) {
selectItem(i);
break;
}
}
}
}
}
finally {
updateParentTitle();
}
}
示例5: extractParentList
import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
@Nullable
public static FavoritesListNode extractParentList(FavoritesTreeNodeDescriptor descriptor) {
final AbstractTreeNode node = descriptor.getElement();
AbstractTreeNode current = node;
while (current != null) {
if (current instanceof FavoritesListNode) {
return (FavoritesListNode)current;
}
current = current.getParent();
}
return null;
}
示例6: getProvider
import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
static FavoritesListProvider getProvider(@NotNull FavoritesManager manager, @NotNull FavoritesTreeNodeDescriptor descriptor) {
AbstractTreeNode treeNode = descriptor.getElement();
while (treeNode != null && (!(treeNode instanceof FavoritesListNode))) {
treeNode = treeNode.getParent();
}
if (treeNode != null) {
final String name = ((FavoritesListNode)treeNode).getValue();
return manager.getListProvider(name);
}
return null;
}
示例7: getDeep
import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
private static int getDeep(AbstractTreeNode node) {
int result = 0;
while (node != null) {
node = node.getParent();
result++;
}
return result;
}
示例8: getPathToUsualNode
import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
public static List<AbstractTreeNode> getPathToUsualNode(final AbstractTreeNode treeNode) {
final List<AbstractTreeNode> result = new ArrayList<AbstractTreeNode>();
AbstractTreeNode current = treeNode;
while (current != null && (!(current instanceof FavoritesRootNode))) {
result.add(current);
current = current.getParent();
}
Collections.reverse(result);
return result;
}
示例9: topElementIsSelected
import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
private boolean topElementIsSelected(final CoverageViewTreeStructure treeStructure) {
if (myTable == null) return false;
if (myModel.getSize() >= 1) {
final AbstractTreeNode rootElement = (AbstractTreeNode)treeStructure.getRootElement();
final AbstractTreeNode node = (AbstractTreeNode)myModel.getElementAt(0);
if (node.getParent() == rootElement) {
return true;
}
}
return false;
}