if (referer != null) {
if (medium == null || medium.trim().equals("")) {
medium = WGADesignStructureHelper.determineMediaKey(referer);
}
}
IFolder tmlFolder = getTmlRoot();
if (referer != null) {
VersionCompliance versionCompliance = WGADesignStructureHelper.getWGAVersionCompliance(referer);
if (versionCompliance != null && versionCompliance.toWGAVersion() != null && versionCompliance.toWGAVersion().isAtLeast(5, 4)) {
IPath path = referer.getFullPath().makeRelativeTo(getTmlRoot().getFullPath().append(WGADesignStructureHelper.determineMediaKey(referer)));
if (path.toString().startsWith("overlay/") && !reference.startsWith("::")) {
if (reference.toLowerCase().endsWith("@base")) {
reference = reference.substring(0, reference.lastIndexOf("@"));
} else {
// this is a reference within an overlay - remove @base marker and add overlay folder to complete the path
reference = reference.substring(0, reference.lastIndexOf("@"));
reference = "overlay:" + reference;
}
}
}
}
String referencePath = null;
reference = reference.toLowerCase();
if (reference.startsWith("::")) {
int matchingSegments = referer.getLocation().matchingFirstSegments(tmlFolder.getLocation());
String tmpPath = medium + "/";
for (int i = matchingSegments + 1; i < referer.getLocation().segmentCount() - 1; i++) {
tmpPath += referer.getLocation().segment(i) + "/";
}