com.intellij.util.Query.findAll()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(95)

本文整理了Java中com.intellij.util.Query.findAll方法的一些代码示例,展示了Query.findAll的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.findAll方法的具体详情如下:
包路径:com.intellij.util.Query
类名称:Query
方法名:findAll

Query.findAll介绍

暂无

代码示例

代码示例来源:origin: mustfun/mybatis-plus

@NotNull
@Override
public Set<AliasDesc> getClassAliasDescriptions(@Nullable PsiElement element) {
 Optional<PsiClass> clazz = Annotation.ALIAS.toPsiClass(project);
 if (clazz.isPresent()) {
  Collection<PsiClass> res = AnnotatedElementsSearch.searchPsiClasses(clazz.get(), GlobalSearchScope.allScope(project)).findAll();
  return Sets.newHashSet(Collections2.transform(res, FUN));
 }
 return Collections.emptySet();
}

代码示例来源:origin: AlexanderBartash/hybris-integration-intellij-idea-plugin

public static ImpexProcessorModifierValue[] values() {
  final Project project = currentProject();
  final PsiClass clazz;
  if (project != null) {
    clazz = JavaPsiFacade.getInstance(project)
               .findClass(
                 "de.hybris.platform.impex.jalo.imp.ImportProcessor",
                 allScope(project)
               );
    if (clazz != null) {
      final Query<PsiClass> psiClasses = ClassInheritorsSearch.search(clazz, allScope(project), true);
      return psiClasses.findAll()
               .stream()
               .map(ImpexProcessorModifierValue::new)
               .toArray(ImpexProcessorModifierValue[]::new);
    }
  }
  return new ImpexProcessorModifierValue[]{};
}

代码示例来源:origin: BashSupport/BashSupport

/**
 * Returns references to the given element. If it is a BashPsiElement a special search scope is used to locate the elements referencing the file.
 *
 * @param element References to the given element
 * @return
 */
@NotNull
@Override
public Collection<PsiReference> findReferences(PsiElement element) {
  //fixme fix the custom scope
  SearchScope scope = (element instanceof BashPsiElement)
      ? BashElementSharedImpl.getElementUseScope((BashPsiElement) element, element.getProject())
      : GlobalSearchScope.projectScope(element.getProject());
  Query<PsiReference> search = ReferencesSearch.search(element, scope);
  return search.findAll();
}

代码示例来源:origin: Camelcade/Perl5-IDEA

