use of org.eclipse.wst.xsl.core.model.XSLAttribute in project webtools.sourceediting by eclipse.
the class XSLValidator method checkIncludes.
private void checkIncludes(StylesheetModel stylesheetComposed, XSLValidationReport report) throws MaxErrorsExceededException {
for (Include include : stylesheetComposed.getStylesheet().getIncludes()) {
IFile includedFile = include.getHrefAsFile();
if (includedFile == null || !includedFile.exists()) {
// included
// file does
// not exist
// $NON-NLS-1$
XSLAttribute att = include.getAttribute("href");
if (att != null) {
String baseURI = include.getStylesheet().getFile().getLocationURI().toString();
// $NON-NLS-1$
String resolvedURI = URIResolverPlugin.createResolver().resolve(baseURI, "", att.getValue());
if ((resolvedURI == null) || !(importOrIncludeExists(stylesheetComposed.getStylesheet().getFile(), resolvedURI))) {
createMarker(report, att, getPreference(ValidationPreferences.MISSING_INCLUDE), Messages.XSLValidator_4 + include.getHref());
}
} else {
createMarker(report, include, getPreference(ValidationPreferences.NAME_ATTRIBUTE_EMPTY), Messages.XSLValidator_23);
}
} else if (includedFile.equals(include.getStylesheet().getFile())) {
// stylesheet
// including
// itself!
createMarker(report, include.getAttribute("href"), getPreference(ValidationPreferences.CIRCULAR_REF), // $NON-NLS-1$
Messages.XSLValidator_6);
}
}
}
use of org.eclipse.wst.xsl.core.model.XSLAttribute in project webtools.sourceediting by eclipse.
the class XSLValidator method checkImports.
private void checkImports(StylesheetModel stylesheetComposed, XSLValidationReport report) throws MaxErrorsExceededException {
for (Include include : stylesheetComposed.getStylesheet().getImports()) {
IFile includedFile = include.getHrefAsFile();
if (includedFile == null || !includedFile.exists()) {
// included
// file does
// not exist
// $NON-NLS-1$
XSLAttribute att = include.getAttribute("href");
if (att != null) {
String baseURI = include.getStylesheet().getFile().getLocationURI().toString();
// $NON-NLS-1$
String resolvedURI = URIResolverPlugin.createResolver().resolve(baseURI, "", att.getValue());
if ((resolvedURI == null) || (!importOrIncludeExists(stylesheetComposed.getStylesheet().getFile(), resolvedURI))) {
createMarker(report, att, getPreference(ValidationPreferences.MISSING_INCLUDE), Messages.XSLValidator_4 + include.getHref());
}
}
} else if (includedFile.equals(include.getStylesheet().getFile())) {
// stylesheet
// including
// itself!
createMarker(report, include.getAttribute("href"), getPreference(ValidationPreferences.CIRCULAR_REF), // $NON-NLS-1$
Messages.XSLValidator_10);
}
}
}
use of org.eclipse.wst.xsl.core.model.XSLAttribute in project webtools.sourceediting by eclipse.
the class TestStylesheet method testGetAttributes.
@Test
public void testGetAttributes() {
Stylesheet stylesheet = builder.getStylesheet(getFile("globalVariablesTest.xsl"), false);
assertNotNull("Model failed to load, returned NULL", stylesheet);
Map<String, XSLAttribute> attributeList = stylesheet.getAttributes();
assertEquals("Incorrect number of attributes", 4, attributeList.size());
XSLAttribute attribute = stylesheet.getAttribute("exclude-result-prefixes");
assertEquals("Wrong attribute returned:", "exclude-result-prefixes", attribute.getName());
}
use of org.eclipse.wst.xsl.core.model.XSLAttribute in project webtools.sourceediting by eclipse.
the class XSLHyperlinkDetector method createWithParamHyperLink.
private IHyperlink createWithParamHyperLink(IFile currentFile, Element elem, Attr attr, IRegion hyperlinkRegion) {
IHyperlink hyperlink = null;
StylesheetModel sf = XSLCore.getInstance().getStylesheet(currentFile);
if (sf != null) {
Node parentNode = elem.getParentNode();
Attr parentAttribute = (Attr) parentNode.getAttributes().getNamedItem(ATTR_NAME);
String templateName = parentAttribute.getValue();
List<Template> templates = sf.getTemplatesByName(templateName);
if (templates != null && templates.size() == 1) {
Template template = templates.get(0);
List<Parameter> parameters = template.getParameters();
for (Parameter param : parameters) {
String paramName = attr.getValue();
XSLAttribute parameterNameAttr = param.getAttribute(ATTR_NAME);
if (parameterNameAttr != null && parameterNameAttr.getValue().equals(paramName)) {
hyperlink = new SourceFileHyperlink(hyperlinkRegion, template.getStylesheet().getFile(), param);
}
}
}
}
return hyperlink;
}
use of org.eclipse.wst.xsl.core.model.XSLAttribute in project webtools.sourceediting by eclipse.
the class CallTemplateContentAssistRequest method getAdditionalInfo.
protected String getAdditionalInfo(Template template) {
XSLAttribute nameAttribute = template.getAttribute(ATTR_NAME);
String proposalInfo = Messages.CallTemplateContentAssistTemplateName + nameAttribute.getValue() + "\r\n" + Messages.CallTemplateContentAssistTemplateNameFile + // $NON-NLS-1$
template.getStylesheet().getFile().getName();
return proposalInfo;
}
Aggregations