Search in sources :

Example 1 with Import

use of org.eclipse.wst.xsl.core.model.Import in project webtools.sourceediting by eclipse.

the class XSLElementFactory method createImport.

public XSLElement createImport() {
    Import include = new Import(stylesheetParserData.getStylesheet());
    stylesheetParserData.getStylesheet().addImport(include);
    return include;
}
Also used : Import(org.eclipse.wst.xsl.core.model.Import)

Example 2 with Import

use of org.eclipse.wst.xsl.core.model.Import in project webtools.sourceediting by eclipse.

the class TestStylesheet method testGetImports.

@Test
public void testGetImports() {
    Stylesheet stylesheet = builder.getStylesheet(getFile("style1.xsl"), false);
    assertNotNull("Model failed to load, returned NULL", stylesheet);
    List<Import> includeList = stylesheet.getImports();
    assertEquals("Wrong number of includes returned.", 1, includeList.size());
}
Also used : Import(org.eclipse.wst.xsl.core.model.Import) Stylesheet(org.eclipse.wst.xsl.core.model.Stylesheet) Test(org.junit.Test)

Example 3 with Import

use of org.eclipse.wst.xsl.core.model.Import in project webtools.sourceediting by eclipse.

the class XSLWorkbenchAdapter method getLabel.

public String getLabel(Object o) {
    String label = null;
    XSLModelObject obj = (XSLModelObject) o;
    switch(obj.getModelType()) {
        case STYLESHEET:
            Stylesheet stylesheet = (Stylesheet) obj;
            label = stylesheet.getVersion() == null ? "?" : // $NON-NLS-1$
            stylesheet.getVersion();
            break;
        case IMPORT:
            Import imp = (Import) obj;
            label = imp.getHref();
            break;
        case INCLUDE:
            Include inc = (Include) obj;
            label = inc.getHref();
            break;
        case TEMPLATE:
            Template t = (Template) obj;
            StringBuffer sb = new StringBuffer();
            if (t.getName() != null)
                // $NON-NLS-1$
                sb.append(t.getName()).append(" ");
            if (t.getMatch() != null)
                // $NON-NLS-1$
                sb.append(t.getMatch()).append(" ");
            if (t.getMode() != null)
                // $NON-NLS-1$//$NON-NLS-2$
                sb.append("(").append(t.getMode()).append(")");
            label = sb.toString();
            break;
        case VARIABLE:
            Variable v = (Variable) obj;
            label = v.getName();
            break;
        case FUNCTION:
            Function f = (Function) obj;
            label = f.getName();
    }
    return label;
}
Also used : Function(org.eclipse.wst.xsl.core.model.Function) Import(org.eclipse.wst.xsl.core.model.Import) Variable(org.eclipse.wst.xsl.core.model.Variable) XSLModelObject(org.eclipse.wst.xsl.core.model.XSLModelObject) Include(org.eclipse.wst.xsl.core.model.Include) Stylesheet(org.eclipse.wst.xsl.core.model.Stylesheet) Template(org.eclipse.wst.xsl.core.model.Template)

Aggregations

Import (org.eclipse.wst.xsl.core.model.Import)3 Stylesheet (org.eclipse.wst.xsl.core.model.Stylesheet)2 Function (org.eclipse.wst.xsl.core.model.Function)1 Include (org.eclipse.wst.xsl.core.model.Include)1 Template (org.eclipse.wst.xsl.core.model.Template)1 Variable (org.eclipse.wst.xsl.core.model.Variable)1 XSLModelObject (org.eclipse.wst.xsl.core.model.XSLModelObject)1 Test (org.junit.Test)1