currentLibrary.setSystemLibrarySource(sourcePath);
/** * Uses the given src map to find source libraries that are associated with the * library locations in the list. The library locations are updated with the * found source path. * * @param srcMap mapping of library location regexs to source location regexs * @param libraries list of {@link LibraryLocation} objects to update with source locations * @see #getSourceMap() */ private void addSourceLocationsToLibraries(Map<String, String> srcMap, List<LibraryLocation> libraries){ for (Iterator<String> patternIterator = srcMap.keySet().iterator(); patternIterator.hasNext();) { // Try each library regex pattern and see what libraries apply. String currentKey = patternIterator.next(); Pattern currentPattern = Pattern.compile(currentKey); Matcher matcher = currentPattern.matcher(""); //$NON-NLS-1$ for (Iterator<LibraryLocation> locationIterator = libraries.iterator(); locationIterator.hasNext();) { LibraryLocation currentLibrary = locationIterator.next(); matcher.reset(currentLibrary.getSystemLibraryPath().toOSString()); if (matcher.find()){ // Found a file that the pattern applies to, use the map to get the source location String sourceLocation = matcher.replaceAll(srcMap.get(currentKey)); IPath sourcePath = new Path(sourceLocation); // Only add the source archive if it exists if (sourcePath.toFile().exists()){ currentLibrary.setSystemLibrarySource(sourcePath); } } } } }