Search in sources :

Example 1 with CSSStructuredDocumentRegionContainer

use of org.eclipse.wst.css.core.internal.document.CSSStructuredDocumentRegionContainer in project webtools.sourceediting by eclipse.

the class JSPedCSSModelParser method insertStructuredDocumentRegion.

/**
 */
protected CSSNodeImpl insertStructuredDocumentRegion(IStructuredDocumentRegion region) {
    CSSModelCreationContext creationContext = getCreationContext();
    if (creationContext == null || region == null) {
        return null;
    }
    String type = ((BasicStructuredDocumentRegion) region).getType();
    CSSNodeImpl modified = null;
    if (type == JSPedCSSRegionContexts.CSS_JSP_DIRECTIVE) {
        boolean isInclude = region.getText().indexOf("include") != -1;
        if (isInclude) {
            modified = insertUnknownImport(region);
        } else {
            modified = insertUnknownRule(region);
        }
    }
    // post process
    if (modified != null) {
        if (modified instanceof CSSStructuredDocumentRegionContainer) {
            ((CSSStructuredDocumentRegionContainer) modified).propagateRangeStructuredDocumentRegion();
        }
    }
    return modified != null ? modified : super.insertStructuredDocumentRegion(region);
}
Also used : BasicStructuredDocumentRegion(org.eclipse.wst.sse.core.internal.text.BasicStructuredDocumentRegion) CSSStructuredDocumentRegionContainer(org.eclipse.wst.css.core.internal.document.CSSStructuredDocumentRegionContainer) CSSNodeImpl(org.eclipse.wst.css.core.internal.document.CSSNodeImpl) CSSModelCreationContext(org.eclipse.wst.css.core.internal.document.CSSModelCreationContext)

Aggregations

CSSModelCreationContext (org.eclipse.wst.css.core.internal.document.CSSModelCreationContext)1 CSSNodeImpl (org.eclipse.wst.css.core.internal.document.CSSNodeImpl)1 CSSStructuredDocumentRegionContainer (org.eclipse.wst.css.core.internal.document.CSSStructuredDocumentRegionContainer)1 BasicStructuredDocumentRegion (org.eclipse.wst.sse.core.internal.text.BasicStructuredDocumentRegion)1