}
}
}
// get resolver in Model
final URIResolver resolver = baseModel.getResolver();
// resolve to absolute url
final String absurl = (resolver != null) ? ((baseHref != null) ? resolver.getLocationByURI(ref, baseHref, resolveCrossProjectLinks) : resolver.getLocationByURI(ref, resolveCrossProjectLinks)) : null;
if ((resolver != null) && (absurl == null) && (ref != null) && (ref.trim().length() > 0) && (ref.trim().charAt(0) == '/')) {
// to reach here means :
// ref is a Docroot relative
// resolver can't resolve ref
// so that href is a broken and should not create model
return null;
}
if ((absurl != null) && (absurl.length() > 0)) {
return absurl;
}
// maybe ref is at outside of the Project
// obtain docroot;
final IContainer container = (resolver != null) ? resolver.getRootLocation() : null;
String docroot = null;
if (container != null) {
IPath containerLocation = container.getLocation();
if (containerLocation != null) {
docroot = containerLocation.toString();