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


Java ID类代码示例

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


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

示例1: manualReindex

import com.intellij.util.indexing.ID; //导入依赖的package包/类
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());
    }
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:26,代码来源:IndexManager.java

示例2: getComponentDeclarations

import com.intellij.util.indexing.ID; //导入依赖的package包/类
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;
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:26,代码来源:LayoutIndex.java

示例3: assertIndex

import com.intellij.util.indexing.ID; //导入依赖的package包/类
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));
        }
    }
}
 
开发者ID:adelf,项目名称:idea-php-dotenv-plugin,代码行数:21,代码来源:DotEnvLightCodeInsightFixtureTestCase.java

示例4: getResources

import com.intellij.util.indexing.ID; //导入依赖的package包/类
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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:IndexedRelevantResource.java

示例5: getAllResources

import com.intellij.util.indexing.ID; //导入依赖的package包/类
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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:IndexedRelevantResource.java

示例6: getComponentDeclarations

import com.intellij.util.indexing.ID; //导入依赖的package包/类
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;
}
 
开发者ID:dkvashninbay,项目名称:magento2plugin,代码行数:26,代码来源:LayoutIndexUtility.java

示例7: manualReindex

import com.intellij.util.indexing.ID; //导入依赖的package包/类
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());
    }
}
 
开发者ID:dkvashninbay,项目名称:magento2plugin,代码行数:27,代码来源:IndexUtil.java

示例8: compute

import com.intellij.util.indexing.ID; //导入依赖的package包/类
@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);
}
 
开发者ID:Haehnchen,项目名称:idea-php-laravel-plugin,代码行数:17,代码来源:TemplateLineMarker.java

示例9: getResources

import com.intellij.util.indexing.ID; //导入依赖的package包/类
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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:IndexedRelevantResource.java

示例10: storeAdditionalData

import com.intellij.util.indexing.ID; //导入依赖的package包/类
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);
    }
}
 
开发者ID:kristianmandrup,项目名称:emberjs-plugin,代码行数:17,代码来源:EmberJSIndexingHandler.java

示例11: getSetDataCache

import com.intellij.util.indexing.ID; //导入依赖的package包/类
/**
 * @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();
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:27,代码来源:FileIndexCaches.java

示例12: forceReindex

import com.intellij.util.indexing.ID; //导入依赖的package包/类
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());
    }
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:24,代码来源:IndexUtil.java

示例13: assertIndex

import com.intellij.util.indexing.ID; //导入依赖的package包/类
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));
        }
    }
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:21,代码来源:SymfonyLightCodeInsightFixtureTestCase.java

示例14: assertIndex

import com.intellij.util.indexing.ID; //导入依赖的package包/类
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));
        }
    }
}
 
开发者ID:Haehnchen,项目名称:idea-php-annotation-plugin,代码行数:18,代码来源:AnnotationLightCodeInsightFixtureTestCase.java

示例15: assertIndexContainsKeyWithValue

import com.intellij.util.indexing.ID; //导入依赖的package包/类
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()));
}
 
开发者ID:adelf,项目名称:idea-php-dotenv-plugin,代码行数:11,代码来源:DotEnvLightCodeInsightFixtureTestCase.java


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