Java Code Examples for com.intellij.ide.util.treeView.NodeDescriptor#getElement()

The following examples show how to use com.intellij.ide.util.treeView.NodeDescriptor#getElement() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SMTRunnerTreeBuilder.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
protected boolean isAutoExpandNode(final NodeDescriptor nodeDescriptor) {
  final AbstractTreeStructure treeStructure = getTreeStructure();
  final Object rootElement = treeStructure.getRootElement();
  final Object nodeElement = nodeDescriptor.getElement();

  if (nodeElement == rootElement) {
    return true;
  }

  if (((SMTestProxy)nodeElement).getParent() == rootElement
      && ((SMTestProxy)rootElement).getChildren().size() == 1) {
    return true;
  }
  return false;
}
 
Example 2
Source File: FileTreeBuilder.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean isAlwaysShowPlus(NodeDescriptor nodeDescriptor) {
  Object element = nodeDescriptor.getElement();
  if (element != null) {
    FileElement descriptor = (FileElement)element;
    VirtualFile file = descriptor.getFile();
    if (file != null) {
      if (myChooserDescriptor.isChooseJarContents() && FileElement.isArchive(file)) {
        return true;
      }
      return file.isDirectory();
    }
  }
  return true;
}
 
Example 3
Source File: FileTreeBuilder.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean isAutoExpandNode(NodeDescriptor nodeDescriptor) {
  if (nodeDescriptor.getElement() instanceof RootFileElement) {
    return true;
  }
  else if (!SystemInfo.isWindows) {
    NodeDescriptor parent = nodeDescriptor.getParentDescriptor();
    return parent != null && parent.getElement() instanceof RootFileElement;
  }

  return false;
}
 
Example 4
Source File: ErrorViewTreeBuilder.java    From consulo with Apache License 2.0 5 votes vote down vote up
protected boolean isAlwaysShowPlus(NodeDescriptor nodeDescriptor) {
  final ErrorTreeElement element = (ErrorTreeElement)nodeDescriptor.getElement();
  if (element instanceof GroupingElement) {
    return ((ErrorViewStructure)getTreeStructure()).getChildCount((GroupingElement)element) > 0;
  }
  return false;
}
 
Example 5
Source File: AbstractListBuilder.java    From consulo with Apache License 2.0 5 votes vote down vote up
public final void goUp() {
  if (myCurrentParent == myShownRoot.getParent()) {
    return;
  }
  final AbstractTreeNode element = myCurrentParent.getParent();
  if (element == null) {
    return;
  }

  try {
    AbstractTreeNode oldParent = myCurrentParent;

    buildList(element);

    for (int i = 0; i < myModel.getSize(); i++) {
      if (myModel.getElementAt(i) instanceof NodeDescriptor) {
        final NodeDescriptor desc = (NodeDescriptor)myModel.getElementAt(i);
        final Object elem = desc.getElement();
        if (oldParent.equals(elem)) {
          selectItem(i);
          break;
        }
      }
    }
  }
  finally {
    updateParentTitle();
  }
}
 
Example 6
Source File: CurrentFileTodosTreeStructure.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
boolean isAutoExpandNode(NodeDescriptor descriptor) {
  Object element = descriptor.getElement();
  if (element instanceof AbstractTreeNode) {
    element = ((AbstractTreeNode)element).getValue();
  }
  if (element == myFile) {
    return true;
  }
  else {
    return element == getRootElement() || element == mySummaryElement;
  }
}
 
Example 7
Source File: TodoTreeStructure.java    From consulo with Apache License 2.0 5 votes vote down vote up
boolean isAutoExpandNode(NodeDescriptor descriptor) {
  Object element = descriptor.getElement();
  if (element instanceof AbstractTreeNode) {
    element = ((AbstractTreeNode)element).getValue();
  }
  return element == getRootElement() || element == mySummaryElement && (myAreModulesShown || myArePackagesShown);
}
 
Example 8
Source File: StructureTreeModel.java    From consulo with Apache License 2.0 4 votes vote down vote up
private Object getElement() {
  NodeDescriptor descriptor = getDescriptor();
  return descriptor == null ? null : descriptor.getElement();
}
 
Example 9
Source File: ErrorViewTreeBuilder.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected boolean isAutoExpandNode(NodeDescriptor nodeDescriptor) {
  return nodeDescriptor.getParentDescriptor() == null || nodeDescriptor.getElement() instanceof GroupingElement;
}
 
Example 10
Source File: LibraryTableTreeBuilder.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
protected boolean isAutoExpandNode(NodeDescriptor nodeDescriptor) {
  final Object element = nodeDescriptor.getElement();
  final Object rootElement = getTreeStructure().getRootElement();
  return rootElement.equals(element) || element instanceof OrderRootTypeElement;
}