String (ModuleRootModel model, String javadocPath) { final String protocol = VirtualFileManager.extractProtocol(javadocPath); if (!Comparing.strEqual(protocol, HttpFileSystem.getInstance().getProtocol())) { final String path = VfsUtilCore.urlToPath(javadocPath); final VirtualFile contentRoot = getContentRoot(model); final Project project = model.getModule().getProject(); final VirtualFile baseDir = contentRoot != null ? contentRoot.getParent() : project.getBaseDir(); if (Comparing.strEqual(protocol, JarFileSystem.getInstance().getProtocol())) { final VirtualFile javadocFile = JarFileSystem.getInstance().getVirtualFileForJar(VirtualFileManager.getInstance().findFileByUrl(javadocPath)); if (javadocFile != null) { final String relativeUrl; if (contentRoot != null && VfsUtilCore.isAncestor(contentRoot, javadocFile, false)) { relativeUrl = "/" + VfsUtilCore.getRelativePath(javadocFile, baseDir, '/'); } else { relativeUrl = collapse2eclipseRelative2OtherModule(project, javadocFile); } if (relativeUrl != null) { if (!javadocPath.contains(JarFileSystem.JAR_SEPARATOR)) { javadocPath = StringUtil.trimEnd(javadocPath, "/") + JarFileSystem.JAR_SEPARATOR; } javadocPath = JAR_PREFIX + PLATFORM_PROTOCOL + "resource" + relativeUrl + javadocPath.substring(javadocFile.getUrl().length() - 1); } else { LOG.info("Javadoc path: " + javadocPath); final Module module = ModuleUtilCore.findModuleForFile(javadocFile, project); LOG.info("Module: " + (module != null ? module.getName() : "not found")); if (module != null) { LOG.info("Content roots: " + Arrays.toString(ModuleRootManager.getInstance(module).getContentRoots())); } javadocPath = JAR_PREFIX + FILE_PROTOCOL + StringUtil.trimStart(path, "/"); } } else { javadocPath = JAR_PREFIX + FILE_PROTOCOL + StringUtil.trimStart(path, "/"); } } else if (new File(path).exists()) { javadocPath = FILE_PROTOCOL + StringUtil.trimStart(path, "/"); } } return javadocPath; }