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


Java PsiDirectoryNode.getValue方法代码示例

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


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

示例1: decorate

import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入方法依赖的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

示例2: isForMe

import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入方法依赖的package包/类
@Override
public boolean isForMe(ProjectViewNode node) {
    if (node instanceof PsiDirectoryNode) {
        PsiDirectoryNode dirNode = (PsiDirectoryNode) node;
        final Project project = dirNode.getProject();
        final PsiDirectory psiDirectory = dirNode.getValue();
        final VirtualFile directoryFile = psiDirectory.getVirtualFile();
        return ProjectRootsUtil.isInSource(directoryFile, project) ||
                ProjectRootsUtil.isInTestSource(directoryFile, project);
    }
    return false;
}
 
开发者ID:zielu,项目名称:SVNToolBox,代码行数:13,代码来源:PackageDecoration.java

示例3: isForMe

import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入方法依赖的package包/类
@Override
public boolean isForMe(ProjectViewNode node) {
    if (node instanceof PsiDirectoryNode) {
        PsiDirectoryNode dirNode = (PsiDirectoryNode) node;            
        final PsiDirectory psiDirectory = dirNode.getValue();
        if (psiDirectory != null) {
            final Project project = dirNode.getProject();
            final VirtualFile directoryFile = psiDirectory.getVirtualFile();
            return ProjectRootsUtil.isModuleContentRoot(directoryFile, project)
                    || ProjectRootsUtil.isInSource(directoryFile, project);
        }
    }
    return false;
}
 
开发者ID:zielu,项目名称:SVNToolBox,代码行数:15,代码来源:ContentRootDecoration.java

示例4: getSelectedDirectories

