private static boolean processLanguageDefinitions(ConvertContext context, Processor<? super LanguageDefinition> processor) {
    Project project = context.getProject();
    GlobalSearchScope projectProductionScope = GlobalSearchScopesCore.projectProductionScope(project);
    GlobalSearchScope librariesScope = ProjectScope.getLibrariesScope(project);

    // force finding inside IDEA project first
    PsiClass languageClass = JavaPsiFacade.getInstance(project).findClass(Language.class.getName(), projectProductionScope);
    if (languageClass == null) {
      languageClass = JavaPsiFacade.getInstance(project).findClass(Language.class.getName(), librariesScope);
    }
    Iterable<PsiClass> allLanguages;
    List<LanguageDefinition> libraryDefinitions;
    if (languageClass == null) {
      allLanguages = Collections.emptyList();
      libraryDefinitions = Collections.emptyList();
    }
    else {
      GlobalSearchScope allScope = projectProductionScope.union(librariesScope);
      allLanguages = ClassInheritorsSearch.search(languageClass, allScope, true);
      libraryDefinitions = collectLibraryLanguages(context, allScope);
    }

    if (!ContainerUtil.process(libraryDefinitions, processor)) {
      return false;
    }
    return
      StreamSupport.stream(allLanguages.spliterator(), false)
        .filter(aClass -> PsiSearchScopeUtil.isInScope(projectProductionScope, aClass))
        .map(language -> getDefinition(language, libraryDefinitions))
        .filter(Objects::nonNull)
        .allMatch(processor::process);
  }
private static boolean processLanguageDefinitions(ConvertContext context, Processor<? super LanguageDefinition> processor)