public String getLocation() { return entry.getLocation(); }
public String getLocation() { return delegate.getLocation(); }
public String getLocation() { return entry.getLocation(); }
public static String toLocation(IRuntimeClasspathEntry entry) { String location = entry.getLocation(); if (location == null) { return null; } return location.replace('\\', '/'); }
private static boolean containsModuleInfo(IRuntimeClasspathEntry entry) { return new File(entry.getLocation() + File.separator + "module-info.class").exists(); //$NON-NLS-1$ }
private Set<String> searchUserClass(IRuntimeClasspathEntry[] entries) { Set<String> locations = new LinkedHashSet<String>(); for (int i = 0; i < entries.length; i++) { IRuntimeClasspathEntry entry = entries[i]; if (entry.getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) { String location = entry.getLocation(); if (location != null) { locations.add(location); } } } return locations; }
private Set<String> getCustomClasspath(ILaunchConfiguration configuration, String attribute) throws CoreException { IRuntimeClasspathEntry[] entries = provider .computeUnresolvedCustomClasspath(configuration, attribute); List<IRuntimeClasspathEntry> result = Arrays.asList(JavaRuntime.resolveRuntimeClasspath(entries, configuration)); Set<String> set = new HashSet<String>(result.size()); for (int i = 0; i < result.size(); i++) { String location = result.get(i).getLocation(); if (location != null) { if (!set.contains(location)) { set.add(location); } } } return set; }
public Set<String> getCustomScanPathList(ILaunchConfiguration configuration) throws CoreException { IJavaProject proj = JavaRuntime.getJavaProject(configuration); if (proj == null) { Plugin.logError("No project!"); return new HashSet<String>(); } IRuntimeClasspathEntry[] customEntries = computeUnresolvedCustomClasspath(configuration, Plugin.ATTR_CUSTOM_SCAN_FOLDER); Set<String> locations = new HashSet<String>(); for(IRuntimeClasspathEntry entry:customEntries){ locations.add(entry.getLocation()); } return locations; }
@Override public Collection<Dependency> match(Collection<Dependency> entries) { Iterator<Dependency> iterator = entries.iterator(); entry: while (iterator.hasNext()) { IRuntimeClasspathEntry entry = iterator.next().getRuntimeClasspathEntry(); String path = entry.getLocation(); String forwardSlashes = path.replace('\\', '/'); String backSlashes = path.replace('/', '\\'); for (final RegularMatcher excludedLib : excludedLibs) { if ((excludedLib.matches(forwardSlashes)) || (excludedLib.matches(backSlashes))) { iterator.remove(); continue entry; } } } return entries; }
/** * Override getClasspath so that we also include the load time weaving * aspectpath */ public String[] getClasspath(ILaunchConfiguration configuration) throws CoreException { IRuntimeClasspathEntry[] entries = JavaRuntime .computeUnresolvedRuntimeClasspath(configuration); IRuntimeClasspathEntry[] aspectPathEntries = getAspectPathEntries(configuration); entries = JavaRuntime.resolveRuntimeClasspath(entries, configuration); List userEntries = new ArrayList(entries.length + aspectPathEntries.length); for (int i = 0; i < entries.length; i++) { if (entries[i].getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) { String location = entries[i].getLocation(); if (location != null) { userEntries.add(location); } } } for (int i = 0; i < aspectPathEntries.length; i++) { String location = aspectPathEntries[i].getLocation(); if (location != null) { userEntries.add(location); } } return (String[]) userEntries.toArray(new String[userEntries.size()]); }
public String[] getResolvedJettyClasspath(ILaunchConfiguration configuration) throws CoreException { IRuntimeClasspathEntry[] entries = JavaRuntime .computeUnresolvedRuntimeClasspath(configuration); entries = JavaRuntime.resolveRuntimeClasspath(filterProejctEntries(entries), configuration); List<String> userEntries = new ArrayList<String>(entries.length); Set<String> set = new HashSet<String>(entries.length); for (int i = 0; i < entries.length; i++) { if (entries[i].getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) { String location = entries[i].getLocation(); if (location != null) { if (!set.contains(location)) { userEntries.add(location); set.add(location); } } } } return (String[]) userEntries.toArray(new String[userEntries.size()]); }
private static IPath[] getClasspath(ILaunchConfiguration configuration) throws CoreException { IRuntimeClasspathEntry[] entries= JavaRuntime.computeUnresolvedRuntimeClasspath(configuration); entries= JavaRuntime.resolveRuntimeClasspath(entries, configuration); ArrayList<IPath> userEntries= new ArrayList<>(entries.length); for (int i= 0; i < entries.length; i++) { if (entries[i].getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) { String location= entries[i].getLocation(); if (location != null) { IPath entry= Path.fromOSString(location); if (!userEntries.contains(entry)) { userEntries.add(entry); } } } } return userEntries.toArray(new IPath[userEntries.size()]); }
@Override public Collection<Dependency> match(Collection<Dependency> entries) { Iterator<Dependency> iterator = entries.iterator(); entry: while (iterator.hasNext()) { IRuntimeClasspathEntry entry = iterator.next().getRuntimeClasspathEntry(); String path = entry.getLocation(); String forwardSlashes = path.replace('\\', '/'); String backSlashes = path.replace('/', '\\'); for (final RegularMatcher includedLib : includedLibs) { if ((includedLib.matches(forwardSlashes)) || (includedLib.matches(backSlashes))) { continue entry; } } iterator.remove(); } return entries; }
private static IPath[] getClasspath(ILaunchConfiguration configuration) throws CoreException { IRuntimeClasspathEntry[] entries= JavaRuntime.computeUnresolvedRuntimeClasspath(configuration); entries= JavaRuntime.resolveRuntimeClasspath(entries, configuration); ArrayList<IPath> userEntries= new ArrayList<>(entries.length); for (int i= 0; i < entries.length; i++) { if (entries[i].getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) { String location= entries[i].getLocation(); if (location != null) { IPath entry= Path.fromOSString(location); if (!userEntries.contains(entry)) { userEntries.add(entry); } } } } return userEntries.toArray(new IPath[userEntries.size()]); }
protected IPath[] getClasspath(ILaunchConfiguration configuration) throws CoreException { IRuntimeClasspathEntry[] entries= JavaRuntime.computeUnresolvedRuntimeClasspath(configuration); entries= JavaRuntime.resolveRuntimeClasspath(entries, configuration); boolean isModularConfig= JavaRuntime.isModularConfiguration(configuration); ArrayList<IPath> userEntries= new ArrayList<>(entries.length); for (int i= 0; i < entries.length; i++) { int classPathProperty= entries[i].getClasspathProperty(); if ((!isModularConfig && classPathProperty == IRuntimeClasspathEntry.USER_CLASSES) || (isModularConfig && (classPathProperty == IRuntimeClasspathEntry.CLASS_PATH || classPathProperty == IRuntimeClasspathEntry.MODULE_PATH))) { String location= entries[i].getLocation(); if (location != null) { IPath entry= Path.fromOSString(location); if (!userEntries.contains(entry)) { userEntries.add(entry); } } } } return userEntries.toArray(new IPath[userEntries.size()]); }
private static IPath[] getClasspath(ILaunchConfiguration configuration) throws CoreException { IRuntimeClasspathEntry[] entries= JavaRuntime.computeUnresolvedRuntimeClasspath(configuration); entries= JavaRuntime.resolveRuntimeClasspath(entries, configuration); ArrayList<IPath> userEntries= new ArrayList<>(entries.length); boolean isModularConfig= JavaRuntime.isModularConfiguration(configuration); for (int i= 0; i < entries.length; i++) { int classPathProperty= entries[i].getClasspathProperty(); if ((!isModularConfig && classPathProperty == IRuntimeClasspathEntry.USER_CLASSES) || (isModularConfig && (classPathProperty == IRuntimeClasspathEntry.CLASS_PATH || classPathProperty == IRuntimeClasspathEntry.MODULE_PATH))) { String location= entries[i].getLocation(); if (location != null) { IPath entry= Path.fromOSString(location); if (!userEntries.contains(entry)) { userEntries.add(entry); } } } } return userEntries.toArray(new IPath[userEntries.size()]); }
private static IPath[] getClasspath(ILaunchConfiguration configuration) throws CoreException { IRuntimeClasspathEntry[] entries= JavaRuntime.computeUnresolvedRuntimeClasspath(configuration); entries= JavaRuntime.resolveRuntimeClasspath(entries, configuration); boolean isModularConfig= JavaRuntime.isModularConfiguration(configuration); ArrayList<IPath> userEntries= new ArrayList<>(entries.length); for (int i= 0; i < entries.length; i++) { int classPathProperty= entries[i].getClasspathProperty(); if ((!isModularConfig && classPathProperty == IRuntimeClasspathEntry.USER_CLASSES) || (isModularConfig && (classPathProperty == IRuntimeClasspathEntry.CLASS_PATH || classPathProperty == IRuntimeClasspathEntry.MODULE_PATH))) { String location= entries[i].getLocation(); if (location != null) { IPath entry= Path.fromOSString(location); if (!userEntries.contains(entry)) { userEntries.add(entry); } } } } return userEntries.toArray(new IPath[userEntries.size()]); }
/** Replies if the given classpath entry is a SRE. * * @param entry the entry. * @return <code>true</code> if the entry points to a SRE; * <code>false</code> otherwise. */ private static boolean isNotSREEntry(IRuntimeClasspathEntry entry) { try { final File file = new File(entry.getLocation()); if (file.isDirectory()) { return !SARLRuntime.isUnpackedSRE(file); } else if (file.canRead()) { return !SARLRuntime.isPackedSRE(file); } } catch (Throwable e) { SARLEclipsePlugin.getDefault().log(e); } return true; }
private static String[] computeDefaultRuntimeClassPath(IJavaProject jproject, boolean includeTestScope) throws CoreException { IRuntimeClasspathEntry[] unresolved = JavaRuntime.computeUnresolvedRuntimeClasspath(jproject); Set<String> resolved = new LinkedHashSet<String>(); for (int i = 0; i < unresolved.length; i++) { IRuntimeClasspathEntry entry = unresolved[i]; if (entry.getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) { IRuntimeClasspathEntry[] entries = JavaRuntime.resolveRuntimeClasspathEntry(entry, jproject, !includeTestScope); for (int j = 0; j < entries.length; j++) { if (!includeTestScope && JdtUtils.isTest(entries[j].getClasspathEntry())) { continue; } String location = entries[j].getLocation(); if (location != null) { // remove duplicate classpath resolved.add(location); } } } } return resolved.toArray(new String[resolved.size()]); }
public String getRealPath() { if(entry == null) return null; if(entry.getType() == IRuntimeClasspathEntry.PROJECT){ return entry.getResource().getLocation().toOSString(); }else{ return entry.getLocation(); } }