import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入方法依赖的package包/类
@NotNull
public PsiDirectory[] getSelectedDirectories() {
  List<PsiDirectory> directories = ContainerUtil.newArrayList();
  for (PsiDirectoryNode node : getSelectedNodes(PsiDirectoryNode.class)) {
    PsiDirectory directory = node.getValue();
    if (directory != null) {
      directories.add(directory);
      Object parentValue = node.getParent().getValue();
      if (parentValue instanceof PsiDirectory && Registry.is("projectView.choose.directory.on.compacted.middle.packages")) {
        while (true) {
          directory = directory.getParentDirectory();
          if (directory == null || directory.equals(parentValue)) {
            break;
          }
          directories.add(directory);
        }
      }
    }
  }
  if (!directories.isEmpty()) {
    return directories.toArray(new PsiDirectory[directories.size()]);
  }

  final PsiElement[] elements = getSelectedPSIElements();
  if (elements.length == 1) {
    final PsiElement element = elements[0];
    if (element instanceof PsiDirectory) {
      return new PsiDirectory[]{(PsiDirectory)element};
    }
    else if (element instanceof PsiDirectoryContainer) {
      return ((PsiDirectoryContainer)element).getDirectories();
    }
    else {
      final PsiFile containingFile = element.getContainingFile();
      if (containingFile != null) {
        final PsiDirectory psiDirectory = containingFile.getContainingDirectory();
        if (psiDirectory != null) {
          return new PsiDirectory[]{psiDirectory};
        }
        final VirtualFile file = containingFile.getVirtualFile();
        if (file instanceof VirtualFileWindow) {
          final VirtualFile delegate = ((VirtualFileWindow)file).getDelegate();
          final PsiFile delegatePsiFile = containingFile.getManager().findFile(delegate);
          if (delegatePsiFile != null && delegatePsiFile.getContainingDirectory() != null) {
            return new PsiDirectory[] { delegatePsiFile.getContainingDirectory() };
          }
        }
        return PsiDirectory.EMPTY_ARRAY;
      }
    }
  }
  else {
    final DefaultMutableTreeNode selectedNode = getSelectedNode();
    if (selectedNode != null) {
      return getSelectedDirectoriesInAmbiguousCase(selectedNode);
    }
  }
  return PsiDirectory.EMPTY_ARRAY;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:60,代码来源:AbstractProjectViewPane.java

示例5: ResourceDirectoryNode

import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入方法依赖的package包/类
protected ResourceDirectoryNode(Project project,
                                PsiDirectoryNode directory,
                                ViewSettings viewSettings) {
  super(project, directory.getValue(), viewSettings);
  myBaseNode = directory;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:ResourceDirectoryNode.java

示例6: decorate

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

  final PsiDirectoryNode psiDirectoryNode = (PsiDirectoryNode)node;
  PsiDirectory directory = psiDirectoryNode.getValue();
  if (directory == null || !directory.isValid()) {
    return;
  }

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

  // If the build dir is inside the module's content root, ProjectRootsUtil.isModuleContentRoot will return false. The reason is that when
  // we set up the project during a sync, we don't create additional content roots if the build dir is inside the module.
  final VirtualFile folder = directory.getVirtualFile();
  if (!ProjectRootsUtil.isModuleContentRoot(folder, project)) {
    return;
  }

  Object parentValue = psiDirectoryNode.getParent().getValue();
  if (!(parentValue instanceof Module)) {
    return;
  }

  Module module = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(folder);
  if (module == null) {
    return;
  }

  AndroidProject androidProject = GradleUtil.getAndroidProject(module);
  if (androidProject == null) {
    return;
  }

  File buildFolderPath = androidProject.getBuildFolder();
  File folderPath = VfsUtilCore.virtualToIoFile(folder);
  if (FileUtil.filesEqual(buildFolderPath, folderPath)) {
    data.clearText();
    data.addText(folder.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:47,代码来源:BuildNodeDecorator.java

示例7: getSelectedDirectories

import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入方法依赖的package包/类
@Nonnull
public PsiDirectory[] getSelectedDirectories() {
  List<PsiDirectory> directories = ContainerUtil.newArrayList();
  for (PsiDirectoryNode node : getSelectedNodes(PsiDirectoryNode.class)) {
    PsiDirectory directory = node.getValue();
    if (directory != null) {
      directories.add(directory);
      Object parentValue = node.getParent().getValue();
      if (parentValue instanceof PsiDirectory && Registry.is("projectView.choose.directory.on.compacted.middle.packages")) {
        while (true) {
          directory = directory.getParentDirectory();
          if (directory == null || directory.equals(parentValue)) {
            break;
          }
          directories.add(directory);
        }
      }
    }
  }
  if (!directories.isEmpty()) {
    return directories.toArray(new PsiDirectory[directories.size()]);
  }

  final PsiElement[] elements = getSelectedPSIElements();
  if (elements.length == 1) {
    final PsiElement element = elements[0];
    if (element instanceof PsiDirectory) {
      return new PsiDirectory[]{(PsiDirectory)element};
    }
    else if (element instanceof PsiDirectoryContainer) {
      return ((PsiDirectoryContainer)element).getDirectories();
    }
    else {
      final PsiFile containingFile = element.getContainingFile();
      if (containingFile != null) {
        final PsiDirectory psiDirectory = containingFile.getContainingDirectory();
        if (psiDirectory != null) {
          return new PsiDirectory[]{psiDirectory};
        }
        final VirtualFile file = containingFile.getVirtualFile();
        if (file instanceof VirtualFileWindow) {
          final VirtualFile delegate = ((VirtualFileWindow)file).getDelegate();
          final PsiFile delegatePsiFile = containingFile.getManager().findFile(delegate);
          if (delegatePsiFile != null && delegatePsiFile.getContainingDirectory() != null) {
            return new PsiDirectory[]{delegatePsiFile.getContainingDirectory()};
          }
        }
        return PsiDirectory.EMPTY_ARRAY;
      }
    }
  }
  else {
    final DefaultMutableTreeNode selectedNode = getSelectedNode();
    if (selectedNode != null) {
      return getSelectedDirectoriesInAmbiguousCase(selectedNode);
    }
  }
  return PsiDirectory.EMPTY_ARRAY;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:60,代码来源:AbstractProjectViewPane.java


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