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


Java ProjectViewNode类代码示例

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


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

示例1: contains

import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
@Override
public boolean contains(@NotNull final VirtualFile file) {
    for (AbstractTreeNode abstractTreeNode : this.getValue()) {
        if (abstractTreeNode instanceof ProjectViewNode) {
            final ProjectViewNode projectViewNode = (ProjectViewNode) abstractTreeNode;

            if (null == projectViewNode.getVirtualFile()) {
                continue;
            }

            if (projectViewNode.getVirtualFile().equals(file)) {
                return true;
            }

            if (file.getPath().startsWith(projectViewNode.getVirtualFile().getPath())) {
                return true;
            }
        }
    }

    return false;
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:23,代码来源:JunkProjectViewNode.java

示例2: checkContainsMethod

import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
public static void checkContainsMethod(final Object rootElement,
                                       final AbstractTreeStructure structure,
                                       Function<AbstractTreeNode, VirtualFile[]> converterFunction) {
  MultiValuesMap<VirtualFile, AbstractTreeNode> map = new MultiValuesMap<VirtualFile, AbstractTreeNode>();
  collect((AbstractTreeNode)rootElement, map, structure, converterFunction);

  for (VirtualFile eachFile : map.keySet()) {
    Collection<AbstractTreeNode> nodes = map.values();
    for (final AbstractTreeNode node : nodes) {
      ProjectViewNode eachNode = (ProjectViewNode)node;
      boolean actual = eachNode.contains(eachFile);
      boolean expected = map.get(eachFile).contains(eachNode);
      if (actual != expected) {
        boolean actual1 = eachNode.contains(eachFile);
        boolean expected1 = map.get(eachFile).contains(eachNode);

        Assert.assertTrue("file=" + eachFile + " node=" + eachNode.getTestPresentation() + " expected:" + expected, false);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ProjectViewTestUtil.java

示例3: addPsiElementNode

import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
private static void addPsiElementNode(PsiElement psiElement,
                                      final Project project,
                                      final ArrayList<AbstractTreeNode> result,
                                      final ViewSettings favoritesConfig) {

  Class<? extends AbstractTreeNode> klass = getPsiElementNodeClass(psiElement);
  if (klass == null) {
    psiElement = PsiTreeUtil.getParentOfType(psiElement, PsiFile.class);
    if (psiElement != null) {
      klass = PsiFileNode.class;
    }
  }

  final Object value = psiElement;
  try {
    if (klass != null && value != null) {
      result.add(ProjectViewNode.createTreeNode(klass, project, value, favoritesConfig));
    }
  }
  catch (Exception e) {
    LOG.error(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:AddToFavoritesAction.java

示例4: compare

import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
@Override
public int compare(NodeDescriptor obj1, NodeDescriptor obj2){
  final int weight1 = obj1.getWeight();
  final int weight2 = obj2.getWeight();
  if (weight1 != weight2) return weight1 - weight2;
  if (obj1 instanceof ProjectViewNode && obj2 instanceof ProjectViewNode) {
    return ((ProjectViewNode)obj1).getTitle().compareToIgnoreCase(((ProjectViewNode)obj2).getTitle());
  }
  if (obj1 instanceof ModuleToDoNode && obj2 instanceof ModuleToDoNode){
    return ((ModuleToDoNode)obj1).getValue().getName().compareToIgnoreCase(((ModuleToDoNode)obj2).getValue().getName());
  } else if(obj1 instanceof ModuleToDoNode) {
    return -1;
  } else if(obj2 instanceof ModuleToDoNode) {
    return 1;
  } else{
    throw new IllegalArgumentException(obj1.getClass().getName()+","+obj2.getClass().getName());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:TodoFileDirAndModuleComparator.java

示例5: updateNodesContaining

import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
private void updateNodesContaining(@NotNull Collection<VirtualFile> filesToRefresh, @NotNull DefaultMutableTreeNode rootNode) {
  if (!(rootNode.getUserObject() instanceof ProjectViewNode)) return;
  ProjectViewNode node = (ProjectViewNode)rootNode.getUserObject();
  Collection<VirtualFile> containingFiles = null;
  for (VirtualFile virtualFile : filesToRefresh) {
    if (!virtualFile.isValid()) {
      addSubtreeToUpdate(rootNode); // file must be deleted
      return;
    }
    if (node.contains(virtualFile)) {
      if (containingFiles == null) containingFiles = new SmartList<VirtualFile>();
      containingFiles.add(virtualFile);
    }
  }
  if (containingFiles != null) {
    updateNode(rootNode);
    Enumeration children = rootNode.children();
    while (children.hasMoreElements()) {
      DefaultMutableTreeNode child = (DefaultMutableTreeNode)children.nextElement();
      updateNodesContaining(containingFiles, child);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ProjectTreeBuilder.java

示例6: addLibraryChildren

import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
public static void addLibraryChildren(final LibraryOrSdkOrderEntry entry, final List<AbstractTreeNode> children, Project project, ProjectViewNode node) {
  final PsiManager psiManager = PsiManager.getInstance(project);
  VirtualFile[] files =
    entry instanceof LibraryOrderEntry ? getLibraryRoots((LibraryOrderEntry)entry) : entry.getRootFiles(OrderRootType.CLASSES);
  for (final VirtualFile file : files) {
    if (!file.isValid()) continue;
    if (file.isDirectory()) {
      final PsiDirectory psiDir = psiManager.findDirectory(file);
      if (psiDir == null) {
        continue;
      }
      children.add(new PsiDirectoryNode(project, psiDir, node.getSettings()));
    }
    else {
      final PsiFile psiFile = psiManager.findFile(file);
      if (psiFile == null) continue;
      children.add(new PsiFileNode(project, psiFile, node.getSettings()));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:LibraryGroupNode.java

示例7: calcSelectedClass

import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
private PsiFile calcSelectedClass() {
  if (myTabbedPane.getSelectedIndex() == 1) {
    return (PsiFile)myGotoByNamePanel.getChosenElement();
  }
  else {
    final TreePath path = myTree.getSelectionPath();
    if (path == null) return null;
    final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
    final Object userObject = node.getUserObject();
    if (!(userObject instanceof ProjectViewNode)) return null;
    ProjectViewNode pvNode = (ProjectViewNode) userObject;
    VirtualFile vFile = pvNode.getVirtualFile();
    if (vFile != null && !vFile.isDirectory()) {
      return PsiManager.getInstance(myProject).findFile(vFile);
    }

    return null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:TreeFileChooserDialog.java

示例8: decorate

import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
@Override
public void decorate(ProjectViewNode node, PresentationData data) {
  if (!(node instanceof PsiDirectoryNode)) {
    return;
  }

  final PsiDirectoryNode psiDirectoryNode = (PsiDirectoryNode)node;
  PsiDirectory psiDirectory = psiDirectoryNode.getValue();

  Project project = psiDirectory.getProject();
  if (!ProjectFacetManager.getInstance(project).hasFacets(AndroidFacet.ID)) {
    return;
  }

  VirtualFile folder = psiDirectory.getVirtualFile();
  Module module = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(folder);
  if (module != null && ModuleUtilCore.isModuleDir(module, folder)) {
    data.setIcon(GradleUtil.getModuleIcon(module));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ModuleNodeIconDecorator.java

示例9: getChildElements

import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
public Object[] getChildElements(Object obj) {
  final Object[] childElements = super.getChildElements(obj);
  List l = new ArrayList(childElements.length);
  for (Object o : childElements) {
    if (o instanceof ProjectViewNode) {
      final ProjectViewNode node = (ProjectViewNode)o;
      final Object element = node.getValue();
      if (element instanceof PsiFile) {
        if (XsltSupport.isXsltFile((PsiFile)element)) {
          l.add(o);
        }
      }
      else {
        l.add(o);
      }
    }
  }
  return l.size() != childElements.length ? (Object[])l.toArray(new Object[l.size()]) : childElements;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:AssociationsEditor.java

示例10: modify

import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
@NotNull
@SuppressWarnings({"RawUseOfParameterizedType", "unchecked"})
public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent, @NotNull Collection<AbstractTreeNode> children, ViewSettings settings) {
  Collection<AbstractTreeNode> l = children;
  int i = 0;
  for (AbstractTreeNode o : children) {
    if (o instanceof ProjectViewNode) {
      final ProjectViewNode node = (ProjectViewNode)o;
      final Object element = node.getValue();
      if (element instanceof PsiFile) {
        if (XsltSupport.isXsltFile((PsiFile)element)) {
          if (l == children && l.getClass() != ArrayList.class) {
            l = new ArrayList<AbstractTreeNode>(children);
          }
          final XsltFileNode fileNode = new XsltFileNode(myProject, (PsiFile)element, settings);
          ((List<AbstractTreeNode>)l).set(i, fileNode);
        }
      }
    }
    i++;
  }
  return l;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:XsltTreeStructureProvider.java

示例11: decorate

import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
@Override
public void decorate(ProjectViewNode node, PresentationData data) {
  if (!(node instanceof ClassTreeNode)) {
    return;
  }
  PsiClass psiClass = ((ClassTreeNode) node).getPsiClass();
  if (psiClass == null) {
    return;
  }
  PsiFile psiFile = psiClass.getContainingFile();
  if (psiFile == null) {
    return;
  }
  VirtualFile virtualFile = psiFile.getVirtualFile();
  if (virtualFile == null) {
    return;
  }

  Project project = node.getProject();
  if (SyncStatusHelper.isUnsynced(project, virtualFile)) {
    data.clearText();
    data.addText(psiClass.getName(), SimpleTextAttributes.GRAY_ATTRIBUTES);
    data.addText(" (unsynced)", SimpleTextAttributes.GRAY_ATTRIBUTES);
  }
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:26,代码来源:BlazeJavaSyncStatusClassNodeDecorator.java

示例12: decorate

import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
@Override
public void decorate(@SuppressWarnings("rawtypes") ProjectViewNode node, PresentationData data) {
  CoverageDataManager manager = getCoverageDataManager();
  CoverageSuitesBundle currentSuite = manager.getCurrentSuitesBundle();

  Project project = node.getProject();
  BlazeCoverageAnnotator annotator = getAnnotator(project, currentSuite);
  if (annotator == null) {
    return;
  }
  PsiFile file = getPsiFileForJavaClass(getPsiElement(node));
  if (file == null) {
    return;
  }
  String string = annotator.getFileCoverageInformationString(file, currentSuite, manager);
  if (string != null) {
    data.setLocationString(string);
  }
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:20,代码来源:BlazeCoverageProjectViewClassDecorator.java

示例13: decorate

import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
@Override
public void decorate(ProjectViewNode node, PresentationData data) {
  if (!(node instanceof PsiFileNode)) {
    return;
  }
  PsiFile psiFile = ((PsiFileNode) node).getValue();
  if (!(psiFile instanceof OCFile)) {
    return;
  }
  VirtualFile virtualFile = psiFile.getVirtualFile();
  if (virtualFile == null) {
    return;
  }
  Project project = node.getProject();
  if (SyncStatusHelper.isUnsynced(project, virtualFile)) {
    data.clearText();
    data.addText(psiFile.getName(), SimpleTextAttributes.GRAY_ATTRIBUTES);
    data.addText(" (unsynced)", SimpleTextAttributes.GRAY_ATTRIBUTES);
  }
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:21,代码来源:BlazeCppSyncStatusFileNodeDecorator.java

示例14: updateNodesContaining

import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
private void updateNodesContaining(@Nonnull Collection<VirtualFile> filesToRefresh, @Nonnull DefaultMutableTreeNode rootNode) {
  if (!(rootNode.getUserObject() instanceof ProjectViewNode))
    return;
  ProjectViewNode node = (ProjectViewNode) rootNode.getUserObject();
  Collection<VirtualFile> containingFiles = null;
  for (VirtualFile virtualFile : filesToRefresh) {
    if (!virtualFile.isValid()) {
      addSubtreeToUpdate(rootNode); // file must be deleted
      return;
    }
    if (node.contains(virtualFile)) {
      if (containingFiles == null)
        containingFiles = new SmartList<VirtualFile>();
      containingFiles.add(virtualFile);
    }
  }
  if (containingFiles != null) {
    updateNode(rootNode);
    Enumeration children = rootNode.children();
    while (children.hasMoreElements()) {
      DefaultMutableTreeNode child = (DefaultMutableTreeNode) children.nextElement();
      updateNodesContaining(containingFiles, child);
    }
  }
}
 
开发者ID:raydac,项目名称:netbeans-mmd-plugin,代码行数:26,代码来源:KnowledgeViewTreeBuilder.java

示例15: decorate

import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
@Override
public void decorate(final ProjectViewNode node, final PresentationData data) {
  final VirtualFile file = node.getVirtualFile();
  final Project project = node.getProject();

  // Color file status
  if (file != null) {
    if (MTConfig.getInstance().getIsBoldTabs()) {
      // Color file status
      applyBoldTabs(data, file);
    }

    if (MTConfig.getInstance().isUseProjectViewDecorators()) {
      setOpenOrClosedIcon(data, file, project);
    }
  }
}
 
开发者ID:ChrisRM,项目名称:material-theme-jetbrains,代码行数:18,代码来源:MTProjectViewNodeDecorator.java


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