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


Java NodeDescriptor类代码示例

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


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

示例1: JavaCallHierarchyData

import com.intellij.ide.util.treeView.NodeDescriptor; //导入依赖的package包/类
public JavaCallHierarchyData(PsiClass originalClass,
                             PsiMethod methodToFind,
                             PsiClassType originalType,
                             PsiMethod method,
                             Set<PsiMethod> methodsToFind,
                             NodeDescriptor nodeDescriptor,
                             Map<PsiMember, NodeDescriptor> resultMap,
                             Project project) {

  myOriginalClass = originalClass;
  myMethodToFind = methodToFind;
  myOriginalType = originalType;
  myMethod = method;
  myMethodsToFind = methodsToFind;
  myNodeDescriptor = nodeDescriptor;
  myResultMap = resultMap;
  myProject = project;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:JavaCallHierarchyData.java

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

示例3: getSelectedElements

import com.intellij.ide.util.treeView.NodeDescriptor; //导入依赖的package包/类
public <T> List<T> getSelectedElements(Class<? extends T> elementClass) {
  final TreePath[] paths = getSelectionPaths();
  if (paths == null) {
    return Collections.emptyList();
  }
  final ArrayList<T> result = new ArrayList<T>(paths.length);
  for (TreePath path : paths) {
    final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
    Object userObject = node.getUserObject();
    if (userObject instanceof NodeDescriptor && elementClass.isInstance(((NodeDescriptor) userObject).getElement())) {
      //noinspection unchecked
      result.add((T)((NodeDescriptor) node.getUserObject()).getElement());
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ComponentTree.java

示例4: updatePreviewPanel

import com.intellij.ide.util.treeView.NodeDescriptor; //导入依赖的package包/类
private void updatePreviewPanel() {
  if (myProject.isDisposed()) return;
  List<UsageInfo> infos = new ArrayList<UsageInfo>();
  final TreePath path = myTree.getSelectionPath();
  if (path != null) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
    Object userObject = node.getUserObject();
    if (userObject instanceof NodeDescriptor) {
      Object element = ((NodeDescriptor)userObject).getElement();
      TodoItemNode pointer = myTodoTreeBuilder.getFirstPointerForElement(element);
      if (pointer != null) {
        final SmartTodoItemPointer value = pointer.getValue();
        final Document document = value.getDocument();
        final PsiFile psiFile = PsiDocumentManager.getInstance(myProject).getPsiFile(document);
        final RangeMarker rangeMarker = value.getRangeMarker();
        if (psiFile != null) {
          infos.add(new UsageInfo(psiFile, rangeMarker.getStartOffset(), rangeMarker.getEndOffset()));
        }
      }
    }
  }
  myUsagePreviewPanel.updateLayout(infos.isEmpty() ? null : infos);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:TodoPanel.java

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

示例6: getSelectedNodeElement

import com.intellij.ide.util.treeView.NodeDescriptor; //导入依赖的package包/类
@Nullable
private Object getSelectedNodeElement() {
  final AbstractProjectViewPane currentProjectViewPane = getCurrentProjectViewPane();
  if (currentProjectViewPane == null) { // can happen if not initialized yet
    return null;
  }
  DefaultMutableTreeNode node = currentProjectViewPane.getSelectedNode();
  if (node == null) {
    return null;
  }
  Object userObject = node.getUserObject();
  if (userObject instanceof AbstractTreeNode) {
    return ((AbstractTreeNode)userObject).getValue();
  }
  if (!(userObject instanceof NodeDescriptor)) {
    return null;
  }
  return ((NodeDescriptor)userObject).getElement();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ProjectViewImpl.java

示例7: getTableCellRendererComponent

import com.intellij.ide.util.treeView.NodeDescriptor; //导入依赖的package包/类
@Override
public Component getTableCellRendererComponent(JTable table,
                                               Object value,
                                               boolean isSelected,
                                               boolean hasFocus,
                                               int row,
                                               int column) {
  final Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
  if (value instanceof NodeDescriptor) {
    NodeDescriptor descriptor = (NodeDescriptor)value;
    setIcon(descriptor.getIcon());
    setText(descriptor.toString());
    if (!isSelected) setForeground(((CoverageListNode)descriptor).getFileStatus().getColor());
  }
  return component;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CoverageView.java

示例8: customizeCellRenderer

import com.intellij.ide.util.treeView.NodeDescriptor; //导入依赖的package包/类
public void customizeCellRenderer(JTree tree,
                                  Object value,
                                  boolean selected,
                                  boolean expanded,
                                  boolean leaf,
                                  int row,
                                  boolean hasFocus) {
  final Object object = getObject(value);
  if (object instanceof PsiFile) {
    final PsiFile file = (PsiFile)object;
    final Object userObject = ((DefaultMutableTreeNode)value).getUserObject();
    if (myManager.getAssociationsFor(file).length > 0) {
      //noinspection unchecked
      myTemp.setUserObject(new MyNodeDescriptor((NodeDescriptor<PsiFileNode>)userObject));
      super.customizeCellRenderer(tree, myTemp, selected, expanded, leaf, row, hasFocus);
      return;
    }
  }
  super.customizeCellRenderer(tree, value, selected, expanded, leaf, row, hasFocus);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:AssociationsEditor.java

示例9: customizeCellRenderer

import com.intellij.ide.util.treeView.NodeDescriptor; //导入依赖的package包/类
@Override
public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
  super.customizeCellRenderer(tree, value, selected, expanded, leaf, row, hasFocus);

  final ContentEntryEditor editor = myTreeEditor.getContentEntryEditor();
  if (editor != null) {
    final Object userObject = ((DefaultMutableTreeNode)value).getUserObject();
    if (userObject instanceof NodeDescriptor) {
      final Object element = ((NodeDescriptor)userObject).getElement();
      if (element instanceof FileElement) {
        final VirtualFile file = ((FileElement)element).getFile();
        if (file != null && file.isDirectory()) {
          final ContentEntry contentEntry = editor.getContentEntry();
          if (contentEntry != null) {
            final String prefix = getPresentablePrefix(contentEntry, file);
            if (!prefix.isEmpty()) {
              append(" (" + prefix + ")", new SimpleTextAttributes(Font.PLAIN, JBColor.GRAY));
            }
            setIcon(updateIcon(contentEntry, file, getIcon()));
          }
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ContentEntryTreeCellRenderer.java

示例10: DisposerTree

import com.intellij.ide.util.treeView.NodeDescriptor; //导入依赖的package包/类
private DisposerTree(Disposable parent) {
  myModificationToFilter = -1;

  final DisposerStructure structure = new DisposerStructure(this);
  final DefaultTreeModel model = new DefaultTreeModel(new DefaultMutableTreeNode());
  final Tree tree = new Tree(model);
  tree.setRootVisible(false);
  tree.setShowsRootHandles(true);
  tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  myTreeBuilder = new FilteringTreeBuilder(tree, DisposerTree.this, structure, AlphaComparator.INSTANCE) {
    @Override
    public boolean isAutoExpandNode(NodeDescriptor nodeDescriptor) {
      return structure.getRootElement() == getOriginalNode(nodeDescriptor);
    }
  };
  myTreeBuilder.setFilteringMerge(200, MergingUpdateQueue.ANY_COMPONENT);
  Disposer.register(this, myTreeBuilder);
  myTree = tree;

  setLayout(new BorderLayout());
  add(ScrollPaneFactory.createScrollPane(myTree), BorderLayout.CENTER);

  Disposer.getTree().addListener(this);

  Disposer.register(parent, this);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:DisposerDebugger.java

示例11: getNextPointer

import com.intellij.ide.util.treeView.NodeDescriptor; //导入依赖的package包/类
@Nullable
private TodoItemNode getNextPointer() {
  TreePath path = myTree.getSelectionPath();
  if (path == null) {
    return null;
  }
  DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
  Object userObject = node.getUserObject();
  if (!(userObject instanceof NodeDescriptor)) {
    return null;
  }
  Object element = ((NodeDescriptor)userObject).getElement();
  TodoItemNode pointer;
  if (element instanceof TodoItemNode) {
    pointer = myTodoTreeBuilder.getNextPointer((TodoItemNode)element);
  }
  else {
    pointer = myTodoTreeBuilder.getFirstPointerForElement(element);
  }
  return pointer;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:TodoPanel.java

示例12: createDescriptor

import com.intellij.ide.util.treeView.NodeDescriptor; //导入依赖的package包/类
@Override
@NotNull
public AntNodeDescriptor createDescriptor(Object element, NodeDescriptor parentDescriptor) {
  if (element == myRoot) {
    return new RootNodeDescriptor(myProject, parentDescriptor);
  }
  
  if (element instanceof String) {
    return new TextInfoNodeDescriptor(myProject, parentDescriptor, (String)element);
  }
  
  if (element instanceof AntBuildFileBase) {
    return new AntBuildFileNodeDescriptor(myProject, parentDescriptor, (AntBuildFileBase)element);
  }
  
  if (element instanceof AntBuildTargetBase) {
    return new AntTargetNodeDescriptor(myProject, parentDescriptor, (AntBuildTargetBase)element);
  }
  
  LOG.error("Unknown element for this tree structure " + element);
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:AntExplorerTreeStructure.java

示例13: getComparator

import com.intellij.ide.util.treeView.NodeDescriptor; //导入依赖的package包/类
public static Comparator<NodeDescriptor> getComparator(Project project) {
  if (HierarchyBrowserManager.getInstance(project).getState().SORT_ALPHABETICALLY) {
    return AlphaComparator.INSTANCE;
  }
  else {
    return SourceComparator.INSTANCE;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:JavaHierarchyUtil.java

示例14: createDescriptor

import com.intellij.ide.util.treeView.NodeDescriptor; //导入依赖的package包/类
@NotNull
@Override
public NodeDescriptor createDescriptor(Object element, NodeDescriptor parentDescriptor) {
  if (element == myTreeRoot || element instanceof RadComponent) {
    TreeNodeDescriptor descriptor = new TreeNodeDescriptor(parentDescriptor, element);
    descriptor.setWasDeclaredAlwaysLeaf(isAlwaysLeaf(element));
    return descriptor;
  }
  throw new IllegalArgumentException("Unknown element: " + element);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:TreeContentProvider.java

示例15: hasPreviousOccurence

import com.intellij.ide.util.treeView.NodeDescriptor; //导入依赖的package包/类
@Override
public boolean hasPreviousOccurence() {
  TreePath path = myTree.getSelectionPath();
  if (path == null) {
    return false;
  }
  DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
  Object userObject = node.getUserObject();
  return userObject instanceof NodeDescriptor && !isFirst(node);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:TodoPanel.java


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