private Collection<PsiClass> getAllScriptClasses(String shortName, GlobalSearchScope scope) {
   final ArrayList<PsiClass> result = CollectionFactory.arrayList();
   for (GroovyFile file :
       StubIndex.getInstance()
           .get(
               GrScriptClassNameIndex.KEY, shortName, myProject, new GrSourceFilterScope(scope))) {
     ContainerUtil.addIfNotNull(file.getScriptClass(), result);
   }
   return result;
 }
  public List<PsiClass> getScriptClassesByFQName(
      final String name, final GlobalSearchScope scope, final boolean srcOnly) {
    GlobalSearchScope actualScope = srcOnly ? new GrSourceFilterScope(scope) : scope;
    final Collection<GroovyFile> files =
        StubIndex.getInstance()
            .get(GrFullScriptNameIndex.KEY, name.hashCode(), myProject, actualScope);
    if (files.isEmpty()) {
      return Collections.emptyList();
    }

    final ArrayList<PsiClass> result = new ArrayList<PsiClass>();
    for (GroovyFile file : files) {
      if (file.isScript()) {
        final PsiClass scriptClass = file.getScriptClass();
        if (scriptClass != null && name.equals(scriptClass.getQualifiedName())) {
          result.add(scriptClass);
        }
      }
    }
    return result;
  }