Java 类com.intellij.util.indexing.ID 实例源码

项目:magento2-phpstorm-plugin    文件:IndexManager.java   
public static void manualReindex() {
    ID<?, ?>[] indexIds = new ID<?, ?>[] {
        // php
        ModulePackageIndex.KEY,
        // xml|di configuration
        PluginIndex.KEY,
        TypeConfigurationIndex.KEY,
        VirtualTypeIndex.KEY,
        // layouts
        BlockClassNameIndex.KEY,
        BlockNameIndex.KEY,
        ContainerNameIndex.KEY,
        // events
        EventNameIndex.KEY,
        EventObserverIndex.KEY,
        // webapi
        WebApiTypeIndex.KEY,
        ModuleNameIndex.KEY
    };

    for (ID<?, ?> id: indexIds) {
        FileBasedIndexImpl.getInstance().requestRebuild(id);
        FileBasedIndexImpl.getInstance().scheduleRebuild(id, new Throwable());
    }
}
项目:magento2-phpstorm-plugin    文件:LayoutIndex.java   
private static List<XmlTag> getComponentDeclarations(String componentValue, String componentType, ID<String, Void> id, Project project, ComponentMatcher componentMatcher) {
    List<XmlTag> results = new ArrayList<XmlTag>();
    Collection<VirtualFile> containingFiles = FileBasedIndex.getInstance()
        .getContainingFiles(
            id,
            componentValue,
            GlobalSearchScope.allScope(project)
        );
    PsiManager psiManager = PsiManager.getInstance(project);

    for (VirtualFile virtualFile: containingFiles) {
        XmlFile xmlFile = (XmlFile)psiManager.findFile(virtualFile);
        if (xmlFile == null) {
            continue;
        }

        XmlTag rootTag = xmlFile.getRootTag();
        if (rootTag == null) {
            continue;
        }
        collectComponentDeclarations(rootTag, results, componentValue, componentType, componentMatcher);
    }

    return results;
}
项目:idea-php-dotenv-plugin    文件:DotEnvLightCodeInsightFixtureTestCase.java   
public void assertIndex(@NotNull ID<String, ?> id, boolean notCondition, @NotNull String... keys) {
    for (String key : keys) {

        final Collection<VirtualFile> virtualFiles = new ArrayList<VirtualFile>();

        FileBasedIndexImpl.getInstance().getFilesWithKey(id, new HashSet<String>(Arrays.asList(key)), new Processor<VirtualFile>() {
            @Override
            public boolean process(VirtualFile virtualFile) {
                virtualFiles.add(virtualFile);
                return true;
            }
        }, GlobalSearchScope.allScope(getProject()));

        if(notCondition && virtualFiles.size() > 0) {
            fail(String.format("Fail that ID '%s' not contains '%s'", id.toString(), key));
        } else if(!notCondition && virtualFiles.size() == 0) {
            fail(String.format("Fail that ID '%s' contains '%s'", id.toString(), key));
        }
    }
}
项目:intellij-ce-playground    文件:IndexedRelevantResource.java   
public static <K, V extends Comparable> List<IndexedRelevantResource<K, V>> getResources(ID<K, V> indexId,
                                                                                         final K key,
                                                                                         @Nullable final Module module,
                                                                                         @NotNull Project project,
                                                                                         @Nullable final GlobalSearchScope additionalScope) {

  if (project.isDefault()) return Collections.emptyList();
  final ArrayList<IndexedRelevantResource<K, V>> resources = new ArrayList<IndexedRelevantResource<K, V>>();
  final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  FileBasedIndex.getInstance().processValues(indexId, key, null, new FileBasedIndex.ValueProcessor<V>() {
    @Override
    public boolean process(VirtualFile file, V value) {
      ResourceRelevance relevance = ResourceRelevance.getRelevance(file, module, fileIndex, additionalScope);
      resources.add(new IndexedRelevantResource<K, V>(file, key, value, relevance));
      return true;
    }
  }, new AdditionalIndexedRootsScope(GlobalSearchScope.allScope(project)));
  return resources;
}
项目:intellij-ce-playground    文件:IndexedRelevantResource.java   
public static <K, V extends Comparable> List<IndexedRelevantResource<K, V>> getAllResources(ID<K, V> indexId,
                                                                                            @Nullable final Module module,
                                                                                            @NotNull Project project,
                                                                                            @Nullable NullableFunction<List<IndexedRelevantResource<K, V>>, IndexedRelevantResource<K, V>> chooser) {
  ArrayList<IndexedRelevantResource<K, V>> all = new ArrayList<IndexedRelevantResource<K, V>>();
  Collection<K> allKeys = FileBasedIndex.getInstance().getAllKeys(indexId, project);
  for (K key : allKeys) {
    List<IndexedRelevantResource<K, V>> resources = getResources(indexId, key, module, project, null);
    if (!resources.isEmpty()) {
      if (chooser == null) {
        all.add(resources.get(0));
      }
      else {
        IndexedRelevantResource<K, V> resource = chooser.fun(resources);
        if (resource != null) {
          all.add(resource);
        }
      }
    }
  }
  return all;
}
项目:magento2plugin    文件:LayoutIndexUtility.java   
public static List<XmlTag> getComponentDeclarations(String componentValue, String componentType, ID<String, Void> id, Project project, ComponentMatcher componentMatcher) {
    List<XmlTag> results = new ArrayList<XmlTag>();
    Collection<VirtualFile> containingFiles = FileBasedIndex.getInstance()
        .getContainingFiles(
            id,
            componentValue,
            GlobalSearchScope.allScope(project)
        );
    PsiManager psiManager = PsiManager.getInstance(project);

    for (VirtualFile virtualFile: containingFiles) {
        XmlFile xmlFile = (XmlFile)psiManager.findFile(virtualFile);
        if (xmlFile == null) {
            continue;
        }

        XmlTag rootTag = xmlFile.getRootTag();
        if (rootTag == null) {
            continue;
        }
        collectComponentDeclarations(rootTag, results, componentValue, componentType, componentMatcher);
    }

    return results;
}
项目:magento2plugin    文件:IndexUtil.java   
public static void manualReindex() {
    ID<?,?>[] indexIds = new ID<?,?>[] {
        // php
        ModulePackageFileBasedIndex.NAME,
        EventsDeclarationsFileBasedIndex.NAME,

        // xml configuration
        // di
        PluginToTypeFileBasedIndex.NAME,
        TypeConfigurationFileBasedIndex.NAME,
        VirtualTypesNamesFileBasedIndex.NAME,
        // layouts
        BlockClassFileBasedIndex.NAME,
        BlockFileBasedIndex.NAME,
        ContainerFileBasedIndex.NAME,
        // events
        EventObserverFileBasedIndex.NAME,
        // webapi
        WebApiTypesFileBasedIndex.NAME
    };

    for(ID<?,?> id: indexIds) {
        FileBasedIndexImpl.getInstance().requestRebuild(id);
        FileBasedIndexImpl.getInstance().scheduleRebuild(id, new Throwable());
    }
}
项目:idea-php-laravel-plugin    文件:TemplateLineMarker.java   
@NotNull
@Override
protected Collection<? extends PsiElement> compute() {
    Collection<VirtualFile> virtualFiles = new ArrayList<>();

    for(ID<String, Void> key : Arrays.asList(BladeExtendsStubIndex.KEY, BladeSectionStubIndex.KEY, BladeIncludeStubIndex.KEY, BladeEachStubIndex.KEY)) {
        for(String templateName: templateNames) {
            FileBasedIndex.getInstance().getFilesWithKey(key, new HashSet<>(Collections.singletonList(templateName)), virtualFile -> {
                virtualFiles.add(virtualFile);
                return true;
            }, GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.allScope(project), BladeFileType.INSTANCE));
        }
    }

    return PsiElementUtils.convertVirtualFilesToPsiFiles(project, virtualFiles);
}
项目:idea-php-laravel-plugin    文件:LaravelLightCodeInsightFixtureTestCase.java   
public void assertIndex(@NotNull ID<String, ?> id, boolean notCondition, @NotNull String... keys) {
    for (String key : keys) {

        final Collection<VirtualFile> virtualFiles = new ArrayList<VirtualFile>();

        FileBasedIndexImpl.getInstance().getFilesWithKey(id, new HashSet<String>(Arrays.asList(key)), new Processor<VirtualFile>() {
            @Override
            public boolean process(VirtualFile virtualFile) {
                virtualFiles.add(virtualFile);
                return true;
            }
        }, GlobalSearchScope.allScope(getProject()));

        if(notCondition && virtualFiles.size() > 0) {
            fail(String.format("Fail that ID '%s' not contains '%s'", id.toString(), key));
        } else if(!notCondition && virtualFiles.size() == 0) {
            fail(String.format("Fail that ID '%s' contains '%s'", id.toString(), key));
        }
    }
}
项目:idea-php-shopware-plugin    文件:ShopwareLightCodeInsightFixtureTestCase.java   
public void assertIndex(@NotNull ID<String, ?> id, boolean notCondition, @NotNull String... keys) {
    for (String key : keys) {

        final Collection<VirtualFile> virtualFiles = new ArrayList<VirtualFile>();

        FileBasedIndexImpl.getInstance().getFilesWithKey(id, new HashSet<String>(Arrays.asList(key)), new Processor<VirtualFile>() {
            @Override
            public boolean process(VirtualFile virtualFile) {
                virtualFiles.add(virtualFile);
                return true;
            }
        }, GlobalSearchScope.allScope(getProject()));

        if(notCondition && virtualFiles.size() > 0) {
            fail(String.format("Fail that ID '%s' not contains '%s'", id.toString(), key));
        } else if(!notCondition && virtualFiles.size() == 0) {
            fail(String.format("Fail that ID '%s' contains '%s'", id.toString(), key));
        }
    }
}
项目:idea-php-drupal-symfony2-bridge    文件:DrupalLightCodeInsightFixtureTestCase.java   
public void assertIndex(@NotNull ID<String, ?> id, boolean notCondition, @NotNull String... keys) {
    for (String key : keys) {

        final Collection<VirtualFile> virtualFiles = new ArrayList<VirtualFile>();

        FileBasedIndexImpl.getInstance().getFilesWithKey(id, new HashSet<String>(Arrays.asList(key)), new Processor<VirtualFile>() {
            @Override
            public boolean process(VirtualFile virtualFile) {
                virtualFiles.add(virtualFile);
                return true;
            }
        }, GlobalSearchScope.allScope(getProject()));

        if(notCondition && virtualFiles.size() > 0) {
            fail(String.format("Fail that ID '%s' not contains '%s'", id.toString(), key));
        } else if(!notCondition && virtualFiles.size() == 0) {
            fail(String.format("Fail that ID '%s' contains '%s'", id.toString(), key));
        }
    }
}
项目:tools-idea    文件:IndexedRelevantResource.java   
public static <K, V extends Comparable> List<IndexedRelevantResource<K, V>> getResources(ID<K, V> indexId,
                                                                                         final K key,
                                                                                         @Nullable final Module module,
                                                                                         @NotNull Project project,
                                                                                         @Nullable final GlobalSearchScope additionalScope) {

  if (project.isDefault()) return Collections.emptyList();
  final ArrayList<IndexedRelevantResource<K, V>> resources = new ArrayList<IndexedRelevantResource<K, V>>();
  final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  FileBasedIndex.getInstance().processValues(indexId, key, null, new FileBasedIndex.ValueProcessor<V>() {
    public boolean process(VirtualFile file, V value) {
      ResourceRelevance relevance = ResourceRelevance.getRelevance(file, module, fileIndex, additionalScope);
      if (relevance != ResourceRelevance.NONE) {
        resources.add(new IndexedRelevantResource<K, V>(file, key, value, relevance));
      }
      return true;
    }
  }, new AdditionalIndexedRootsScope(GlobalSearchScope.allScope(project)));
  return resources;
}
项目:tools-idea    文件:IndexedRelevantResource.java   
public static <K, V extends Comparable> List<IndexedRelevantResource<K, V>> getAllResources(ID<K, V> indexId,
                                                                                            @Nullable final Module module,
                                                                                            @NotNull Project project,
                                                                                            @Nullable NullableFunction<List<IndexedRelevantResource<K, V>>, IndexedRelevantResource<K, V>> chooser) {
  ArrayList<IndexedRelevantResource<K, V>> all = new ArrayList<IndexedRelevantResource<K, V>>();
  Collection<K> allKeys = FileBasedIndex.getInstance().getAllKeys(indexId, project);
  for (K key : allKeys) {
    List<IndexedRelevantResource<K, V>> resources = getResources(indexId, key, module, project, null);
    if (!resources.isEmpty()) {
      if (chooser == null) {
        all.add(resources.get(0));
      }
      else {
        IndexedRelevantResource<K, V> resource = chooser.fun(resources);
        if (resource != null) {
          all.add(resource);
        }
      }
    }
  }
  return all;
}
项目:emberjs-plugin    文件:EmberJSIndexingHandler.java   
private static void storeAdditionalData(final JSSymbolVisitor visitor,
                                        final ID<String, Void> index,
                                        final PsiElement declaration,
                                        final String command,
                                        final String argumentText,
                                        final int offset,
                                        final String value) {
    final Function<String, String> converter = NAME_CONVERTERS.get(command);
    final String defaultName = StringUtil.unquoteString(argumentText);
    final String name = converter != null ? converter.fun(argumentText) : defaultName;
    visitor.storeAdditionalData(declaration, index.toString(), name, offset, value);
    visitor.storeAdditionalData(declaration, EmberSymbolIndex.INDEX_ID.toString(), name, offset, null);
    if (!StringUtil.equals(defaultName, name)) {
        visitor.storeAdditionalData(declaration, EmberSymbolIndex.INDEX_ID.toString(), defaultName, offset, null);
    }
}
项目:idea-php-symfony2-plugin    文件:FileIndexCaches.java   
/**
 * @param dataHolderKey Main data to cache
 * @param dataHolderNames Cache extracted name Set
 */
