String (final String path, final ModifiableRootModel model, final List<String> currentRoots, final @NotNull VirtualFile contentRoot) { final String rootPath = contentRoot.getPath(); String url = null; if (new File(path).exists()) { //absolute path url = EPathCommonUtil.pathToUrl(path); } else { if (path.startsWith("/")) { //relative to other project final String moduleName = EPathCommonUtil.getRelativeModuleName(path); final String relativeToRootPath = EPathCommonUtil.getRelativeToModulePath(path); final Module otherModule = ModuleManager.getInstance(model.getModule().getProject()).findModuleByName(moduleName); if (otherModule != null && otherModule != model.getModule()) { url = expandEclipseRelative2OtherModule(otherModule, relativeToRootPath); } else if (currentRoots != null) { url = EPathCommonUtil.expandEclipseRelative2ContentRoots(currentRoots, moduleName, relativeToRootPath); } } else { final String relativePath = new File(rootPath, path).getPath(); //inside current project final File file = new File(relativePath); if (file.exists()) { url = EPathCommonUtil.pathToUrl(relativePath); } } } if (url == null) { url = EPathCommonUtil.pathToUrl(path); } final VirtualFile localFile = VirtualFileManager.getInstance().findFileByUrl(url); if (localFile != null) { final VirtualFile jarFile = JarFileSystem.getInstance().getJarRootForLocalFile(localFile); if (jarFile != null) { url = jarFile.getUrl(); } } return url; }