Search in sources :

Example 26 with IStructuredDocumentRegionList

use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList in project webtools.sourceediting by eclipse.

the class ScannerUnitTests method testJSPCommentinXMLTag.

public void testJSPCommentinXMLTag() {
    String text = "s<a <%--c--%> b=c/>\n";
    IStructuredDocumentRegionList nodes = setUpJSP(text);
    boolean sizeCheck = checkSimpleRegionCounts(nodes, new int[] { 1, 7, 1 });
    assertTrue("IStructuredDocumentRegion and ITextRegion count", sizeCheck);
    int item = 0;
    boolean typeCheck = checkSimpleRegionTypes(nodes.item(item++).getRegions(), new String[] { DOMRegionContext.XML_CONTENT });
    typeCheck = typeCheck && checkComplexRegionTypes(nodes.item(item++).getRegions(), new String[] { DOMRegionContext.XML_TAG_OPEN, DOMRegionContext.XML_TAG_NAME, DOMJSPRegionContexts.JSP_COMMENT_TEXT, DOMRegionContext.XML_TAG_ATTRIBUTE_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_EQUALS, DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE, DOMRegionContext.XML_EMPTY_TAG_CLOSE }, new String[][] { { DOMJSPRegionContexts.JSP_COMMENT_OPEN, DOMJSPRegionContexts.JSP_COMMENT_TEXT, DOMJSPRegionContexts.JSP_COMMENT_CLOSE, DOMRegionContext.WHITE_SPACE } });
    typeCheck = typeCheck && checkSimpleRegionTypes(nodes.item(item++).getRegions(), new String[] { DOMRegionContext.XML_CONTENT });
    assertTrue("region context type check", typeCheck);
    verifyLengths(0, nodes.item(0), text);
}
Also used : IStructuredDocumentRegionList(org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList)

Example 27 with IStructuredDocumentRegionList

use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList in project webtools.sourceediting by eclipse.

the class ScannerUnitTests method testComments_XML.

/**
 * Check comments between JSP content
 */
public void testComments_XML() {
    String text = "a <!-- --><<!---->b";
    IStructuredDocumentRegionList nodes = setUpXML(text);
    boolean sizeCheck = checkSimpleRegionCounts(nodes, new int[] { 1, 3, 1, 2, 1 });
    assertTrue("IStructuredDocumentRegion and ITextRegion count", sizeCheck);
    boolean typeCheck = checkSimpleRegionTypes(nodes.item(0).getRegions(), new String[] { DOMRegionContext.XML_CONTENT }) && checkSimpleRegionTypes(nodes.item(1).getRegions(), new String[] { DOMRegionContext.XML_COMMENT_OPEN, DOMRegionContext.XML_COMMENT_TEXT, DOMRegionContext.XML_COMMENT_CLOSE }) && checkSimpleRegionTypes(nodes.item(2).getRegions(), new String[] { DOMRegionContext.XML_TAG_OPEN }) && checkSimpleRegionTypes(nodes.item(3).getRegions(), new String[] { DOMRegionContext.XML_COMMENT_OPEN, DOMRegionContext.XML_COMMENT_CLOSE }) && checkSimpleRegionTypes(nodes.item(4).getRegions(), new String[] { DOMRegionContext.XML_CONTENT });
    assertTrue("region context type check", typeCheck);
    verifyLengths(0, nodes.item(0), text);
}
Also used : IStructuredDocumentRegionList(org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList)

Example 28 with IStructuredDocumentRegionList

use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList in project webtools.sourceediting by eclipse.

the class ScannerUnitTests method testVBLtolerance_transparency_DquoteWithSpaces.

public void testVBLtolerance_transparency_DquoteWithSpaces() {
    // note: whitespace on either side returns a WHITE_SPACE context
    String text = "<a type=\"_#{out.foo}_\"/>";
    IStructuredDocumentRegionList nodes = setUpJSP(text);
    boolean sizeCheck = checkSimpleRegionCounts(nodes, new int[] { 6 });
    sizeCheck &= checkSimpleRegionCount(((ITextRegionContainer) nodes.item(0).getRegions().get(4)), 7);
    assertTrue("IStructuredDocumentRegion and ITextRegion count", sizeCheck);
    boolean typeCheck = checkSimpleRegionTypes(nodes.item(0).getRegions(), new String[] { DOMRegionContext.XML_TAG_OPEN, DOMRegionContext.XML_TAG_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_EQUALS, DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE, DOMRegionContext.XML_EMPTY_TAG_CLOSE });
    typeCheck &= checkSimpleRegionTypes(((ITextRegionContainer) nodes.item(0).getRegions().get(4)).getRegions(), new String[] { DOMJSPRegionContexts.XML_TAG_ATTRIBUTE_VALUE_DQUOTE, DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE, DOMJSPRegionContexts.JSP_VBL_OPEN, DOMJSPRegionContexts.JSP_VBL_CONTENT, DOMJSPRegionContexts.JSP_VBL_CLOSE, DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE, DOMJSPRegionContexts.XML_TAG_ATTRIBUTE_VALUE_DQUOTE });
    assertTrue("region context type check", typeCheck);
    verifyLengths(0, nodes.item(0), text);
}
Also used : IStructuredDocumentRegionList(org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList) ITextRegionContainer(org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionContainer)

Example 29 with IStructuredDocumentRegionList

use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList in project webtools.sourceediting by eclipse.

the class ScannerUnitTests method testEmbeddedJSPExpressionInCDATA.

public void testEmbeddedJSPExpressionInCDATA() {
    IStructuredDocumentRegionList nodes = setUpJSP("<![CDATA[<%=%>]]>");
    boolean sizeCheck = checkSimpleRegionCounts(nodes, new int[] { 3 });
    assertTrue("IStructuredDocumentRegion and ITextRegion count", sizeCheck);
    boolean typeCheck = checkComplexRegionTypes(nodes.item(0).getRegions(), new String[] { DOMRegionContext.XML_CDATA_OPEN, DOMRegionContext.XML_CDATA_TEXT, DOMRegionContext.XML_CDATA_CLOSE }, new String[][] { { DOMJSPRegionContexts.JSP_EXPRESSION_OPEN, DOMJSPRegionContexts.JSP_CLOSE } });
    assertTrue("region context type check", typeCheck);
    verifyModelLength();
}
Also used : IStructuredDocumentRegionList(org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList)

Example 30 with IStructuredDocumentRegionList

use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList in project webtools.sourceediting by eclipse.

the class ScannerUnitTests method testJSPDirectiveTags.

/**
 * Check that jsp:directive.(include|page|taglib) are recognized and
 * treated properly
 */
public void testJSPDirectiveTags() {
    String text = "begin <jsp:directive.taglib> <jsp:directive.page a> <jsp:directive.include a=> <jsp:directive.pages a=b> end";
    IStructuredDocumentRegionList nodes = setUpJSP(text);
    boolean sizeCheck = checkSimpleRegionCounts(nodes, new int[] { 1, 3, 1, 4, 1, 5, 1, 6, 1 });
    assertTrue("IStructuredDocumentRegion and ITextRegion count", sizeCheck);
    boolean typeCheck = checkSimpleRegionTypes(nodes.item(0).getRegions(), new String[] { DOMRegionContext.XML_CONTENT }) && checkSimpleRegionTypes(nodes.item(1).getRegions(), new String[] { DOMRegionContext.XML_TAG_OPEN, DOMJSPRegionContexts.JSP_DIRECTIVE_NAME, DOMRegionContext.XML_TAG_CLOSE }) && checkSimpleRegionTypes(nodes.item(2).getRegions(), new String[] { DOMRegionContext.XML_CONTENT }) && checkSimpleRegionTypes(nodes.item(3).getRegions(), new String[] { DOMRegionContext.XML_TAG_OPEN, DOMJSPRegionContexts.JSP_DIRECTIVE_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_NAME, DOMRegionContext.XML_TAG_CLOSE }) && checkSimpleRegionTypes(nodes.item(4).getRegions(), new String[] { DOMRegionContext.XML_CONTENT }) && checkSimpleRegionTypes(nodes.item(5).getRegions(), new String[] { DOMRegionContext.XML_TAG_OPEN, DOMJSPRegionContexts.JSP_DIRECTIVE_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_EQUALS, DOMRegionContext.XML_TAG_CLOSE }) && checkSimpleRegionTypes(nodes.item(6).getRegions(), new String[] { DOMRegionContext.XML_CONTENT }) && checkSimpleRegionTypes(nodes.item(7).getRegions(), new String[] { DOMRegionContext.XML_TAG_OPEN, DOMRegionContext.XML_TAG_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_EQUALS, DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE, DOMRegionContext.XML_TAG_CLOSE }) && checkSimpleRegionTypes(nodes.item(8).getRegions(), new String[] { DOMRegionContext.XML_CONTENT });
    assertTrue("region context type check", typeCheck);
    verifyLengths(0, nodes.item(0), text);
}
Also used : IStructuredDocumentRegionList(org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList)

Aggregations

IStructuredDocumentRegionList (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList)68 ITextRegionContainer (org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionContainer)11 IStructuredDocumentRegion (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion)10 IStructuredDocument (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument)6 ICSSModel (org.eclipse.wst.css.core.internal.provisional.document.ICSSModel)3 ITextRegionCollection (org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionCollection)3 Enumeration (java.util.Enumeration)2 Iterator (java.util.Iterator)2 ITextRegion (org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion)2 IDOMNode (org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode)2 DOMException (org.w3c.dom.DOMException)2 Element (org.w3c.dom.Element)2 NodesEvent (org.eclipse.wst.dtd.core.internal.event.NodesEvent)1 IStructuredModel (org.eclipse.wst.sse.core.internal.provisional.IStructuredModel)1 NewDocumentEvent (org.eclipse.wst.sse.core.internal.provisional.events.NewDocumentEvent)1 NoChangeEvent (org.eclipse.wst.sse.core.internal.provisional.events.NoChangeEvent)1 RegionChangedEvent (org.eclipse.wst.sse.core.internal.provisional.events.RegionChangedEvent)1 RegionsReplacedEvent (org.eclipse.wst.sse.core.internal.provisional.events.RegionsReplacedEvent)1 StructuredDocumentRegionsReplacedEvent (org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentRegionsReplacedEvent)1 CoreNodeList (org.eclipse.wst.sse.core.internal.text.CoreNodeList)1