boolean globScanned = element instanceof PerlGlobVariable;
for (PsiReference reference : ReferencesSearch.search(element, element.getUseScope()).findAll()) {
 if (reference instanceof PsiPolyVariantReference) {
  for (ResolveResult resolveResult : ((PsiPolyVariantReference)reference).multiResolve(false)) {

代码示例来源:origin: halirutan/Mathematica-IntelliJ-Plugin

final Collection<PsiReference> all1 = all.findAll();
return all1;

代码示例来源:origin: halirutan/Mathematica-IntelliJ-Plugin

@NotNull
@Override
public Collection<PsiReference> findReferences(PsiElement element) {
 final Collection<PsiReference> references = super.findReferences(element);
 final Collection<PsiReference> all = ReferencesSearch.search(element).findAll();
 PsiReference elementRef = element.getReference();
 PsiElement definitionElement;
 if (elementRef != null) {
  definitionElement = elementRef.resolve();
  if (definitionElement instanceof Symbol) {
   SymbolCollector collector = new SymbolCollector((Symbol) definitionElement);
   element.getContainingFile().accept(collector);
   references.addAll(collector.myReferences);
  }
 }
 return references;
}

代码示例来源:origin: com.github.adedayo.intellij.sdk/java-psi-api

public PackageScope(@NotNull PsiPackage aPackage, boolean includeSubpackages, final boolean includeLibraries) {
 super(aPackage.getProject());
 myPackage = aPackage;
 myIncludeSubpackages = includeSubpackages;
 Project project = myPackage.getProject();
 myPackageQualifiedName = myPackage.getQualifiedName();
 myDirs = PackageIndex.getInstance(project).getDirsByPackageName(myPackageQualifiedName, true).findAll();
 myIncludeLibraries = includeLibraries;
 myPartOfPackagePrefix = JavaPsiFacade.getInstance(getProject()).isPartOfPackagePrefix(myPackageQualifiedName);
 myPackageQNamePrefix = myPackageQualifiedName + ".";
}

代码示例来源:origin: JetBrains/Grammar-Kit

totalVisited.add((BnfRule)parent)) {
BnfRule rule = (BnfRule)parent;
for (PsiReference reference : ReferencesSearch.search(rule, rule.getUseScope()).findAll()) {
 PsiElement element = reference.getElement();
 if (element instanceof BnfExpression && PsiTreeUtil.getParentOfType(element, BnfPredicate.class) == null) {

代码示例来源:origin: halirutan/Mathematica-IntelliJ-Plugin

usages.add(element);
final Collection<PsiReference> refs = ReferencesSearch.search(element).findAll();
for (PsiReference ref : refs) {
 usages.add(ref.getElement());

代码示例来源:origin: huoguangjin/MultiHighlight

Collection<PsiReference> refs =
    findUsagesHandler != null ? findUsagesHandler.findReferencesToHighlight(target,
        scope) : ReferencesSearch.search(target, scope).findAll();
for (PsiReference psiReference : refs) {
  if (psiReference == null) {

代码示例来源:origin: Camelcade/Perl5-IDEA

@Override
public void run() {
 for (PsiReference reference : ReferencesSearch.search(file, file.getUseScope()).findAll()) {
  PerlPsiUtil.renameElement(reference.getElement(), newName);

代码示例来源:origin: Camelcade/Perl5-IDEA

@Override
public void prepareMovedFile(PsiFile file, PsiDirectory moveDestination, Map<PsiElement, PsiElement> oldToNewMap) {
 file.putUserData(ORIGINAL_PACKAGE_NAME, ((PerlFileImpl)file).getFilePackageName());
 String newFilePath = moveDestination.getVirtualFile().getPath() + '/' + file.getName();
 VirtualFile newClassRoot = PerlUtil.getFileClassRoot(moveDestination.getProject(), newFilePath);
 if (newClassRoot != null) {
  String newRelativePath = newFilePath.substring(newClassRoot.getPath().length());
  String newPackageName = PerlPackageUtil.getPackageNameByPath(newRelativePath);
  if (newPackageName != null) {
   for (PsiReference reference : ReferencesSearch.search(file, file.getUseScope()).findAll()) {
    PerlPsiUtil.renameElement(reference.getElement(), newPackageName);
   }
  }
 }
}

代码示例来源:origin: Camelcade/Perl5-IDEA

@Override
 public void computeUsages(List<PsiElement> targets) {
  if (targets == null) {
   return;
  }
  for (PsiElement target : targets) {
   if (myFile.equals(target.getContainingFile()) && target instanceof PsiNameIdentifierOwner) {
    PsiElement nameIdentifier = ((PsiNameIdentifierOwner)target).getNameIdentifier();
    if (nameIdentifier != null) {
     TextRange rangeInIdentifier = target instanceof PerlIdentifierRangeProvider
                    ? ((PerlIdentifierRangeProvider)target).getRangeInIdentifier()
                    : ElementManipulators.getValueTextRange(nameIdentifier);
     myWriteUsages.add(rangeInIdentifier.shiftRight(nameIdentifier.getNode().getStartOffset()));
    }
   }
   for (PsiReference reference : ReferencesSearch.search(target, new LocalSearchScope(myFile)).findAll()) {
    myReadUsages.add(reference.getRangeInElement().shiftRight(reference.getElement().getNode().getStartOffset()));
   }
  }
 }
}

代码示例来源:origin: JetBrains/Grammar-Kit

Collection<PsiReference> allReferences = ReferencesSearch.search(psiElement).findAll();
if (allReferences.isEmpty()) {
 CommonRefactoringUtil.showErrorHint(project, editor, "Rule is never used", "Inline Rule", null);

相关文章