use of org.eclipse.wst.xsl.core.model.StylesheetModel in project webtools.sourceediting by eclipse.
the class CallTemplateContentAssistRequest method getCompletionProposals.
/**
* (non-Javadoc)
* @see org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest#getCompletionProposals()
*/
@Override
public ArrayList<ICompletionProposal> getCompletionProposals() {
proposals.clear();
IFile editorFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(getLocation()));
StylesheetModel model = XSLCore.getInstance().getStylesheet(editorFile);
List<Template> templates = model.getTemplates();
for (Template template : templates) {
XSLAttribute attribute = template.getAttribute(ATTR_NAME);
if (attribute != null) {
String proposalInfo = getAdditionalInfo(template);
CustomCompletionProposal proposal = new CustomCompletionProposal(attribute.getValue(), getStartOffset() + 1, 0, attribute.getValue().length(), XSLPluginImageHelper.getInstance().getImage(XSLPluginImages.IMG_TEMPLATE), attribute.getValue(), null, proposalInfo, 0);
addProposal(proposal);
}
}
return getAllCompletionProposals();
}
use of org.eclipse.wst.xsl.core.model.StylesheetModel in project webtools.sourceediting by eclipse.
the class TemplateModeAttributeContentAssist method getCompletionProposals.
/**
* The main method that returns an array of proposals. Returns the available
* modes that have been defined in the {@link StylesheetModel}. If no proposals
* are found it returns a NULL value.
* @return ICompletionPropsal[]
* @see org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest#getCompletionProposals()
*/
@Override
public ArrayList<ICompletionProposal> getCompletionProposals() {
proposals.clear();
StylesheetModel model = getStylesheetModel();
addModeProposals(model);
return getAllCompletionProposals();
}
use of org.eclipse.wst.xsl.core.model.StylesheetModel in project webtools.sourceediting by eclipse.
the class XSLCore method buildStylesheet.
/**
* Completely rebuild the source file from its DOM
*
* @param file
* @return the stylesheet model, or null if it could not be created.
* @since 1.0
*/
public synchronized StylesheetModel buildStylesheet(IFile file) {
Stylesheet stylesheet = StylesheetBuilder.getInstance().getStylesheet(file, true);
if (stylesheet == null)
return null;
StylesheetModel stylesheetComposed = new StylesheetModel(stylesheet);
stylesheetsComposed.put(file, stylesheetComposed);
stylesheetComposed.fix();
return stylesheetComposed;
}
use of org.eclipse.wst.xsl.core.model.StylesheetModel in project webtools.sourceediting by eclipse.
the class Validator method validate.
@Override
public ValidationResult validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor) {
ValidationResult res = super.validate(resource, kind, state, monitor);
if (resource.getType() == IResource.FILE) {
StylesheetModel stylesheet = XSLCore.getInstance().getStylesheet((IFile) resource);
IFile[] dependencies = stylesheet.getFileDependencies().toArray(new IFile[0]);
res.setDependsOn(dependencies);
}
return res;
}
use of org.eclipse.wst.xsl.core.model.StylesheetModel in project webtools.sourceediting by eclipse.
the class AbstractValidationTest method validate.
/**
* Validate the file
*
* @param file
* @return
* @throws CoreException
* @throws XPathExpressionException
* @throws IOException
*/
protected XSLValidationReport validate(IFile file) throws CoreException, XPathExpressionException, IOException {
XSLValidationReport report = new XSLValidationReport(file.getLocationURI().toString());
XSLValidator.getInstance().validate(file, report, true);
StylesheetModel model = XSLCore.getInstance().getStylesheet(file);
assertFalse("Stylesheet model is null", model == null);
Map<Integer, String> expectedErrors = calculateErrorsAndWarnings(file);
validateErrors(model, report, expectedErrors);
return report;
}
Aggregations