Search in sources :

Example 11 with RegionParser

use of org.eclipse.wst.sse.core.internal.ltk.parser.RegionParser in project webtools.sourceediting by eclipse.

the class BasicStructuredDocument method resetParser.

void resetParser(Reader reader, int startOffset) {
    RegionParser parser = getParser();
    parser.reset(reader, startOffset);
}
Also used : RegionParser(org.eclipse.wst.sse.core.internal.ltk.parser.RegionParser)

Example 12 with RegionParser

use of org.eclipse.wst.sse.core.internal.ltk.parser.RegionParser in project webtools.sourceediting by eclipse.

the class StyleAttrAdapter method getModel.

/**
 */
public ICSSModel getModel() {
    ICSSModel model = getExistingModel();
    if (model == null && isModelNecessary()) {
        model = createModel();
        if (model == null)
            return null;
        IStructuredDocument structuredDocument = model.getStructuredDocument();
        if (structuredDocument == null)
            return null;
        RegionParser parser = structuredDocument.getParser();
        if (parser instanceof CSSSourceParser) {
            ((CSSSourceParser) parser).setParserMode(CSSSourceParser.MODE_DECLARATION);
        } else {
            return null;
        }
        structuredDocument.addDocumentChangedListener(this);
        // need to set before valueChanged()
        setModel(model);
        valueChanged();
    }
    if (model != null && !isModelNecessary()) {
        model = null;
        valueChanged();
    }
    return model;
}
Also used : ICSSModel(org.eclipse.wst.css.core.internal.provisional.document.ICSSModel) IStructuredDocument(org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument) CSSSourceParser(org.eclipse.wst.css.core.internal.parser.CSSSourceParser) RegionParser(org.eclipse.wst.sse.core.internal.ltk.parser.RegionParser)

Example 13 with RegionParser

use of org.eclipse.wst.sse.core.internal.ltk.parser.RegionParser in project webtools.sourceediting by eclipse.

the class ElementImpl method isCDATAContainer.

/**
 */
protected boolean isCDATAContainer() {
    // use BlockMaker instead of CMElementDeclaration
    // because <style> and <script> in XHTML is not CDATA content type
    IDOMModel model = getModel();
    if (model == null)
        // error
        return false;
    IStructuredDocument structuredDocument = model.getStructuredDocument();
    if (structuredDocument == null || fTagName == null)
        // eror
        return false;
    RegionParser parser = structuredDocument.getParser();
    if (parser == null || !(parser instanceof XMLSourceParser))
        return false;
    return (((XMLSourceParser) parser).getBlockMarker(new String(this.fTagName)) != null);
/*
		 * CMElementDeclaration decl = getDeclaration(); if (decl == null)
		 * return false; if (decl instanceof CMNodeWrapper) { decl =
		 * (CMElementDeclaration)((CMNodeWrapper)decl).getOriginNode(); if
		 * (decl == null) return false; } if (decl instanceof
		 * TLDElementDeclaration) { String content =
		 * ((TLDElementDeclaration)decl).getBodycontent(); if (content ==
		 * null) return false; return
		 * content.equals(JSP11TLDNames.CONTENT_TAGDEPENDENT); } if
		 * (!isGlobalTag()) return false; return (decl.getContentType() ==
		 * CMElementDeclaration.CDATA);
		 */
}
Also used : IDOMModel(org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel) IStructuredDocument(org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument) RegionParser(org.eclipse.wst.sse.core.internal.ltk.parser.RegionParser) XMLSourceParser(org.eclipse.wst.xml.core.internal.parser.XMLSourceParser)

Aggregations

RegionParser (org.eclipse.wst.sse.core.internal.ltk.parser.RegionParser)13 IStructuredDocument (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument)6 StructuredDocumentRegionParser (org.eclipse.wst.sse.core.internal.ltk.parser.StructuredDocumentRegionParser)4 List (java.util.List)3 ITextRegionList (org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList)3 IOException (java.io.IOException)2 StringReader (java.io.StringReader)2 ArrayList (java.util.ArrayList)2 BadLocationException (org.eclipse.jface.text.BadLocationException)2 IReconcilingStrategy (org.eclipse.jface.text.reconciler.IReconcilingStrategy)2 CSSSourceParser (org.eclipse.wst.css.core.internal.parser.CSSSourceParser)2 BlockMarker (org.eclipse.wst.sse.core.internal.ltk.parser.BlockMarker)2 BlockTagParser (org.eclipse.wst.sse.core.internal.ltk.parser.BlockTagParser)2 StructuredDocumentRegionHandler (org.eclipse.wst.sse.core.internal.ltk.parser.StructuredDocumentRegionHandler)2 IEncodedDocument (org.eclipse.wst.sse.core.internal.provisional.document.IEncodedDocument)2 IStructuredDocumentRegion (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion)2 ITextRegion (org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion)2 FileNotFoundException (java.io.FileNotFoundException)1 FileReader (java.io.FileReader)1 Reader (java.io.Reader)1