/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.facebook.litho.intellij;

import com.intellij.openapi.project.Project;
import com.intellij.psi.JavaPsiFacade;
import com.intellij.psi.PsiClass;
import com.intellij.psi.search.GlobalSearchScope;
import org.jetbrains.annotations.Nullable;

public class PsiSearchUtils {

  /**
   * Searches global project scope for a class with the specified full-qualified name and returns
   * one if it is found.
   *
   * @param project to find the class in.
   * @param qualifiedName the full-qualified name of the class to find.
   * @return the PSI class, or null if no class with such name is found.
   */
  @Nullable
  public static PsiClass findClass(Project project, String qualifiedName) {
    return JavaPsiFacade.getInstance(project)
        .findClass(qualifiedName, GlobalSearchScope.everythingScope(project));
  }
}

@@ -916,27 +916,17 @@
 hes 
-global project scop
+everywher
 e fo
@@ -985,21 +985,16 @@
  returns
-%0A   *
  one if 
@@ -1002,62 +1002,80 @@
 t is
+%0A   *
  found.
-%0A   *%0A   * @param project to find the class in.
+ This method might return classes out of project scope.%0A   *
 %0A   
@@ -1438,11 +1438,508 @@
 t));%0A  %7D
+%0A%0A  /**%0A   * Searches everywhere for classes with the specified full-qualified name and returns all found%0A   * classes.%0A   *%0A   * @param qualifiedName the full-qualified name of the class to find.%0A   * @return the array of found classes, or an empty array if no classes are found.%0A   */%0A  public static PsiClass%5B%5D findClasses(Project project, String qualifiedName) %7B%0A    return JavaPsiFacade.getInstance(project)%0A        .findClasses(qualifiedName, GlobalSearchScope.everythingScope(project));%0A  %7D
 %0A%7D%0A

Access all found classes with PsiSearchUtils