Source templateSource = context.getSourceFactory().forUri(
source.resolveRelativeUri(new URI(templateUri)));
if (!context.exists(templateSource)) {
templateSource = context.getSourceFactory().resolveUri(source, "package:" + templateUri);
if (!context.exists(templateSource)) {
errorListener.onError(new AnalysisError(
angularElement.getSource(),
hasTemplate.getTemplateUriOffset(),
templateUri.length(),
AngularCode.URI_DOES_NOT_EXIST,
templateUri));
continue;
}
}
if (!AnalysisEngine.isHtmlFileName(templateUri)) {
continue;
}
if (hasTemplate instanceof AngularComponentElementImpl) {
((AngularComponentElementImpl) hasTemplate).setTemplateSource(templateSource);
}
if (hasTemplate instanceof AngularViewElementImpl) {
((AngularViewElementImpl) hasTemplate).setTemplateSource(templateSource);
}
} catch (URISyntaxException exception) {
errorListener.onError(new AnalysisError(
angularElement.getSource(),
hasTemplate.getTemplateUriOffset(),
templateUri.length(),
AngularCode.INVALID_URI,
templateUri));