static public synchronized <T> Map<String, List<T>> getSetDataCache(@NotNull final Project project, @NotNull Key<CachedValue<Map<String, List<T>>>> dataHolderKey, final @NotNull Key<CachedValue<Set<String>>> dataHolderNames, @NotNull final ID<String, T> ID, @NotNull final GlobalSearchScope scope) {

    CachedValue<Map<String, List<T>>> cache = project.getUserData(dataHolderKey);

    if(cache == null) {
        cache = CachedValuesManager.getManager(project).createCachedValue(() -> {
            Map<String, List<T>> items = new HashMap<>();

            final FileBasedIndex fileBasedIndex = FileBasedIndex.getInstance();

            getIndexKeysCache(project, dataHolderNames, ID).stream().forEach(service ->
                items.put(service, fileBasedIndex.getValues(ID, service, scope))
            );

            return CachedValueProvider.Result.create(items, PsiModificationTracker.MODIFICATION_COUNT);
        }, false);

        project.putUserData(dataHolderKey, cache);
    }

    return cache.getValue();
}
项目:idea-php-symfony2-plugin    文件:IndexUtil.java   
public static void forceReindex() {
    ID<?,?>[] indexIds = new ID<?,?>[] {
        ContainerBuilderStubIndex.KEY,
        ContainerParameterStubIndex.KEY,
        DoctrineMetadataFileStubIndex.KEY,
        EventAnnotationStubIndex.KEY,
        FileResourcesIndex.KEY,
        PhpTwigTemplateUsageStubIndex.KEY,
        RoutesStubIndex.KEY,
        ServicesDefinitionStubIndex.KEY,
        ServicesTagStubIndex.KEY,
        TwigExtendsStubIndex.KEY,
        TwigIncludeStubIndex.KEY,
        TwigMacroFunctionStubIndex.KEY,
        TranslationStubIndex.KEY,
        TwigBlockIndexExtension.KEY
    };

    for(ID<?,?> id: indexIds) {
        FileBasedIndex.getInstance().requestRebuild(id);
        FileBasedIndex.getInstance().scheduleRebuild(id, new Throwable());
    }
}
项目:idea-php-symfony2-plugin    文件:SymfonyLightCodeInsightFixtureTestCase.java   
public void assertIndex(@NotNull ID<String, ?> id, boolean notCondition, @NotNull String... keys) {
    for (String key : keys) {

        final Collection<VirtualFile> virtualFiles = new ArrayList<VirtualFile>();

        FileBasedIndex.getInstance().getFilesWithKey(id, new HashSet<String>(Arrays.asList(key)), new Processor<VirtualFile>() {
            @Override
            public boolean process(VirtualFile virtualFile) {
                virtualFiles.add(virtualFile);
                return true;
            }
        }, GlobalSearchScope.allScope(getProject()));

        if(notCondition && virtualFiles.size() > 0) {
            fail(String.format("Fail that ID '%s' not contains '%s'", id.toString(), key));
        } else if(!notCondition && virtualFiles.size() == 0) {
            fail(String.format("Fail that ID '%s' contains '%s'", id.toString(), key));
        }
    }
}
项目:idea-php-annotation-plugin    文件:AnnotationLightCodeInsightFixtureTestCase.java   
public void assertIndex(@NotNull ID<String, ?> id, boolean notCondition, @NotNull String... keys) {
    for (String key : keys) {

        final Collection<VirtualFile> virtualFiles = new ArrayList<VirtualFile>();

        FileBasedIndex.getInstance().getFilesWithKey(id, new HashSet<>(Collections.singletonList(key)), virtualFile -> {
            virtualFiles.add(virtualFile);
            return true;
        }, GlobalSearchScope.allScope(getProject()));

        if(notCondition && virtualFiles.size() > 0) {
            fail(String.format("Fail that ID '%s' not contains '%s'", id.toString(), key));
        } else if(!notCondition && virtualFiles.size() == 0) {
            fail(String.format("Fail that ID '%s' contains '%s'", id.toString(), key));
        }
    }
}
项目:consulo-xml    文件:IndexedRelevantResource.java   
public static <K, V extends Comparable> List<IndexedRelevantResource<K, V>> getResources(ID<K, V> indexId,
                                                                                         final K key,
                                                                                         @Nullable final Module module,
                                                                                         @NotNull Project project,
                                                                                         @Nullable final GlobalSearchScope additionalScope) {

  if (project.isDefault()) return Collections.emptyList();
  final ArrayList<IndexedRelevantResource<K, V>> resources = new ArrayList<IndexedRelevantResource<K, V>>();
  final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  FileBasedIndex.getInstance().processValues(indexId, key, null, new FileBasedIndex.ValueProcessor<V>() {
    public boolean process(VirtualFile file, V value) {
      ResourceRelevance relevance = ResourceRelevance.getRelevance(file, module, fileIndex, additionalScope);
      if (relevance != ResourceRelevance.NONE) {
        resources.add(new IndexedRelevantResource<K, V>(file, key, value, relevance));
      }
      return true;
    }
  }, new AdditionalIndexedRootsScope(GlobalSearchScope.allScope(project)));
  return resources;
}
项目:consulo-xml    文件:IndexedRelevantResource.java   
public static <K, V extends Comparable> List<IndexedRelevantResource<K, V>> getAllResources(ID<K, V> indexId,
                                                                                            @Nullable final Module module,
                                                                                            @NotNull Project project,
                                                                                            @Nullable NullableFunction<List<IndexedRelevantResource<K, V>>, IndexedRelevantResource<K, V>> chooser) {
  ArrayList<IndexedRelevantResource<K, V>> all = new ArrayList<IndexedRelevantResource<K, V>>();
  Collection<K> allKeys = FileBasedIndex.getInstance().getAllKeys(indexId, project);
  for (K key : allKeys) {
    List<IndexedRelevantResource<K, V>> resources = getResources(indexId, key, module, project, null);
    if (!resources.isEmpty()) {
      if (chooser == null) {
        all.add(resources.get(0));
      }
      else {
        IndexedRelevantResource<K, V> resource = chooser.fun(resources);
        if (resource != null) {
          all.add(resource);
        }
      }
    }
  }
  return all;
}
项目:idea-php-dotenv-plugin    文件:DotEnvLightCodeInsightFixtureTestCase.java   
public <T> void assertIndexContainsKeyWithValue(@NotNull ID<String, T> id, @NotNull String key, @NotNull IndexValue.Assert<T> tAssert) {
    List<T> values = FileBasedIndexImpl.getInstance().getValues(id, key, GlobalSearchScope.allScope(getProject()));
    for (T t : values) {
        if(tAssert.match(t)) {
            return;
        }
    }

    fail(String.format("Fail that Key '%s' matches on of '%s' values", key, values.size()));
}
项目:intellij-plugin    文件:CoffigUtil.java   
@NotNull
public static Collection<VirtualFile> findCoffigFiles(Project project) {
    return FileBasedIndex.getInstance().getContainingFiles(
            ID.create("filetypes"),
            CoffigYamlFileType.INSTANCE,
            GlobalSearchScope.allScope(project));
}
项目:idea-php-laravel-plugin    文件:LaravelLightCodeInsightFixtureTestCase.java   
public <T> void assertIndexContainsKeyWithValue(@NotNull ID<String, T> id, @NotNull String key, @NotNull IndexValue.Assert<T> tAssert) {
    List<T> values = FileBasedIndexImpl.getInstance().getValues(id, key, GlobalSearchScope.allScope(getProject()));
    for (T t : values) {
        if(tAssert.match(t)) {
            return;
        }
    }

    fail(String.format("Fail that Key '%s' matches on of '%s' values", key, values.size()));
}
项目:idea-php-shopware-plugin    文件:ShopwareLightCodeInsightFixtureTestCase.java   
public <T> void assertIndexContainsKeyWithValue(@NotNull ID<String, T> id, @NotNull String key, @NotNull IndexValue.Assert<T> tAssert) {
    List<T> values = FileBasedIndexImpl.getInstance().getValues(id, key, GlobalSearchScope.allScope(getProject()));
    for (T t : values) {
        if(tAssert.match(t)) {
            return;
        }
    }

    fail(String.format("Fail that Key '%s' matches on of '%s' values", key, values.size()));
}
项目:idea-php-drupal-symfony2-bridge    文件:IndexUtil.java   
@NotNull
public static Collection<LookupElement> getIndexedKeyLookup(@NotNull Project project, @NotNull ID<String, ?> var1) {
    Collection<LookupElement> lookupElements = new ArrayList<>();

    lookupElements.addAll(SymfonyProcessors.createResult(project, var1).stream().map(
        s -> LookupElementBuilder.create(s).withIcon(DrupalIcons.DRUPAL)).collect(Collectors.toList())
    );

    return lookupElements;
}
项目:idea-php-drupal-symfony2-bridge    文件:DrupalLightCodeInsightFixtureTestCase.java   
public <T> void assertIndexContainsKeyWithValue(@NotNull ID<String, T> id, @NotNull String key, @NotNull IndexValue.Assert<T> tAssert) {
    List<T> values = FileBasedIndexImpl.getInstance().getValues(id, key, GlobalSearchScope.allScope(getProject()));
    for (T t : values) {
        if(tAssert.match(t)) {
            return;
        }
    }

    fail(String.format("Fail that Key '%s' matches on of '%s' values", key, values.size()));
}
项目:emberjs-plugin    文件:EmberJSAttributeDescriptorsProvider.java   
private static ThreeState isApplicable(Project project, String componentName, String tagName, final ID<String, Void> index) {
    final JSNamedElementProxy component = EmberIndexUtil.resolve(project, index, componentName);
    if (component == null) {
        return ThreeState.UNSURE;
    }

    return ThreeState.YES;
}
项目:idea-php-symfony2-plugin    文件:SymfonyProcessors.java   
@Deprecated
public CollectProjectUniqueKeysStrong(@NotNull Project project, @NotNull ID<String, ?>  id, @NotNull Collection<String> strongKeys) {
    this.project = project;
    this.id = id;
    this.strongKeys = strongKeys;
    this.stringSet = new HashSet<>();
}
项目:idea-php-symfony2-plugin    文件:FileIndexCaches.java   
/**
 * @param dataHolderKey Main data to cache
 * @param dataHolderNames Cache extracted name Set
 */
