void (Element element, String classesUrl, final String rootName, ModuleRootModel model) { VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(classesUrl); if (file == null) { return; } final Project project = model.getModule().getProject(); if (file.getFileSystem() instanceof JarFileSystem) { file = JarFileSystem.getInstance().getVirtualFileForJar(file); assert file != null; } final Module module = ModuleUtilCore.findModuleForFile(file, project); if (module != null) { appendRelatedToModule(element, classesUrl, rootName, file, module); } else if (ProjectRootManager.getInstance(project).getFileIndex().isExcluded(file)) { for (Module aModule : ModuleManager.getInstance(project).getModules()) { if (appendRelatedToModule(element, classesUrl, rootName, file, aModule)) { return; } } } }