use of org.eclipse.wst.xsl.core.model.StylesheetModel in project webtools.sourceediting by eclipse.
the class Validator2 method validate.
@Override
public ValidationResult validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor) {
/*
* String s; switch(kind) { case IResourceDelta.ADDED: s = "added"; break; case IResourceDelta.CHANGED: s = "CHANGED"; break; case IResourceDelta.CONTENT: s = "CONTENT"; break; case
* IResourceDelta.REMOVED: s = "REMOVED"; break; default: s = "other"; } System.out.println(s);
*/
ValidationResult result = new ValidationResult();
if (resource.getType() == IResource.FILE) {
IFile file = (IFile) resource;
ValidationReport report = doValidation(file, kind, state, monitor);
StylesheetModel stylesheet = XSLCore.getInstance().getStylesheet(file);
IFile[] dependencies = stylesheet.getFileDependencies().toArray(new IFile[0]);
result.setDependsOn(dependencies);
for (ValidationMessage message : report.getValidationMessages()) {
XSLValidationMessage xslMsg = (XSLValidationMessage) message;
ValidatorMessage msg = ValidatorMessage.create(message.getMessage(), resource);
// $NON-NLS-1$
msg.setAttribute("lineNumber", xslMsg.getLineNumber());
// $NON-NLS-1$
msg.setAttribute("severity", xslMsg.getSeverity());
result.add(msg);
}
}
return result;
}
use of org.eclipse.wst.xsl.core.model.StylesheetModel in project webtools.sourceediting by eclipse.
the class TemplateNameAttributeContentAssist method getCompletionProposals.
/* (non-Javadoc)
* @see org.eclipse.wst.xsl.ui.internal.contentassist.AbstractXSLContentAssistRequest#getCompletionProposals()
*/
@Override
public ArrayList<ICompletionProposal> getCompletionProposals() {
proposals.clear();
StylesheetModel model = getStylesheetModel();
List<CallTemplate> templates = model.getCallTemplates();
for (CallTemplate template : templates) {
CustomCompletionProposal proposal = createProposal(template);
addUniqueProposal(proposal);
}
return getAllCompletionProposals();
}
use of org.eclipse.wst.xsl.core.model.StylesheetModel in project webtools.sourceediting by eclipse.
the class XSLHyperlinkDetector method createCallTemplateHyperLink.
private IHyperlink createCallTemplateHyperLink(IFile currentFile, String templateName, IRegion hyperlinkRegion) {
IHyperlink hyperlink = null;
StylesheetModel sf = XSLCore.getInstance().getStylesheet(currentFile);
if (sf != null) {
List<Template> templates = sf.getTemplatesByName(templateName);
if (templates != null && templates.size() == 1) {
Template template = templates.get(0);
hyperlink = new SourceFileHyperlink(hyperlinkRegion, template.getStylesheet().getFile(), template);
}
}
return hyperlink;
}
Aggregations