本文整理汇总了Java中com.intellij.util.indexing.IdFilter类的典型用法代码示例。如果您正苦于以下问题:Java IdFilter类的具体用法?Java IdFilter怎么用?Java IdFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IdFilter类属于com.intellij.util.indexing包,在下文中一共展示了IdFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNames
import com.intellij.util.indexing.IdFilter; //导入依赖的package包/类
@Override
@NotNull
public String[] getNames(Project project, boolean includeNonProjectItems) {
if (FileBasedIndex.ourEnableTracingOfKeyHashToVirtualFileMapping) {
final THashSet<String> names = new THashSet<String>(1000);
IdFilter filter = IdFilter.getProjectIdFilter(project, includeNonProjectItems);
processNames(new Processor<String>() {
@Override
public boolean process(String s) {
names.add(s);
return true;
}
}, FindSymbolParameters.searchScopeFor(project, includeNonProjectItems), filter);
if (IdFilter.LOG.isDebugEnabled()) {
IdFilter.LOG.debug("All names retrieved2:" + names.size());
}
return ArrayUtil.toStringArray(names);
} else {
return FilenameIndex.getAllFilenames(project);
}
}
示例2: hasStubElementsOfType
import com.intellij.util.indexing.IdFilter; //导入依赖的package包/类
public boolean hasStubElementsOfType(final DomFileElement domFileElement,
final Class<? extends DomElement> clazz) {
final VirtualFile file = domFileElement.getFile().getVirtualFile();
if (!(file instanceof VirtualFileWithId)) return false;
final String clazzName = clazz.getName();
final int virtualFileId = ((VirtualFileWithId)file).getId();
CommonProcessors.FindFirstProcessor<? super PsiFile> processor =
new CommonProcessors.FindFirstProcessor<PsiFile>();
StubIndex.getInstance().processElements(KEY, clazzName,
domFileElement.getFile().getProject(),
GlobalSearchScope.fileScope(domFileElement.getFile()),
new IdFilter() {
@Override
public boolean containsFileId(int id) {
return id == virtualFileId;
}
},
PsiFile.class,
processor
);
return processor.isFound();
}
示例3: hasStubElementsWithNamespaceKey
import com.intellij.util.indexing.IdFilter; //导入依赖的package包/类
public boolean hasStubElementsWithNamespaceKey(final DomFileElement domFileElement, final String namespaceKey) {
final VirtualFile file = domFileElement.getFile().getVirtualFile();
if (!(file instanceof VirtualFileWithId)) return false;
final int virtualFileId = ((VirtualFileWithId)file).getId();
CommonProcessors.FindFirstProcessor<PsiFile> processor = new CommonProcessors.FindFirstProcessor<PsiFile>();
StubIndex.getInstance().processElements(
KEY,
namespaceKey,
domFileElement.getFile().getProject(),
GlobalSearchScope.fileScope(domFileElement.getFile()),
new IdFilter() {
@Override
public boolean containsFileId(int id) {
return id == virtualFileId;
}
},
PsiFile.class,
processor
);
return processor.isFound();
}
示例4: ByItem
import com.intellij.util.indexing.IdFilter; //导入依赖的package包/类
ByItem(final Converter converter,
final Map<String,Set<String>> globalFields, final Map<String,Set<String>> globalMethods,
final List<TypeNameItemNamePair> pairFields, final List<TypeNameItemNamePair> pairMethods,
final List<Item> locals,
final GlobalSearchScope scope, final IdFilter filter) {
this.converter = converter;
final ByItemMaps maps = JavaItems.valuesByItem(locals, true); // locals byItem map contains an entry for ObjectItem
this.localValues = maps.values;
this.localMethods = maps.methods;
this.globalFields = globalFields;
this.globalMethods = globalMethods;
this.pairFields = pairFields;
this.pairMethods = pairMethods;
this.psiCache = PsiShortNamesCache.getInstance(converter.project);
this.scope = scope;
this.filter = filter;
}
示例5: getClassesByName
import com.intellij.util.indexing.IdFilter; //导入依赖的package包/类
@NotNull
@Override
@RequiredReadAction
public PsiClass[] getClassesByName(@NotNull @NonNls String s, @NotNull GlobalSearchScope globalSearchScope)
{
CommonProcessors.CollectProcessor<DotNetTypeDeclaration> collectProcessor = new CommonProcessors.CollectProcessor<DotNetTypeDeclaration>();
DotNetShortNameSearcher.getInstance(myProject).collectTypes(s, globalSearchScope, IdFilter.getProjectIdFilter(myProject, false),
collectProcessor);
Collection<DotNetTypeDeclaration> results = collectProcessor.getResults();
List<PsiClass> classes = new ArrayList<PsiClass>(results.size());
for(DotNetTypeDeclaration dotNetTypeDeclaration : results)
{
JavaClassStubBuilder javaClassStubBuilder = StubBuilder.build(dotNetTypeDeclaration);
if(javaClassStubBuilder == null)
{
continue;
}
classes.add(javaClassStubBuilder.buildToPsi(null));
}
return ContainerUtil.toArray(classes, PsiClass.ARRAY_FACTORY);
}
示例6: processElementsWithName
import com.intellij.util.indexing.IdFilter; //导入依赖的package包/类
@Override
public void processElementsWithName(
@NotNull String name, @NotNull Processor<NavigationItem> navigationItemProcessor, @NotNull FindSymbolParameters findSymbolParameters)
{
Project project = findSymbolParameters.getProject();
IdFilter idFilter = findSymbolParameters.getIdFilter();
GlobalSearchScope searchScope = findSymbolParameters.getSearchScope();
StubIndex.getInstance().processElements(CSharpIndexKeys.METHOD_INDEX, name, project, searchScope, idFilter,
DotNetLikeMethodDeclaration.class, (Processor) navigationItemProcessor);
StubIndex.getInstance().processElements(CSharpIndexKeys.EVENT_INDEX, name, project, searchScope, idFilter,
DotNetEventDeclaration.class, (Processor) navigationItemProcessor);
StubIndex.getInstance().processElements(CSharpIndexKeys.PROPERTY_INDEX, name, project, searchScope, idFilter,
DotNetPropertyDeclaration.class, (Processor) navigationItemProcessor);
StubIndex.getInstance().processElements(CSharpIndexKeys.FIELD_INDEX, name, project, searchScope, idFilter,
DotNetFieldDeclaration.class, (Processor) navigationItemProcessor);
}
示例7: getNames
import com.intellij.util.indexing.IdFilter; //导入依赖的package包/类
@Override
@Nonnull
public String[] getNames(Project project, boolean includeNonProjectItems) {
if (FileBasedIndex.ourEnableTracingOfKeyHashToVirtualFileMapping) {
final THashSet<String> names = new THashSet<String>(1000);
IdFilter filter = IdFilter.getProjectIdFilter(project, includeNonProjectItems);
processNames(new Processor<String>() {
@Override
public boolean process(String s) {
names.add(s);
return true;
}
}, FindSymbolParameters.searchScopeFor(project, includeNonProjectItems), filter);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("All names retrieved2:" + names.size());
}
return ArrayUtil.toStringArray(names);
} else {
return FilenameIndex.getAllFilenames(project);
}
}
示例8: hasStubElementsOfType
import com.intellij.util.indexing.IdFilter; //导入依赖的package包/类
public boolean hasStubElementsOfType(final DomFileElement domFileElement, final Class<? extends DomElement> clazz)
{
final VirtualFile file = domFileElement.getFile().getVirtualFile();
if(!(file instanceof VirtualFileWithId))
{
return false;
}
final String clazzName = clazz.getName();
final int virtualFileId = ((VirtualFileWithId) file).getId();
CommonProcessors.FindFirstProcessor<? super PsiFile> processor = new CommonProcessors.FindFirstProcessor<PsiFile>();
StubIndex.getInstance().process(KEY, clazzName, domFileElement.getFile().getProject(), GlobalSearchScope.fileScope(domFileElement.getFile())
, new IdFilter()
{
@Override
public boolean containsFileId(int id)
{
return id == virtualFileId;
}
}, processor);
return processor.isFound();
}
示例9: hasStubElementsWithNamespaceKey
import com.intellij.util.indexing.IdFilter; //导入依赖的package包/类
public boolean hasStubElementsWithNamespaceKey(final DomFileElement domFileElement, final String namespaceKey)
{
final VirtualFile file = domFileElement.getFile().getVirtualFile();
if(!(file instanceof VirtualFileWithId))
{
return false;
}
final int virtualFileId = ((VirtualFileWithId) file).getId();
CommonProcessors.FindFirstProcessor<PsiFile> processor = new CommonProcessors.FindFirstProcessor<PsiFile>();
StubIndex.getInstance().process(KEY, namespaceKey, domFileElement.getFile().getProject(), GlobalSearchScope.fileScope(domFileElement.getFile
()), new IdFilter()
{
@Override
public boolean containsFileId(int id)
{
return id == virtualFileId;
}
}, processor);
return processor.isFound();
}
示例10: processFieldsWithName
import com.intellij.util.indexing.IdFilter; //导入依赖的package包/类
@Override
public boolean processFieldsWithName(@NotNull String name,
@NotNull Processor<? super PsiField> processor,
@NotNull GlobalSearchScope scope,
@Nullable IdFilter filter) {
return StubIndex.getInstance().processElements(JavaStubIndexKeys.FIELDS, name, myManager.getProject(), new JavaSourceFilterScope(scope),
filter, PsiField.class, processor);
}
示例11: processMethodsWithName
import com.intellij.util.indexing.IdFilter; //导入依赖的package包/类
@Override
public boolean processMethodsWithName(@NonNls @NotNull String name,
@NotNull Processor<? super PsiMethod> processor,
@NotNull GlobalSearchScope scope,
@Nullable IdFilter filter) {
return StubIndex.getInstance().processElements(JavaStubIndexKeys.METHODS, name, myManager.getProject(),
new JavaSourceFilterScope(scope), filter, PsiMethod.class, processor);
}
示例12: processClassesWithName
import com.intellij.util.indexing.IdFilter; //导入依赖的package包/类
@Override
public boolean processClassesWithName(@NotNull String name,
@NotNull Processor<? super PsiClass> processor,
@NotNull GlobalSearchScope scope,
@Nullable IdFilter filter) {
return StubIndex.getInstance().processElements(JavaStubIndexKeys.CLASS_SHORT_NAMES, name, myManager.getProject(),
new JavaSourceFilterScope(scope), filter, PsiClass.class, processor);
}
示例13: processClassNames
import com.intellij.util.indexing.IdFilter; //导入依赖的package包/类
public static Project processClassNames(final Project project, final GlobalSearchScope scope, final Consumer<String> consumer) {
final ProgressIndicator indicator = ProgressIndicatorProvider.getGlobalProgressIndicator();
MethodUsagesSearcher.resolveInReadAction(project, new Computable<Void>() {
@Override
public Void compute() {
PsiShortNamesCache.getInstance(project).processAllClassNames(new Processor<String>() {
int i = 0;
@Override
public boolean process(String s) {
if (indicator != null && i++ % 512 == 0) {
indicator.checkCanceled();
}
consumer.consume(s);
return true;
}
}, scope, IdFilter.getProjectIdFilter(project, true));
return null;
}
});
if (indicator != null) {
indicator.checkCanceled();
}
return project;
}
示例14: processAllClassNames
import com.intellij.util.indexing.IdFilter; //导入依赖的package包/类
@Override
public boolean processAllClassNames(Processor<String> processor, GlobalSearchScope scope, IdFilter filter) {
for (PsiShortNamesCache cache : myCaches) {
if (!cache.processAllClassNames(processor, scope, filter)) {
return false;
}
}
return true;
}
示例15: processAllMethodNames
import com.intellij.util.indexing.IdFilter; //导入依赖的package包/类
@Override
public boolean processAllMethodNames(Processor<String> processor, GlobalSearchScope scope, IdFilter filter) {
for (PsiShortNamesCache cache : myCaches) {
if (!cache.processAllMethodNames(processor, scope, filter)) {
return false;
}
}
return true;
}