コード例 #1
0
 @NotNull
 private Set<PsiPackage> getContext() {
   if (myIndex == 0) return myReferenceSet.getInitialContext();
   Set<PsiPackage> psiPackages = new HashSet<>();
   for (ResolveResult resolveResult : myReferenceSet.getReference(myIndex - 1).doMultiResolve()) {
     PsiElement psiElement = resolveResult.getElement();
     if (psiElement instanceof PsiPackage) {
       psiPackages.add((PsiPackage) psiElement);
     }
   }
   return psiPackages;
 }
コード例 #2
0
 @NotNull
 protected ResolveResult[] doMultiResolve() {
   final Collection<PsiPackage> packages = new HashSet<>();
   for (PsiPackage parentPackage : getContext()) {
     packages.addAll(myReferenceSet.resolvePackageName(parentPackage, getValue()));
   }
   return PsiElementResolveResult.createResults(packages);
 }
コード例 #3
0
  @Override
  @NotNull
  public Object[] getVariants() {
    Set<PsiPackage> subPackages = new HashSet<>();
    for (PsiPackage psiPackage : getContext()) {
      subPackages.addAll(
          Arrays.asList(psiPackage.getSubPackages(myReferenceSet.getResolveScope())));
    }

    return subPackages.toArray();
  }
コード例 #4
0
 public PsiPackageReference(
     final PackageReferenceSet set, final TextRange range, final int index) {
   super(set.getElement(), range, set.isSoft());
   myReferenceSet = set;
   myIndex = index;
 }