Set<UnloadedModuleDescription> () { Set<UnloadedModuleDescription> resolveScope = new LinkedHashSet<>(); for (UsageTarget target : mySearchFor) { if (!(target instanceof PsiElementUsageTarget)) return null; PsiElement element = ((PsiElementUsageTarget)target).getElement(); if (element == null) return null; SearchScope useScope = element.getUseScope(); if (useScope instanceof GlobalSearchScope) { resolveScope.addAll(((GlobalSearchScope)useScope).getUnloadedModulesBelongingToScope()); } } return resolveScope; }