static public synchronized Map<String, List<String>> getStringDataCache(@NotNull final Project project, @NotNull Key<CachedValue<Map<String, List<String>>>> dataHolderKey, final @NotNull Key<CachedValue<Set<String>>> dataHolderNames, @NotNull final ID<String, String> ID, @NotNull final GlobalSearchScope scope) {

    CachedValue<Map<String, List<String>>> cache = project.getUserData(dataHolderKey);
    if(cache == null) {
        cache = CachedValuesManager.getManager(project).createCachedValue(() -> {

            Map<String, List<String>> strings = new HashMap<>();

            final FileBasedIndex fileBasedIndex = FileBasedIndex.getInstance();
            getIndexKeysCache(project, dataHolderNames, ID).stream().forEach(parameterName -> {
                // just for secure
                if(parameterName == null) {
                    return;
                }

                strings.put(parameterName, fileBasedIndex.getValues(ID, parameterName, scope));
            });

            return CachedValueProvider.Result.create(strings, PsiModificationTracker.MODIFICATION_COUNT);
        }, false);

        project.putUserData(dataHolderKey, cache);
    }

    return cache.getValue();
}
项目:idea-php-symfony2-plugin    文件:FileIndexCaches.java   
/**
 * There several methods that just need to check for names, as they also needed for value extraction, so cache them also
 */
