private static File convertPathToFile(IProject project, IPath path) throws MalformedURLException { if (path != null && project != null && path.removeFirstSegments(1) != null) { IResource resource = project.findMember(path.removeFirstSegments(1)); if (resource != null) { URI uri = resource.getRawLocationURI(); if (uri != null) { String scheme = uri.getScheme(); if (SpringCoreUtils.FILE_SCHEME.equalsIgnoreCase(scheme)) { return toLocalFile(uri); } else { IPathVariableManager variableManager = ResourcesPlugin.getWorkspace().getPathVariableManager(); return toLocalFile(variableManager.resolveURI(uri)); } } } } return null; }
protected void collectClasspathURLs( final IJavaProject projectToUse, final LinkedHashSet<URL> result, final boolean includeOutputFolder, final Set<IJavaProject> visited) throws JavaModelException { try { boolean _or = false; IProject _project = projectToUse.getProject(); boolean _isAccessible = _project.isAccessible(); boolean _not = (!_isAccessible); if (_not) { _or = true; } else { boolean _add = visited.add(projectToUse); boolean _not_1 = (!_add); _or = _not_1; } if (_or) { return; } if (includeOutputFolder) { IPath _outputLocation = projectToUse.getOutputLocation(); IPath path = _outputLocation.addTrailingSeparator(); String _string = path.toString(); URI _createPlatformResourceURI = URI.createPlatformResourceURI(_string, true); String _string_1 = _createPlatformResourceURI.toString(); URL url = new URL(_string_1); result.add(url); } final IClasspathEntry[] resolvedClasspath = projectToUse.getResolvedClasspath(true); for (final IClasspathEntry entry : resolvedClasspath) { { URL url_1 = null; int _entryKind = entry.getEntryKind(); switch (_entryKind) { case IClasspathEntry.CPE_SOURCE: if (includeOutputFolder) { final IPath path_1 = entry.getOutputLocation(); boolean _notEquals = (!Objects.equal(path_1, null)); if (_notEquals) { IPath _addTrailingSeparator = path_1.addTrailingSeparator(); String _string_2 = _addTrailingSeparator.toString(); URI _createPlatformResourceURI_1 = URI.createPlatformResourceURI(_string_2, true); String _string_3 = _createPlatformResourceURI_1.toString(); URL _uRL = new URL(_string_3); url_1 = _uRL; } } break; case IClasspathEntry.CPE_PROJECT: IPath path_2 = entry.getPath(); IWorkspaceRoot _workspaceRoot = this.getWorkspaceRoot(projectToUse); final IResource project = _workspaceRoot.findMember(path_2); IProject _project_1 = project.getProject(); final IJavaProject referencedProject = JavaCore.create(_project_1); this.collectClasspathURLs(referencedProject, result, true, visited); break; case IClasspathEntry.CPE_LIBRARY: IPath path_3 = entry.getPath(); IWorkspaceRoot _workspaceRoot_1 = this.getWorkspaceRoot(projectToUse); final IResource library = _workspaceRoot_1.findMember(path_3); URL _xifexpression = null; boolean _notEquals_1 = (!Objects.equal(library, null)); if (_notEquals_1) { java.net.URI _rawLocationURI = library.getRawLocationURI(); _xifexpression = _rawLocationURI.toURL(); } else { File _file = path_3.toFile(); java.net.URI _uRI = _file.toURI(); _xifexpression = _uRI.toURL(); } url_1 = _xifexpression; break; default: { IPath path_4 = entry.getPath(); File _file_1 = path_4.toFile(); java.net.URI _uRI_1 = _file_1.toURI(); URL _uRL_1 = _uRI_1.toURL(); url_1 = _uRL_1; } break; } boolean _notEquals_2 = (!Objects.equal(url_1, null)); if (_notEquals_2) { result.add(url_1); } } } } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }