Search in sources :

Example 11 with BlockMarker

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

the class ScanningTests method newParser.

public static RegionParser newParser() {
    JSPSourceParser parser = new JSPSourceParser();
    parser.addBlockMarker(new BlockMarker("foo", null, DOMRegionContext.BLOCK_TEXT, true));
    parser.addBlockMarker(new BlockMarker("globalFoo", null, DOMRegionContext.BLOCK_TEXT, true));
    // parser.addBlockMarker(new BlockMarker("jsp:text", null, XMLRegionContext.XML_CDATA_TEXT, true));
    return parser;
}
Also used : BlockMarker(org.eclipse.wst.sse.core.internal.ltk.parser.BlockMarker) JSPSourceParser(org.eclipse.jst.jsp.core.internal.parser.JSPSourceParser)

Example 12 with BlockMarker

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

the class UnitTests method testDeepEmbeddedJSP3.

public void testDeepEmbeddedJSP3() {
    // CMVC 245586
    // this is a test to make sure ContextRegionContainer returns what we expect
    setUpJSP();
    String startString = "<html><head><script> <%! String testvar = \"testvar\"; %> var test = <%= testvar %> </script></head></html>";
    String expectedText = "<%! String testvar = \"testvar\"; %>";
    // $NON-NLS-1$
    ((XMLSourceParser) fModel.getParser()).addBlockMarker(new BlockMarker("script", null, DOMRegionContext.BLOCK_TEXT, false));
    fModel.setText(null, startString);
    fModel.getRegionList();
    IStructuredDocumentRegion scriptBlockRegion = fModel.getRegionAtCharacterOffset(21);
    ITextRegionList blockRegions = scriptBlockRegion.getRegions();
    ITextRegionContainer jspDecl = (ITextRegionContainer) blockRegions.get(1);
    String fullText = jspDecl.getFullText();
    // assertTrue("ContextRegionContainer.getFullText()", fullText.equals(expectedText));
    assertEquals("ContextRegionContainer.getFullText() value incorrect: ", expectedText, fullText);
}
Also used : ITextRegionList(org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList) IStructuredDocumentRegion(org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion) BlockMarker(org.eclipse.wst.sse.core.internal.ltk.parser.BlockMarker) ITextRegionContainer(org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionContainer) XMLSourceParser(org.eclipse.wst.xml.core.internal.parser.XMLSourceParser)

Example 13 with BlockMarker

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

the class XMLLineTokenizer method getBlockMarkerCaseSensitivity.

/* user method */
public boolean getBlockMarkerCaseSensitivity(String name) {
    Iterator iterator = fBlockMarkers.iterator();
    while (iterator.hasNext()) {
        BlockMarker marker = (BlockMarker) iterator.next();
        boolean casesensitive = marker.isCaseSensitive();
        if (casesensitive && marker.getTagName().equals(name))
            return casesensitive;
        else if (!casesensitive && marker.getTagName().equalsIgnoreCase(name))
            return casesensitive;
    }
    return true;
}
Also used : Iterator(java.util.Iterator) BlockMarker(org.eclipse.wst.sse.core.internal.ltk.parser.BlockMarker)

Example 14 with BlockMarker

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

the class JSPContentAssistProcessor method decodeScriptBlock.

/*
	 * ** TEMP WORKAROUND FOR CMVC 241882 Takes a String and blocks out
	 * jsp:scriptlet, jsp:expression, and jsp:declaration @param blockText
	 * @return
	 */
private IStructuredDocumentRegion decodeScriptBlock(String blockText) {
    XMLSourceParser parser = new XMLSourceParser();
    // use JSP_CONTENT for region type
    // $NON-NLS-1$
    parser.addBlockMarker(new BlockMarker("jsp:scriptlet", null, DOMJSPRegionContexts.JSP_CONTENT, false, false));
    // $NON-NLS-1$
    parser.addBlockMarker(new BlockMarker("jsp:expression", null, DOMJSPRegionContexts.JSP_CONTENT, false, false));
    // $NON-NLS-1$
    parser.addBlockMarker(new BlockMarker("jsp:declaration", null, DOMJSPRegionContexts.JSP_CONTENT, false, false));
    parser.reset(blockText);
    return parser.getDocumentRegions();
}
Also used : BlockMarker(org.eclipse.wst.sse.core.internal.ltk.parser.BlockMarker) XMLSourceParser(org.eclipse.wst.xml.core.internal.parser.XMLSourceParser)

Example 15 with BlockMarker

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

the class ModelHandlerForJSP method addJSPTagName.

protected void addJSPTagName(JSPSourceParser parser, String tagname) {
    BlockMarker bm = new BlockMarker(tagname, null, DOMJSPRegionContexts.JSP_CONTENT, true);
    parser.addBlockMarker(bm);
}
Also used : BlockMarker(org.eclipse.wst.sse.core.internal.ltk.parser.BlockMarker)

Aggregations

BlockMarker (org.eclipse.wst.sse.core.internal.ltk.parser.BlockMarker)22 Iterator (java.util.Iterator)8 XMLSourceParser (org.eclipse.wst.xml.core.internal.parser.XMLSourceParser)4 BlockTagParser (org.eclipse.wst.sse.core.internal.ltk.parser.BlockTagParser)2 RegionParser (org.eclipse.wst.sse.core.internal.ltk.parser.RegionParser)2 CMNode (org.eclipse.wst.xml.core.internal.contentmodel.CMNode)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 BadLocationException (org.eclipse.jface.text.BadLocationException)1 IDocumentExtension3 (org.eclipse.jface.text.IDocumentExtension3)1 TLDElementDeclaration (org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration)1 ModelHandlerForJSP (org.eclipse.jst.jsp.core.internal.modelhandler.ModelHandlerForJSP)1 JSPSourceParser (org.eclipse.jst.jsp.core.internal.parser.JSPSourceParser)1 StructuredDocumentRegionHandler (org.eclipse.wst.sse.core.internal.ltk.parser.StructuredDocumentRegionHandler)1 StructuredDocumentRegionHandlerExtension (org.eclipse.wst.sse.core.internal.ltk.parser.StructuredDocumentRegionHandlerExtension)1 StructuredDocumentRegionParser (org.eclipse.wst.sse.core.internal.ltk.parser.StructuredDocumentRegionParser)1 StructuredDocumentRegionParserExtension (org.eclipse.wst.sse.core.internal.ltk.parser.StructuredDocumentRegionParserExtension)1 IEncodedDocument (org.eclipse.wst.sse.core.internal.provisional.document.IEncodedDocument)1 IStructuredDocument (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument)1 IStructuredDocumentRegion (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion)1