GlobalSearchScope () { RunProfile configuration = getConfiguration(); if (!(configuration instanceof ModuleRunProfile)) { return GlobalSearchScope.allScope(myProject); } Module[] modules = ((ModuleRunProfile)configuration).getModules(); if (modules.length == 0) { return GlobalSearchScope.allScope(myProject); } GlobalSearchScope[] scopes = ContainerUtil.map2Array(modules, GlobalSearchScope.class, module -> GlobalSearchScope.moduleRuntimeScope(module, true)); return GlobalSearchScope.union(scopes); }