use of org.eclipse.wst.xsl.core.model.Stylesheet in project webtools.sourceediting by eclipse.
the class TestStylesheet method testGetColumnNumber.
@Test
public void testGetColumnNumber() {
Stylesheet stylesheet = builder.getStylesheet(getFile("globalVariablesTest.xsl"), false);
assertNotNull("Model failed to load, returned NULL", stylesheet);
// Line Number is off by 1 from what is displayed in the Editor
assertEquals("Incorrect column number.", 0, stylesheet.getColumnNumber());
}
use of org.eclipse.wst.xsl.core.model.Stylesheet in project webtools.sourceediting by eclipse.
the class TestStylesheet method testgetLocalTemplatesTemplates.
@Test
public void testgetLocalTemplatesTemplates() {
Stylesheet model = builder.getStylesheet(getFile("style1.xsl"), false);
assertNotNull("Model failed to load, returned NULL", model);
List<Template> templatesList = model.getTemplates();
assertEquals("Wrong number of templates returned.", 2, templatesList.size());
}
use of org.eclipse.wst.xsl.core.model.Stylesheet in project webtools.sourceediting by eclipse.
the class TestStylesheet method testGetLineNumber.
@Test
public void testGetLineNumber() {
Stylesheet stylesheet = builder.getStylesheet(getFile("globalVariablesTest.xsl"), false);
assertNotNull("Model failed to load, returned NULL", stylesheet);
// Line Number is off by 1 from what is displayed in the Editor
assertEquals("Incorrect line number.", 12, stylesheet.getLineNumber());
}
use of org.eclipse.wst.xsl.core.model.Stylesheet in project webtools.sourceediting by eclipse.
the class XSLWorkbenchAdapter method getChildren.
public Object[] getChildren(Object o) {
if (o instanceof XSLModelObject) {
XSLModelObject obj = (XSLModelObject) o;
switch(obj.getModelType()) {
case STYLESHEET:
Stylesheet stylesheet = (Stylesheet) obj;
ArrayList modelItems = new ArrayList();
modelItems.add(new ListWorkbenchAdapter(stylesheet, null, stylesheet.getVersion(), XSLPluginImages.IMG_ELM_STYLESHET));
// $NON-NLS-1$
modelItems.add(new ListWorkbenchAdapter(stylesheet, stylesheet.getImports(), "Imports", XSLPluginImages.IMG_ELM_IMPORT_INCLUDE));
// $NON-NLS-1$
modelItems.add(new ListWorkbenchAdapter(stylesheet, stylesheet.getIncludes(), "Includes", XSLPluginImages.IMG_ELM_IMPORT_INCLUDE));
// $NON-NLS-1$
modelItems.add(new ListWorkbenchAdapter(stylesheet, stylesheet.getGlobalVariables(), "Variables", XSLPluginImages.IMG_ELM_VARIABLE));
// $NON-NLS-1$
modelItems.add(new ListWorkbenchAdapter(stylesheet, stylesheet.getTemplates(), "Templates", XSLPluginImages.IMG_ELM_TEMPLATE));
if (stylesheet.getFunctions().size() > 0) {
// $NON-NLS-1$
modelItems.add(new ListWorkbenchAdapter(stylesheet, stylesheet.getTemplates(), "Functions", XSLPluginImages.IMG_ELM_FUNCTION));
}
return modelItems.toArray();
}
}
return EMPTY;
}
use of org.eclipse.wst.xsl.core.model.Stylesheet 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;
}
Aggregations