static public synchronized Set<String> getIndexKeysCache(@NotNull final Project project, @NotNull Key<CachedValue<Set<String>>> dataHolderKey, @NotNull final ID<String, ?> ID) {

    CachedValue<Set<String>> cache = project.getUserData(dataHolderKey);

    if(cache == null) {
        cache = CachedValuesManager.getManager(project).createCachedValue(() ->
            CachedValueProvider.Result.create(SymfonyProcessors.createResult(project, ID), PsiModificationTracker.MODIFICATION_COUNT), false
        );

        project.putUserData(dataHolderKey, cache);
    }

    return cache.getValue();
}
项目:idea-php-symfony2-plugin    文件:SymfonyLightCodeInsightFixtureTestCase.java   
public <T> void assertIndexContainsKeyWithValue(@NotNull ID<String, T> id, @NotNull String key, @NotNull IndexValue.Assert<T> tAssert) {
    List<T> values = FileBasedIndex.getInstance().getValues(id, key, GlobalSearchScope.allScope(getProject()));
    for (T t : values) {
        if(tAssert.match(t)) {
            return;
        }
    }

    fail(String.format("Fail that Key '%s' matches on of '%s' values", key, values.size()));
}
项目:idea-php-annotation-plugin    文件:PluginUtil.java   
/**
 * Force reindex of all internal file indexes
 */
