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


Java AbstractTreeNode.getProject方法代码示例

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


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

示例1: modify

import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
@NotNull
@Override
public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent, @NotNull Collection<AbstractTreeNode> children, ViewSettings settings) {
    ArrayList<AbstractTreeNode> nodes = new ArrayList<AbstractTreeNode>();

    if (isLanguageFolder(parent)) {
        if (children.size() > 0 && parent.getValue() instanceof PsiDirectory) {
            Collection<PsiFileNode> childrenPsi2 = new ArrayList<>();
            for (AbstractTreeNode eachChild : children) {
                if (!(eachChild.getValue() instanceof PsiFile)) continue;
                PsiFile psiFile = (PsiFile) eachChild.getValue();
                LanguageNodeFile nodeFile = new LanguageNodeFile(parent.getProject(), psiFile, settings);
                childrenPsi2.add(nodeFile);
            }
            LanguageNestingNode languageFormNode = new LanguageNestingNode(childrenPsi2.iterator().next(), childrenPsi2);
            nodes.add(languageFormNode);
        }
    } else {
        nodes.addAll(children);
    }
    return nodes;
}
 
开发者ID:PioBeat,项目名称:GravSupport,代码行数:23,代码来源:LanguageTreeStructureProvider.java

示例2: modify

import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
@Override
public Collection<AbstractTreeNode> modify(
    AbstractTreeNode parent, Collection<AbstractTreeNode> children, ViewSettings settings) {
  Project project = parent.getProject();
  if (project == null || !Blaze.isBlazeProject(project)) {
    return children;
  }

  if (!(parent instanceof ProjectViewProjectNode)) {
    return children;
  }
  WorkspaceRootNode rootNode = createRootNode(project, settings);
  if (rootNode == null) {
    return children;
  }

  Collection<AbstractTreeNode> result = Lists.newArrayList();
  result.add(rootNode);
  for (AbstractTreeNode treeNode : children) {
    if (treeNode instanceof ExternalLibrariesNode) {
      result.add(treeNode);
    }
  }
  return result;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:26,代码来源:BlazeTreeStructureProvider.java

示例3: modify

import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
@NotNull
@Override
public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent,
                                           @NotNull Collection<AbstractTreeNode> children,
                                           ViewSettings settings) {
  Project project = parent.getProject();
  if (project == null || !shouldModify(project)) {
    return children;
  }
  Course course = StudyTaskManager.getInstance(project).getCourse();
  if (course == null) {
    return children;
  }
  Collection<AbstractTreeNode> modifiedNodes = new ArrayList<>();
  for (AbstractTreeNode node : children) {
    if (parent instanceof ProjectViewProjectNode && node instanceof PsiDirectoryNode) {
      modifiedNodes.add(createCourseNode(project, node, settings, course));
      continue;
    }
    if (parent instanceof StudyDirectoryNode) {
      AbstractTreeNode modifiedNode = ((StudyDirectoryNode)parent).modifyChildNode(node);
      if (modifiedNode != null) {
        modifiedNodes.add(modifiedNode);
      }
    }
  }
  return modifiedNodes;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:29,代码来源:StudyTreeStructureProvider.java

示例4: modify

import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
@NotNull
@Override
public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent,
                                           @NotNull Collection<AbstractTreeNode> children,
                                           ViewSettings settings) {
  if (!needModify(parent)) {
    return children;
  }
  Collection<AbstractTreeNode> nodes = new ArrayList<AbstractTreeNode>();
  for (AbstractTreeNode node : children) {
    Project project = node.getProject();
    if (project != null) {
      if (node.getValue() instanceof PsiDirectory) {
        PsiDirectory directory = (PsiDirectory)node.getValue();
        nodes.add(new CCDirectoryNode(project, directory, settings));
        continue;
      }
      if (node instanceof PsiFileNode) {
        PsiFileNode fileNode = (PsiFileNode)node;
        VirtualFile virtualFile = fileNode.getVirtualFile();
        if (virtualFile == null) {
          continue;
        }
        if (CCProjectService.getInstance(project).isTaskFile(virtualFile)
            || virtualFile.getName().contains(EduNames.WINDOWS_POSTFIX)) {
          continue;
        }
      }
      nodes.add(node);
    }
  }
  return nodes;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:CCTreeStructureProvider.java

示例5: needModify

import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
private static boolean needModify(@NotNull final AbstractTreeNode parent) {
  Project project = parent.getProject();
  if (project != null) {
    if (CCProjectService.getInstance(project).getCourse() == null) {
      return false;
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:CCTreeStructureProvider.java

示例6: isCourseBasedProject

import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
protected boolean isCourseBasedProject(@NotNull final AbstractTreeNode parent) {
  final Project project = parent.getProject();
  if (project != null) {
    final StudyTaskManager studyTaskManager = StudyTaskManager.getInstance(project);
    if (studyTaskManager.getCourse() == null) {
      return false;
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:StudyTreeStructureProvider.java

示例7: modify

import com.intellij.ide.util.treeView.AbstractTreeNode; //导入方法依赖的package包/类
@NotNull
@Override
public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent,
                                           @NotNull Collection<AbstractTreeNode> children,
                                           ViewSettings settings) {
  if (!isCourseBasedProject(parent)) {
    return children;
  }
  Collection<AbstractTreeNode> nodes = new ArrayList<AbstractTreeNode>();
  for (AbstractTreeNode node : children) {
    final Project project = node.getProject();
    if (project != null) {
      if (node.getValue() instanceof PsiDirectory) {
        final PsiDirectory nodeValue = (PsiDirectory)node.getValue();
        final String name = nodeValue.getName();
        if (name != null && !name.contains(EduNames.USER_TESTS) && !name.startsWith(".")) {
          AbstractTreeNode newNode = createStudyDirectoryNode(settings, project, nodeValue);
          nodes.add(newNode);
        }
      }
      else {
        if (parent instanceof StudyDirectoryNode && node instanceof PsiFileNode) {
          final PsiFileNode psiFileNode = (PsiFileNode)node;
          final VirtualFile virtualFile = psiFileNode.getVirtualFile();
          if (virtualFile == null) {
            return nodes;
          }
          final TaskFile taskFile = StudyUtils.getTaskFile(project, virtualFile);
          if (taskFile != null) {
            nodes.add(node);
          }
          final String parentName = parent.getName();
          if (parentName != null) {
            if (parentName.equals(EduNames.SANDBOX_DIR)) {
              nodes.add(node);
            }
            if (parentName.startsWith(EduNames.TASK)) {
              addNonInvisibleFiles(nodes, node, project, virtualFile);
            }
          }
        }
      }
    }
  }
  return nodes;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:47,代码来源:StudyTreeStructureProvider.java


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