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


Java ProjectFileIndex.isExcluded方法代码示例

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


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

示例1: createExcludedConfigurable

import com.intellij.openapi.roots.ProjectFileIndex; //导入方法依赖的package包/类
private static ExcludedEntriesConfigurable createExcludedConfigurable(final Project project) {
  final ExcludesConfiguration configuration = ValidationConfiguration.getExcludedEntriesConfiguration(project);
  final ProjectFileIndex index = ProjectRootManager.getInstance(project).getFileIndex();
  final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, false, false, false, true) {
    public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) {
      return super.isFileVisible(file, showHiddenFiles) && (project.isDefault() || !index.isExcluded(file));
    }
  };

  List<VirtualFile> allContentRoots = new ArrayList<VirtualFile>();
  for (final Module module: ModuleManager.getInstance(project).getModules()) {
    final VirtualFile[] moduleContentRoots = ModuleRootManager.getInstance(module).getContentRoots();
    Collections.addAll(allContentRoots, moduleContentRoots);
  }
  descriptor.setRoots(allContentRoots);
  return new ExcludedEntriesConfigurable(project, descriptor, configuration);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ValidationConfigurable.java

示例2: isVersioned

import com.intellij.openapi.roots.ProjectFileIndex; //导入方法依赖的package包/类
public boolean isVersioned(@NotNull VirtualFile f, boolean shouldBeInContent) {
  if (!f.isInLocalFileSystem()) return false;

  if (!f.isDirectory() && StringUtil.endsWith(f.getNameSequence(), ".class")) return false;

  Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
  boolean isInContent = false;
  for (Project each : openProjects) {
    if (each.isDefault()) continue;
    if (!each.isInitialized()) continue;
    if (Comparing.equal(each.getWorkspaceFile(), f)) return false;
    ProjectFileIndex index = ProjectRootManager.getInstance(each).getFileIndex();
    
    if (index.isExcluded(f)) return false;
    isInContent |= index.isInContent(f);
  }
  if (shouldBeInContent && !isInContent) return false;
  
  // optimisation: FileTypeManager.isFileIgnored(f) already checked inside ProjectFileIndex.isIgnored()
  return openProjects.length != 0 || !FileTypeManager.getInstance().isFileIgnored(f);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:IdeaGateway.java

示例3: contains

import com.intellij.openapi.roots.ProjectFileIndex; //导入方法依赖的package包/类
@Override
public boolean contains(@NotNull VirtualFile file) {
  final PsiDirectory value = getValue();
  if (value == null) {
    return false;
  }

  VirtualFile directory = value.getVirtualFile();
  if (directory.getFileSystem() instanceof LocalFileSystem) {
    file = PathUtil.getLocalFile(file);
  }

  if (!VfsUtilCore.isAncestor(directory, file, false)) {
    return false;
  }

  if (Registry.is("ide.hide.excluded.files")) {
    final Project project = value.getProject();
    final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
    return !fileIndex.isExcluded(file);
  }
  else {
    return !FileTypeRegistry.getInstance().isFileIgnored(file);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:PsiDirectoryNode.java

示例4: processResources

import com.intellij.openapi.roots.ProjectFileIndex; //导入方法依赖的package包/类
static boolean processResources(Project project,
                                VirtualFile sourceRoot,
                                VirtualFile file,
                                List<Pattern> includes,
                                List<Pattern> excludes,
                                String resOutputDir,
                                ResourceProcessor processor) {
  final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  if (!fileIndex.isExcluded(file)) {
    String relPath = VfsUtilCore.getRelativePath(file, sourceRoot, '/');
    if (relPath != null && MavenUtil.isIncluded(relPath, includes, excludes)) {
      if (processor.process(file, resOutputDir + "/" + relPath)) {
        return true;
      }
    }
  }
  if (file.isDirectory()) {
    for (VirtualFile child : file.getChildren()) {
      if (processResources(project, sourceRoot, child, includes, excludes, resOutputDir, processor)) {
        return true;
      }
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:AndroidMavenProviderImpl.java

示例5: findTarget

import com.intellij.openapi.roots.ProjectFileIndex; //导入方法依赖的package包/类
@Nullable
private static VirtualFile findTarget(@NotNull AnActionEvent e, @NotNull Project project) {
  VirtualFile[] virtualFiles = VIRTUAL_FILE_ARRAY.getData(e.getDataContext());
  if (virtualFiles != null && virtualFiles.length == 1) {
    VirtualFile target = virtualFiles[0];
    if (isModuleSourceRoot(target, project) || project.getBaseDir().equals(target)) {
      // Module folders and project folder are ignored.
      return null;
    }
    ProjectFileIndex projectIndex = ProjectRootManager.getInstance(project).getFileIndex();
    if (projectIndex.isExcluded(target)) {
      // Excluded folders are ignored.
      return null;
    }
    return target;
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:IncludeModuleForFileAction.java

示例6: createExcludedConfigurable

import com.intellij.openapi.roots.ProjectFileIndex; //导入方法依赖的package包/类
private ExcludedEntriesConfigurable createExcludedConfigurable(final Project project) {
  final ExcludesConfiguration configuration = myConfig.getExcludeFromStubGeneration();
  final ProjectFileIndex index = ProjectRootManager.getInstance(project).getFileIndex();
  final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, false, false, false, true) {
    @Override
    public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) {
      return super.isFileVisible(file, showHiddenFiles) && !index.isExcluded(file);
    }
  };
  descriptor.setRoots(ContainerUtil.concat(
    ContainerUtil.map(ModuleManager.getInstance(project).getModules(), new Function<Module, List<VirtualFile>>() {
      @Override
      public List<VirtualFile> fun(final Module module) {
        return ModuleRootManager.getInstance(module).getSourceRoots(JavaModuleSourceRootTypes.SOURCES);
      }
    })));
  return new ExcludedEntriesConfigurable(project, descriptor, configuration);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GroovyCompilerConfigurable.java

示例7: isProjectFile

import com.intellij.openapi.roots.ProjectFileIndex; //导入方法依赖的package包/类
private static boolean isProjectFile(@NotNull VirtualFile file, @NotNull Project project) {
  ProjectFileIndex fileIndex = ProjectFileIndex.SERVICE.getInstance(project);
  if (fileIndex.isInContent(file)) return true;
  if (!Registry.is("ide.hide.excluded.files") && fileIndex.isExcluded(file) && !fileIndex.isUnderIgnored(file)) return true;
  
  if (project instanceof ProjectEx && !project.isDefault()) {
    if (ProjectUtil.isDirectoryBased(project)) {
      VirtualFile baseDir = project.getBaseDir();
      VirtualFile dotIdea = baseDir == null ? null : baseDir.findChild(Project.DIRECTORY_STORE_FOLDER);
      if (dotIdea != null && VfsUtilCore.isAncestor(dotIdea, file, false)) return true;
    }

    IProjectStore store = (IProjectStore)ServiceKt.getStateStore(project);
    String filePath = file.getPath();
    if (FileUtil.namesEqual(filePath, store.getWorkspaceFilePath()) || FileUtil.namesEqual(filePath, store.getProjectFilePath())) {
      return true;
    }
    for (Module module : ModuleManager.getInstance(project).getModules()) {
      if (FileUtil.namesEqual(filePath, module.getModuleFilePath())) {
        return true;
      }
    }
  }

  for (NonProjectFileWritingAccessExtension each : Extensions.getExtensions(NonProjectFileWritingAccessExtension.EP_NAME, project)) {
    if(each.isWritable(file)) return true;
  }

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

示例8: filterOutGeneratedAndExcludedFiles

import com.intellij.openapi.roots.ProjectFileIndex; //导入方法依赖的package包/类
public static List<VirtualFile> filterOutGeneratedAndExcludedFiles(@NotNull Collection<VirtualFile> files, @NotNull Project project) {
  ProjectFileIndex fileIndex = ProjectFileIndex.SERVICE.getInstance(project);
  List<VirtualFile> result = new ArrayList<VirtualFile>(files.size());
  for (VirtualFile file : files) {
    if (!fileIndex.isExcluded(file) && !GeneratedSourcesFilter.isGeneratedSourceByAnyFilter(file, project)) {
      result.add(file);
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:CheckinHandlerUtil.java

示例9: getDirectoryChildren

import com.intellij.openapi.roots.ProjectFileIndex; //导入方法依赖的package包/类
public Collection<AbstractTreeNode> getDirectoryChildren(final PsiDirectory psiDirectory,
                                                         final ViewSettings settings,
                                                         final boolean withSubDirectories) {
  final List<AbstractTreeNode> children = new ArrayList<AbstractTreeNode>();
  final Project project = psiDirectory.getProject();
  final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  final Module module = fileIndex.getModuleForFile(psiDirectory.getVirtualFile());
  final ModuleFileIndex moduleFileIndex = module == null ? null : ModuleRootManager.getInstance(module).getFileIndex();
  if (!settings.isFlattenPackages() || skipDirectory(psiDirectory)) {
    processPsiDirectoryChildren(psiDirectory, directoryChildrenInProject(psiDirectory, settings),
                                children, fileIndex, null, settings, withSubDirectories);
  }
  else { // source directory in "flatten packages" mode
    final PsiDirectory parentDir = psiDirectory.getParentDirectory();
    if (parentDir == null || skipDirectory(parentDir) && withSubDirectories) {
      addAllSubpackages(children, psiDirectory, moduleFileIndex, settings);
    }
    if (withSubDirectories) {
      PsiDirectory[] subdirs = psiDirectory.getSubdirectories();
      for (PsiDirectory subdir : subdirs) {
        if (!skipDirectory(subdir)) {
          continue;
        }
        VirtualFile directoryFile = subdir.getVirtualFile();

        if (Registry.is("ide.hide.excluded.files")) {
          if (fileIndex.isExcluded(directoryFile)) continue;
        }
        else {
          if (FileTypeRegistry.getInstance().isFileIgnored(directoryFile)) continue;
        }

        children.add(new PsiDirectoryNode(project, subdir, settings));
      }
    }
    processPsiDirectoryChildren(psiDirectory, psiDirectory.getFiles(), children, fileIndex, moduleFileIndex, settings,
                                withSubDirectories);
  }
  return children;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:ProjectViewDirectoryHelper.java

示例10: isNotUnderSourceRoot

import com.intellij.openapi.roots.ProjectFileIndex; //导入方法依赖的package包/类
private static boolean isNotUnderSourceRoot(@NotNull final Project project, @Nullable final PsiFile psiFile) {
  if (psiFile == null) {
    return true;
  }
  final VirtualFile virtualFile = psiFile.getVirtualFile();
  if (virtualFile != null) {
    final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
    if (fileIndex.isExcluded(virtualFile) || (fileIndex.isInLibraryClasses(virtualFile) && !fileIndex.isInContent(virtualFile))) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:PyChangeSignatureHandler.java


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