public static void forceReindex() {
    ID<?,?>[] indexIds = new ID<?,?>[] {
        AnnotationStubIndex.KEY,
        AnnotationUsageIndex.KEY,
    };

    for(ID<?,?> id: indexIds) {
        FileBasedIndex.getInstance().requestRebuild(id);
        FileBasedIndex.getInstance().scheduleRebuild(id, new Throwable());
    }
}
项目:idea-php-annotation-plugin    文件:AnnotationLightCodeInsightFixtureTestCase.java   
public <T> void assertIndexContainsKeyWithValue(@NotNull ID<String, T> id, @NotNull String key, @NotNull IndexValue.Assert<T> tAssert) {
    List<T> values = FileBasedIndex.getInstance().getValues(id, key, GlobalSearchScope.allScope(getProject()));
    for (T t : values) {
        if(tAssert.match(t)) {
            return;
        }
    }

    fail(String.format("Fail that Key '%s' matches on of '%s' values", key, values.size()));
}
项目:consulo    文件:CompilerServerFileBasedIndexImpl.java   
@Nonnull
@Override
public <K, V> Collection<VirtualFile> getContainingFiles(@Nonnull ID<K, V> indexId,
                                                         @Nonnull K dataKey,
                                                         @Nonnull GlobalSearchScope filter) {
  return Collections.emptyList();
}
项目:consulo    文件:CompilerServerFileBasedIndexImpl.java   
@Override
public <K, V> boolean processValues(@Nonnull ID<K, V> indexId,
                                    @Nonnull K dataKey,
                                    @Nullable VirtualFile inFile,
                                    @Nonnull ValueProcessor<V> processor,
                                    @Nonnull GlobalSearchScope filter) {
  return false;
}
项目:consulo    文件:CompilerServerFileBasedIndexImpl.java   
@Override
public <K, V> boolean processFilesContainingAllKeys(@Nonnull ID<K, V> indexId,
                                                    @Nonnull Collection<K> dataKeys,
                                                    @Nonnull GlobalSearchScope filter,
                                                    @Nullable Condition<V> valueChecker,
                                                    @Nonnull Processor<VirtualFile> processor) {
  return false;
}
项目:consulo    文件:CompilerServerFileBasedIndexImpl.java   
@Override
public <K, V> boolean getFilesWithKey(@Nonnull ID<K, V> indexId,
                                      @Nonnull Set<K> dataKeys,
                                      @Nonnull Processor<VirtualFile> processor,
                                      @Nonnull GlobalSearchScope filter) {
  return false;
}
项目:consulo    文件:UpdateData.java   
public UpdateData(@Nonnull Map<Key, Value> newData,
                  @Nonnull ThrowableComputable<InputDataDiffBuilder<Key, Value>, IOException> currentDataEvaluator,
                  @Nonnull ID<Key, Value> indexId,
                  @Nullable ThrowableRunnable<IOException> forwardIndexUpdate) {
  myNewData = newData;
  myCurrentDataEvaluator = currentDataEvaluator;
  myIndexId = indexId;
  myForwardIndexUpdate = forwardIndexUpdate;
}
项目:idea-php-typo3-plugin    文件:MethodArgumentDroppedIndex.java   
@NotNull
@Override
public ID<String, Integer> getName() {
    return KEY;
}
项目:magento2-phpstorm-plugin    文件:LayoutIndex.java   
public static Collection<String> getAllKeys(ID<String, Void> id, Project project) {
    return FileBasedIndex.getInstance().getAllKeys(id, project);
}