コード例 #1
0
  @Nullable
  public PsiPackage findPackage(@NotNull String qualifiedName) {
    PsiPackage psiPackage = javaFileManager.findPackage(qualifiedName);
    if (psiPackage != null) {
      return psiPackage;
    }

    for (PsiElementFinder finder : extensionPsiElementFinders) {
      psiPackage = finder.findPackage(qualifiedName);
      if (psiPackage != null) {
        return psiPackage;
      }
    }
    return psiPackage;
  }
コード例 #2
0
  public PsiClass findClass(@NotNull final String qualifiedName, @NotNull GlobalSearchScope scope) {
    ProgressIndicatorProvider
        .checkCanceled(); // We hope this method is being called often enough to cancel daemon
                          // processes smoothly

    PsiClass aClass = javaFileManager.findClass(qualifiedName, scope);
    if (aClass != null) {
      return aClass;
    }

    for (PsiElementFinder finder : extensionPsiElementFinders) {
      aClass = finder.findClass(qualifiedName, scope);
      if (aClass != null) {
        return aClass;
      }
    }

    return null;
  }
コード例 #3
0
  @NotNull
  private PsiClass[] findClassesInDumbMode(
      @NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
    String packageName = StringUtil.getPackageName(qualifiedName);
    PsiJavaPackage pkg = findPackage(packageName, scope);
    String className = StringUtil.getShortName(qualifiedName);
    if (pkg == null && packageName.length() < qualifiedName.length()) {
      PsiClass[] containingClasses = findClassesInDumbMode(packageName, scope);
      if (containingClasses.length == 1) {
        return PsiElementFinder.filterByName(className, containingClasses[0].getInnerClasses());
      }

      return PsiClass.EMPTY_ARRAY;
    }

    if (pkg == null || !pkg.containsClassNamed(className)) {
      return PsiClass.EMPTY_ARRAY;
    }

    return pkg.findClassByShortName(className, scope);
  }
コード例 #4
0
 @Override
 public String toString() {
   return finder.toString();
 }
コード例 #5
0
 @Override
 public PsiJavaPackage findPackage(
     @NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
   // Original element finder can't search packages with scope
   return finder.findPackage(qualifiedName);
 }
コード例 #6
0
 @Override
 public PsiClass findClass(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
   return finder.findClass(qualifiedName, scope);
 }