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


Java FileBasedIndex.getContainingFiles方法代码示例

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


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

示例1: collectServices

import com.intellij.util.indexing.FileBasedIndex; //导入方法依赖的package包/类
private void collectServices(Project project) {
    FileBasedIndex index = FileBasedIndex.getInstance();
    Collection<VirtualFile> containingFiles = index.getContainingFiles(
            FileTypeIndex.NAME,
            PhpFileType.INSTANCE,
            GlobalSearchScope.allScope(project)
    );
    containingFiles.removeIf(virtualFile -> !(virtualFile.getName().contains("ext_localconf.php")));

    for (VirtualFile projectFile : containingFiles) {
        PsiFile psiFile = PsiManager.getInstance(project).findFile(projectFile);
        if (psiFile != null) {
            psiFile.accept(new CoreServiceDefinitionParserVisitor(serviceMap));
        }
    }
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:17,代码来源:CoreServiceParser.java

示例2: canRun

import com.intellij.util.indexing.FileBasedIndex; //导入方法依赖的package包/类
@Override
protected void canRun() throws ConfigurationException {
    String newName = getNewName();
    if (Comparing.strEqual(newName, key)) {
        throw new ConfigurationException(null);
    }
    if (StringUtils.isBlank(newName) || newName.endsWith(".")) {
        throw new ConfigurationException("\'" + getNewName() + "\' is not a valid key");
    }

    FileBasedIndex index = FileBasedIndex.getInstance();
    Collection<VirtualFile> files = index.getContainingFiles(TranslationCallIndex.KEY, newName, GlobalSearchScope.allScope(getProject()));
    if (!files.isEmpty()) {
        throw new ConfigurationException("\'" + getNewName() + "\' already exists");
    }
}
 
开发者ID:letsdrink,项目名称:ouzo-phpstorm-plugin,代码行数:17,代码来源:RenameTranslationKeyDialog.java

示例3: resolveInner

import com.intellij.util.indexing.FileBasedIndex; //导入方法依赖的package包/类
@Override
@Nullable
public PsiElement resolveInner() {
    final FileBasedIndex instance = FileBasedIndex.getInstance();
    final Project project = getElement().getProject();
    final String id = getCanonicalText();
    final Collection<VirtualFile> files = instance.getContainingFiles(EmberTemplateCacheIndex.TEMPLATE_CACHE_INDEX, id,
            GlobalSearchScope.allScope(project));
    final Ref<PsiElement> result = new Ref<PsiElement>();
    for (VirtualFile file : files) {
        final PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
        EmberTemplateCacheIndex.processTemplates(psiFile, new Processor<XmlAttribute>() {
            @Override
            public boolean process(XmlAttribute attribute) {
                if (id.equals(attribute.getValue())) {
                    result.set(attribute.getValueElement());
                }
                return result.isNull();
            }
        });
    }
    return result.get();
}
 
开发者ID:kristianmandrup,项目名称:emberjs-plugin,代码行数:24,代码来源:EmberJSTemplateCacheReference.java

示例4: getFilesWithTodoItems

import com.intellij.util.indexing.FileBasedIndex; //导入方法依赖的package包/类
@Override
@Nonnull
public PsiFile[] getFilesWithTodoItems() {
  if (myProject.isDefault()) {
    return PsiFile.EMPTY_ARRAY;
  }
  final FileBasedIndex fileBasedIndex = FileBasedIndex.getInstance();
  final Set<PsiFile> allFiles = new HashSet<>();
  final ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
  for (IndexPattern indexPattern : IndexPatternUtil.getIndexPatterns()) {
    final Collection<VirtualFile> files = fileBasedIndex.getContainingFiles(
            TodoIndex.NAME,
            new TodoIndexEntry(indexPattern.getPatternString(), indexPattern.isCaseSensitive()), GlobalSearchScope.allScope(myProject));
    ApplicationManager.getApplication().runReadAction(() -> {
      for (VirtualFile file : files) {
        if (projectFileIndex.isInContent(file)) {
          final PsiFile psiFile = myPsiManager.findFile(file);
          if (psiFile != null) {
            allFiles.add(psiFile);
          }
        }
      }
    });
  }
  return allFiles.isEmpty() ? PsiFile.EMPTY_ARRAY : PsiUtilCore.toPsiFileArray(allFiles);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:IndexTodoCacheManagerImpl.java

示例5: isMainOpenApiFile

import com.intellij.util.indexing.FileBasedIndex; //导入方法依赖的package包/类
public boolean isMainOpenApiFile(final VirtualFile virtualFile, final Project project) {
    final FileBasedIndex index = FileBasedIndex.getInstance();
    final Collection<VirtualFile> openApiFiles =
            index.getContainingFiles(OpenApiFileIndex.OPEN_API_INDEX_ID,
                    OpenApiFileIndex.MAIN_OPEN_API_FILE, GlobalSearchScope.allScope(project));

    return openApiFiles.contains(virtualFile);
}
 
开发者ID:zalando,项目名称:intellij-swagger,代码行数:9,代码来源:OpenApiIndexService.java

示例6: isMainSwaggerFile

import com.intellij.util.indexing.FileBasedIndex; //导入方法依赖的package包/类
public boolean isMainSwaggerFile(final VirtualFile virtualFile, final Project project) {
    final FileBasedIndex index = FileBasedIndex.getInstance();
    final Collection<VirtualFile> swaggerFiles =
            index.getContainingFiles(SwaggerFileIndex.SWAGGER_INDEX_ID,
                    SwaggerFileIndex.MAIN_SWAGGER_FILE, GlobalSearchScope.allScope(project));
    return swaggerFiles.contains(virtualFile);
}
 
开发者ID:zalando,项目名称:intellij-swagger,代码行数:8,代码来源:SwaggerIndexService.java

示例7: getFilesWithTodoItems

import com.intellij.util.indexing.FileBasedIndex; //导入方法依赖的package包/类
@Override
@NotNull
public PsiFile[] getFilesWithTodoItems() {
  if (myProject.isDefault()) {
    return PsiFile.EMPTY_ARRAY;
  }
  final FileBasedIndex fileBasedIndex = FileBasedIndex.getInstance();
  final Set<PsiFile> allFiles = new HashSet<PsiFile>();
  final ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
  for (IndexPattern indexPattern : IndexPatternUtil.getIndexPatterns()) {
    final Collection<VirtualFile> files = fileBasedIndex.getContainingFiles(
      TodoIndex.NAME,
      new TodoIndexEntry(indexPattern.getPatternString(), indexPattern.isCaseSensitive()), GlobalSearchScope.allScope(myProject));
    ApplicationManager.getApplication().runReadAction(new Runnable() {
      @Override
      public void run() {
        for (VirtualFile file : files) {
          if (projectFileIndex.isInContent(file)) {
            final PsiFile psiFile = myPsiManager.findFile(file);
            if (psiFile != null) {
              allFiles.add(psiFile);
            }
          }
        }
      }
    });
  }
  return allFiles.isEmpty() ? PsiFile.EMPTY_ARRAY : PsiUtilCore.toPsiFileArray(allFiles);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:IndexTodoCacheManagerImpl.java

示例8: runDetector

import com.intellij.util.indexing.FileBasedIndex; //导入方法依赖的package包/类
private List<? extends DetectedFrameworkDescription> runDetector(Integer detectorId,
                                                                 FileBasedIndex index,
                                                                 DetectionExcludesConfiguration excludesConfiguration,
                                                                 final boolean processNewFilesOnly) {
  Collection<VirtualFile> acceptedFiles = index.getContainingFiles(FrameworkDetectionIndex.NAME, detectorId, GlobalSearchScope.projectScope(myProject));
  final Collection<VirtualFile> filesToProcess;
  if (processNewFilesOnly) {
    filesToProcess = myDetectedFrameworksData.retainNewFiles(detectorId, acceptedFiles);
  }
  else {
    filesToProcess = new ArrayList<VirtualFile>(acceptedFiles);
  }
  FrameworkDetector detector = FrameworkDetectorRegistry.getInstance().getDetectorById(detectorId);
  if (detector == null) {
    LOG.info("Framework detector not found by id " + detectorId);
    return Collections.emptyList();
  }

  ((DetectionExcludesConfigurationImpl)excludesConfiguration).removeExcluded(filesToProcess, detector.getFrameworkType());
  if (LOG.isDebugEnabled()) {
    LOG.debug("Detector '" + detector.getDetectorId() + "': " + acceptedFiles.size() + " accepted files, " + filesToProcess.size() + " files to process");
  }
  final List<? extends DetectedFrameworkDescription> frameworks;
  if (!filesToProcess.isEmpty()) {
    frameworks = detector.detect(filesToProcess, new FrameworkDetectionContextImpl(myProject));
  }
  else {
    frameworks = Collections.emptyList();
  }
  return frameworks;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:FrameworkDetectionManager.java

示例9: isUsed

import com.intellij.util.indexing.FileBasedIndex; //导入方法依赖的package包/类
private boolean isUsed(Project project, FileBasedIndex index, String key) {
    if (key == null) {
        return false;
    }
    Collection<VirtualFile> files = index.getContainingFiles(TranslationCallIndex.KEY, key, GlobalSearchScope.allScope(project));

    return !files.isEmpty() || isUsed(project, index, TranslationUtils.getParentKey(key));
}
 
开发者ID:letsdrink,项目名称:ouzo-phpstorm-plugin,代码行数:9,代码来源:UnusedTranslationAnnotator.java


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