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


Java NodeDescriptor.getElement方法代码示例

本文整理汇总了Java中com.intellij.ide.util.treeView.NodeDescriptor.getElement方法的典型用法代码示例。如果您正苦于以下问题:Java NodeDescriptor.getElement方法的具体用法?Java NodeDescriptor.getElement怎么用?Java NodeDescriptor.getElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.ide.util.treeView.NodeDescriptor的用法示例。


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

示例1: forNodeDescriptorInTree

import com.intellij.ide.util.treeView.NodeDescriptor; //导入方法依赖的package包/类
public static CellAppearanceEx forNodeDescriptorInTree(Object node, boolean expanded) {
  NodeDescriptor descriptor = getNodeDescriptor(node);
  if (descriptor == null) return FileAppearanceService.getInstance().empty();
  String name = descriptor.toString();
  Object psiElement = descriptor.getElement();
  ModifiableCellAppearanceEx result;
  if (psiElement instanceof PsiElement && !((PsiElement)psiElement).isValid()) {
    result = CompositeAppearance.single(name);
  }
  else {
    PsiClass psiClass = getContainingClass(psiElement);
    if (isInheritedMember(node, psiClass) && psiClass != null) {
      CompositeAppearance.DequeEnd ending = new CompositeAppearance().getEnding();
      ending.addText(name, applyDeprecation(psiElement, SimpleTextAttributes.DARK_TEXT));
      ending.addComment(psiClass.getName(), applyDeprecation(psiClass, SimpleTextAttributes.GRAY_ATTRIBUTES));
      result = ending.getAppearance();
    }
    else {
      SimpleTextAttributes textAttributes = applyDeprecation(psiElement, SimpleTextAttributes.REGULAR_ATTRIBUTES);
      result = CompositeAppearance.single(name, textAttributes);
    }
  }

  result.setIcon(descriptor.getIcon());
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:StructureNodeRenderer.java

示例2: customize

import com.intellij.ide.util.treeView.NodeDescriptor; //导入方法依赖的package包/类
private boolean customize(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
  if (!(value instanceof DefaultMutableTreeNode)) {
    return false;
  }
  final DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
  final Object userObject = node.getUserObject();
  if (!(userObject instanceof NodeDescriptor)) {
    return false;
  }
  final NodeDescriptor descriptor = (NodeDescriptor)userObject;
  final Object element = descriptor.getElement();
  if (!(element instanceof FileElement)) {
    return false;
  }
  final FileElement fileElement = (FileElement)element;
  if (!isExcluded(fileElement)) {
    return false;
  }
  setIcon(IconLoader.getDisabledIcon(descriptor.getIcon()));
  final String text = tree.convertValueToText(value, selected, expanded, leaf, row, hasFocus);
  append(text, new SimpleTextAttributes(SimpleTextAttributes.STYLE_STRIKEOUT, tree.getForeground()));
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ImportTree.java

示例3: isAutoExpandNode

import com.intellij.ide.util.treeView.NodeDescriptor; //导入方法依赖的package包/类
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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:SMTRunnerTreeBuilder.java

示例4: isAlwaysShowPlus

import com.intellij.ide.util.treeView.NodeDescriptor; //导入方法依赖的package包/类
@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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:FileTreeBuilder.java

示例5: isAutoExpandNode

import com.intellij.ide.util.treeView.NodeDescriptor; //导入方法依赖的package包/类
@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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:FileTreeBuilder.java

示例6: isAlwaysShowPlus

import com.intellij.ide.util.treeView.NodeDescriptor; //导入方法依赖的package包/类
protected boolean isAlwaysShowPlus(NodeDescriptor nodeDescriptor) {
  final ErrorTreeElement element = (ErrorTreeElement)nodeDescriptor.getElement();
  if (element instanceof GroupingElement) {
    return ((ErrorViewStructure)getTreeStructure()).getChildCount((GroupingElement)element) > 0;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ErrorViewTreeBuilder.java

示例7: goUp

import com.intellij.ide.util.treeView.NodeDescriptor; //导入方法依赖的package包/类
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();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:AbstractListBuilder.java

示例8: isAutoExpandNode

import com.intellij.ide.util.treeView.NodeDescriptor; //导入方法依赖的package包/类
@Override
protected final boolean isAutoExpandNode(NodeDescriptor nodeDescriptor) {
  StructureViewModel model = myStructureModel;
  if (model instanceof TreeModelWrapper) {
    model = ((TreeModelWrapper) model).getModel();
  }
  if (model instanceof StructureViewModel.ExpandInfoProvider) {
    StructureViewModel.ExpandInfoProvider provider = (StructureViewModel.ExpandInfoProvider)model;
    Object element = nodeDescriptor.getElement();
    if (element instanceof StructureViewComponent.StructureViewTreeElementWrapper) {
      StructureViewComponent.StructureViewTreeElementWrapper wrapper = (StructureViewComponent.StructureViewTreeElementWrapper)element;
      if (wrapper.getValue() instanceof StructureViewTreeElement) {
        final StructureViewTreeElement value = (StructureViewTreeElement)wrapper.getValue();
        if (value != null) {
          return provider.isAutoExpand(value);
        }
      }
    } else if (element instanceof GroupWrapper) {
      final Group group = ((GroupWrapper)element).getValue();
      for (TreeElement treeElement : group.getChildren()) {
        if (treeElement instanceof StructureViewTreeElement && !provider.isAutoExpand((StructureViewTreeElement)treeElement)) {
          return false;
        }
      }
    }
  }
  // expand root node & its immediate children
  final NodeDescriptor parent = nodeDescriptor.getParentDescriptor();
  return super.isAutoExpandNode(parent == null ? nodeDescriptor : parent);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:StructureTreeBuilder.java

示例9: isAutoExpandNode

import com.intellij.ide.util.treeView.NodeDescriptor; //导入方法依赖的package包/类
@Override
boolean isAutoExpandNode(NodeDescriptor descriptor){
  Object element=descriptor.getElement();
  if(element==myFile){
    return true;
  }else{
    return super.isAutoExpandNode(descriptor);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:CurrentFileTodosTreeStructure.java

示例10: expandNodeChildren

import com.intellij.ide.util.treeView.NodeDescriptor; //导入方法依赖的package包/类
@Override
protected final void expandNodeChildren(@NotNull final DefaultMutableTreeNode node) {
  final NodeDescriptor userObject = (NodeDescriptor)node.getUserObject();
  if (userObject == null) return;
  Object element = userObject.getElement();
  VirtualFile virtualFile = getFileToRefresh(element);
  super.expandNodeChildren(node);
  if (virtualFile != null) {
    virtualFile.refresh(true, false);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:BaseProjectTreeBuilder.java

示例11: MyNodeDescriptor

import com.intellij.ide.util.treeView.NodeDescriptor; //导入方法依赖的package包/类
public MyNodeDescriptor(NodeDescriptor<PsiFileNode> nodeDescriptor) {
  super(nodeDescriptor.getProject(), null);
  myName = nodeDescriptor.toString();
  setIcon(LayeredIcon.create(nodeDescriptor.getIcon(), XpathIcons.Association_small));
  myColor = nodeDescriptor.getColor();
  myNode = nodeDescriptor.getElement();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:AssociationsEditor.java

示例12: getElement

import com.intellij.ide.util.treeView.NodeDescriptor; //导入方法依赖的package包/类
private static Object getElement(Object node) {
  NodeDescriptor descriptor = getNodeDescriptor(node);
  return descriptor == null ? null : descriptor.getElement();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:StructureNodeRenderer.java

示例13: isAutoExpandNode

import com.intellij.ide.util.treeView.NodeDescriptor; //导入方法依赖的package包/类
@Override
protected boolean isAutoExpandNode(NodeDescriptor nodeDescriptor) {
  final Object element = nodeDescriptor.getElement();
  final Object rootElement = getTreeStructure().getRootElement();
  return rootElement.equals(element) || element instanceof OrderRootTypeElement || element instanceof ItemElement;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:LibraryTableTreeBuilder.java

示例14: isAutoExpandNode

import com.intellij.ide.util.treeView.NodeDescriptor; //导入方法依赖的package包/类
protected boolean isAutoExpandNode(NodeDescriptor nodeDescriptor) {
  return nodeDescriptor.getParentDescriptor() == null || nodeDescriptor.getElement() instanceof GroupingElement;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:ErrorViewTreeBuilder.java

示例15: isAutoExpandNode

import com.intellij.ide.util.treeView.NodeDescriptor; //导入方法依赖的package包/类
boolean isAutoExpandNode(NodeDescriptor descriptor){
  Object element=descriptor.getElement();
  return element == getRootElement() || element == mySummaryElement;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:TodoTreeStructure.java


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