public IPath getPath() { return delegate.getPath(); }
public IPath getPath() { return entry.getPath(); }
public IPath getPath() { return entry.getPath(); }
/** * Merge a single classpath entry into the classpath list. * * @param cp * @param entry */ public static void mergeClasspath(List cp, IRuntimeClasspathEntry entry) { Iterator iterator = cp.iterator(); while (iterator.hasNext()) { IRuntimeClasspathEntry entry2 = (IRuntimeClasspathEntry) iterator.next(); if (entry2.getPath().equals(entry.getPath())) return; } cp.add(entry); }
public String toString() { return entry.getPath().toOSString(); }
public String toString() { return entry.getPath().toOSString(); }
/** * Replace the current JRE container classpath with the given entry. * * @param cp * @param entry */ public static void replaceJREContainer(List cp, IRuntimeClasspathEntry entry) { int size = cp.size(); for (int i = 0; i < size; i++) { IRuntimeClasspathEntry entry2 = (IRuntimeClasspathEntry) cp.get(i); if (entry2.getPath().uptoSegment(2).isPrefixOf(entry.getPath())) { cp.set(i, entry); return; } } cp.add(0, entry); }
private IRuntimeClasspathEntry[] resolveOptional(IRuntimeClasspathEntry entry) throws CoreException { if (isOptional(entry.getClasspathEntry())) { return EMPTY_RESULT; } else { throw new CoreException(new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, String.format("The project: %s which is referenced by the classpath, does not exist", entry.getPath().lastSegment()))); } }
public IRuntimeClasspathEntry[] computeUnresolvedCustomClasspath( ILaunchConfiguration configuration, String attribute) throws CoreException { List<IRuntimeClasspathEntry> classpath = new ArrayList<IRuntimeClasspathEntry>(); // recover persisted classpath IRuntimeClasspathEntry[] classpaths = recoverRuntimePath(configuration, attribute); for(IRuntimeClasspathEntry entry: classpaths){ if(entry.getType() == IRuntimeClasspathEntry.ARCHIVE && !ResourceUtil.lookingFileFromPath(entry.getPath()).exists() ){ classpath.add(new MissingRuntimeClasspathEntry(entry,"Missing custom entry:"+entry.getPath().toString())); }else{ classpath.add(entry); } } return classpath.toArray(new IRuntimeClasspathEntry[0]); }
Iterable<String> unresolvedRuntimeClasspath(IJavaProject project) throws CoreException { List<String> jars = Lists.newArrayList(); for (IRuntimeClasspathEntry runtimeEntry : eclipseFacade.computeUnresolvedRuntimeClasspath(project)) { String variable = runtimeEntry.getVariableName(); if ((null != variable) && !variable.contains(JRE_CONTAINER)) { IClasspathContainer container = eclipseFacade.getClasspathContainer(runtimeEntry.getPath(), project); if (null != container) { for (IClasspathEntry entry : container.getClasspathEntries()) { String path = entry.getPath().toString(); if (path.matches(".*\\.[Jj][Aa][Rr]\\z")) { jars.add(path); } } } } } return jars; } }
private IRuntimeClasspathEntry[] filterUnusedDependencies(ILaunchConfiguration configuration, IRuntimeClasspathEntry[] entriesToFilter) throws CoreException { // if the run configuration uses Java 9 then the library dependencies are already present in the // unresolved classpath. That is because the Java 9 support calculates the class/module path from // the result of IJavaProject.getResolvedClasspath(true). Unfortunately, the runtime entries don't // have the source set attribute, so we have to filter them base on entry paths. IJavaProject project = JavaRuntime.getJavaProject(configuration); IClasspathEntry[] classpath = project.getResolvedClasspath(true); LaunchConfigurationScope configurationScopes = LaunchConfigurationScope.from(configuration); Set<IPath> excludedPaths = Sets.newHashSet(); for (IClasspathEntry entry : classpath) { if (!configurationScopes.isEntryIncluded(entry)) { excludedPaths.add(entry.getPath()); } } List<IRuntimeClasspathEntry> result = new ArrayList<>(entriesToFilter.length); for (IRuntimeClasspathEntry entry : entriesToFilter) { if (!excludedPaths.contains(entry.getPath())) { result.add(entry); } } return result.toArray(new IRuntimeClasspathEntry[0]); }
private IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry, IJavaProject project, LaunchConfigurationScope configurationScopes) throws CoreException { if (entry.getType() != IRuntimeClasspathEntry.CONTAINER || !entry.getPath().equals(GradleClasspathContainer.CONTAINER_PATH)) { return new IRuntimeClasspathEntry[0]; } return collectContainerRuntimeClasspathIfPresent(project, configurationScopes); }
/** * Creates an dependency * * @param mavenDependencyInfoMap the maven dependency infos, null if m2e is missing * @param runtimeClasspathEntry the original classpath entry * @return the dependency */ public static Dependency create(MavenDependencyInfoMap mavenDependencyInfoMap, IRuntimeClasspathEntry runtimeClasspathEntry) { String genericId = null; String location = JettyPluginUtils.toLocation(runtimeClasspathEntry); MavenDependencyInfo mavenDependencyInfo = mavenDependencyInfoMap.resolve(runtimeClasspathEntry); if (mavenDependencyInfo != null) { genericId = mavenDependencyInfo.toPortableString(); } else { genericId = runtimeClasspathEntry.getPath().toFile().getName(); } return new Dependency(genericId, location, runtimeClasspathEntry, mavenDependencyInfo); }
/** * @see IRuntimeClasspathEntryResolver#resolveRuntimeClasspathEntry(IRuntimeClasspathEntry, ILaunchConfiguration) */ @Override public IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry, ILaunchConfiguration configuration) throws CoreException { IVMInstall jre = null; if (entry.getType() == IRuntimeClasspathEntry.CONTAINER && entry.getPath().segmentCount() > 1) { // a specific VM jre = JREContainerInitializer.resolveVM(entry.getPath()); } else { // default VM for config jre = JavaRuntime.computeVMInstall(configuration); } if (jre == null) { // cannot resolve JRE return new IRuntimeClasspathEntry[0]; } return resolveLibraryLocations(jre, entry.getClasspathProperty()); }
/** * @see IRuntimeClasspathEntryResolver#resolveRuntimeClasspathEntry(IRuntimeClasspathEntry, ILaunchConfiguration) */ @Override public IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry, ILaunchConfiguration configuration) throws CoreException { IVMInstall jre = null; if (entry.getType() == IRuntimeClasspathEntry.CONTAINER && entry.getPath().segmentCount() > 1) { // a specific VM jre = JREContainerInitializer.resolveVM(entry.getPath()); } else { // default VM for config jre = JavaRuntime.computeVMInstall(configuration); } if (jre == null) { // cannot resolve JRE return new IRuntimeClasspathEntry[0]; } return resolveLibraryLocations(jre, entry.getClasspathProperty()); }
/** * @see IRuntimeClasspathEntryResolver#resolveRuntimeClasspathEntry(IRuntimeClasspathEntry, IJavaProject) */ @Override public IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry, IJavaProject project) throws CoreException { IVMInstall jre = null; if (entry.getType() == IRuntimeClasspathEntry.CONTAINER && entry.getPath().segmentCount() > 1) { // a specific VM jre = JREContainerInitializer.resolveVM(entry.getPath()); } else { // default VM for project jre = JavaRuntime.getVMInstall(project); } if (jre == null) { // cannot resolve JRE return new IRuntimeClasspathEntry[0]; } return resolveLibraryLocations(jre, entry.getClasspathProperty()); }
/** * @see IRuntimeClasspathEntryResolver#resolveRuntimeClasspathEntry(IRuntimeClasspathEntry, IJavaProject) */ @Override public IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry, IJavaProject project) throws CoreException { IVMInstall jre = null; if (entry.getType() == IRuntimeClasspathEntry.CONTAINER && entry.getPath().segmentCount() > 1) { // a specific VM jre = JREContainerInitializer.resolveVM(entry.getPath()); } else { // default VM for project jre = JavaRuntime.getVMInstall(project); } if (jre == null) { // cannot resolve JRE return new IRuntimeClasspathEntry[0]; } return resolveLibraryLocations(jre, entry.getClasspathProperty()); }
private void collectReferencedElements(IJavaProject project, HashSet result) throws CoreException { IRuntimeClasspathEntry[] unresolved = JavaRuntime.computeUnresolvedRuntimeClasspath(project); for (int i= 0; i < unresolved.length; i++) { IRuntimeClasspathEntry curr= unresolved[i]; if (curr.getType() == IRuntimeClasspathEntry.PROJECT) { result.add(new JavadocLinkRef(JavaCore.create((IProject) curr.getResource()))); } else { IRuntimeClasspathEntry[] entries= JavaRuntime.resolveRuntimeClasspathEntry(curr, project); for (int k = 0; k < entries.length; k++) { IRuntimeClasspathEntry entry= entries[k]; if (entry.getType() == IRuntimeClasspathEntry.PROJECT) { result.add(new JavadocLinkRef(JavaCore.create((IProject) entry.getResource()))); } else if (entry.getType() == IRuntimeClasspathEntry.ARCHIVE) { IClasspathEntry classpathEntry= entry.getClasspathEntry(); if (classpathEntry != null) { IPath containerPath= null; if (curr.getType() == IRuntimeClasspathEntry.CONTAINER) { containerPath= curr.getPath(); } result.add(new JavadocLinkRef(containerPath, classpathEntry, project)); } } } } } }