@Nullable private String expandLinkedResourcesPath(final String path, ExpandMacroToPathMap expander) { final EclipseProjectFinder.LinkedResource linkedResource = EclipseProjectFinder.findLinkedResource(myRootPath, path); if (linkedResource != null) { if (linkedResource.containsPathVariable()) { final String toPathVariableFormat = getVariableRelatedPath( linkedResource.getVariableName(), linkedResource.getRelativeToVariablePath()); return expander.substitute(toPathVariableFormat, SystemInfo.isFileSystemCaseSensitive); } return linkedResource.getLocation(); } return null; }
public static void collectVariables( Set<String> usedVariables, Element classpathElement, final String rootPath) { for (Object o : classpathElement.getChildren(EclipseXml.CLASSPATHENTRY_TAG)) { final Element element = (Element) o; String path = element.getAttributeValue(EclipseXml.PATH_ATTR); if (path == null) continue; final String kind = element.getAttributeValue(EclipseXml.KIND_ATTR); if (Comparing.strEqual(kind, EclipseXml.VAR_KIND)) { createEPathVariable(usedVariables, path, 0); final String srcPath = element.getAttributeValue(EclipseXml.SOURCEPATH_ATTR); if (srcPath != null) { createEPathVariable(usedVariables, srcPath, srcVarStart(srcPath)); } } else if (Comparing.strEqual(kind, EclipseXml.SRC_KIND) || Comparing.strEqual(kind, EclipseXml.OUTPUT_KIND)) { final EclipseProjectFinder.LinkedResource linkedResource = EclipseProjectFinder.findLinkedResource(rootPath, path); if (linkedResource != null && linkedResource.containsPathVariable()) { usedVariables.add(linkedResource.getVariableName()); } } } }