Java Code Examples for com.intellij.psi.PsiClass#EMPTY_ARRAY

The following examples show how to use com.intellij.psi.PsiClass#EMPTY_ARRAY . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ComponentFinder.java    From litho with Apache License 2.0 5 votes vote down vote up
@Override
public PsiClass[] findClasses(String qualifiedName, GlobalSearchScope scope) {
  final PsiClass component = findClassInternal(qualifiedName, scope, project);
  if (component == null) {
    return PsiClass.EMPTY_ARRAY;
  }
  return new PsiClass[] {component};
}
 
Example 2
Source File: ComponentFinder.java    From litho with Apache License 2.0 5 votes vote down vote up
@Override
public PsiClass[] getClasses(PsiPackage psiPackage, GlobalSearchScope scope) {
  if (!scope.contains(dummyFile)) return PsiClass.EMPTY_ARRAY;

  // We don't create own package, but provide additional classes to existing one
  final String packageQN = psiPackage.getQualifiedName();
  return Arrays.stream(ComponentsCacheService.getInstance(project).getAllComponents())
      .filter(cls -> StringUtil.getPackageName(cls.getQualifiedName()).equals(packageQN))
      .toArray(PsiClass[]::new);
}
 
Example 3
Source File: ComponentShortNamesCache.java    From litho with Apache License 2.0 5 votes vote down vote up
@Override
public PsiClass[] getClassesByName(String name, GlobalSearchScope scope) {
  if (!scope.contains(dummyFile)) return PsiClass.EMPTY_ARRAY;

  return Arrays.stream(ComponentsCacheService.getInstance(project).getAllComponents())
      .filter(
          cls -> {
            final String shortName = StringUtil.getShortName(cls.getQualifiedName());
            return shortName.equals(name);
          })
      .toArray(PsiClass[]::new);
}
 
Example 4
Source File: PsiSearchUtils.java    From litho with Apache License 2.0 5 votes vote down vote up
public static PsiClass[] findClasses(Project project, String qualifiedName) {
  final PsiClass found = findClass(project, qualifiedName);
  if (found == null) {
    return PsiClass.EMPTY_ARRAY;
  }
  return new PsiClass[] {found};
}
 
Example 5
Source File: HaxeSubtypesHierarchyTreeStructure.java    From intellij-haxe with Apache License 2.0 4 votes vote down vote up
protected static PsiClass[] getSuperTypesAsArray(PsiClass theClass) {
  if (!theClass.isValid()) return PsiClass.EMPTY_ARRAY;
  final ArrayList<PsiClass> allSuperClasses = getSuperTypesAsList(theClass);
  return allSuperClasses.toArray(new PsiClass[allSuperClasses.size()]);
}
 
Example 6
Source File: LombokElementFinder.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@NotNull
@Override
public PsiClass[] findClasses(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
  return PsiClass.EMPTY_ARRAY;
}