use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList in project webtools.sourceediting by eclipse.
the class StyleElementAdapter method nodesReplaced.
/**
* Implementing IStructuredDocumentListener's method
* Event from CSS Flat Model
*/
public void nodesReplaced(StructuredDocumentRegionsReplacedEvent event) {
if (event == null)
return;
if (event.getOriginalRequester() == getRequesterH2C())
return;
IStructuredDocumentRegionList oldStructuredDocumentRegions = event.getOldStructuredDocumentRegions();
IStructuredDocumentRegionList newStructuredDocumentRegions = event.getNewStructuredDocumentRegions();
if (oldStructuredDocumentRegions == null && newStructuredDocumentRegions == null)
return;
replaceStructuredDocumentRegions(newStructuredDocumentRegions, oldStructuredDocumentRegions);
}
use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList in project webtools.sourceediting by eclipse.
the class DOMModelImpl method internalSetNewDocument.
private void internalSetNewDocument(IStructuredDocument structuredDocument) {
if (structuredDocument == null)
return;
IStructuredDocumentRegionList flatNodes = structuredDocument.getRegionList();
if ((flatNodes == null) || (flatNodes.getLength() == 0)) {
return;
}
if (this.document == null)
// being constructed
return;
XMLModelUpdater updater = getActiveUpdater();
if (updater != null) {
// being updated
try {
updater.replaceStructuredDocumentRegions(flatNodes, null);
} catch (Exception ex) {
Logger.logException(ex);
this.refresh = true;
handleRefresh();
} finally {
setActive(null);
}
// checkForReinit();
return;
}
XMLModelNotifier notifier = getModelNotifier();
boolean isChanging = notifier.isChanging();
// call even if changing to notify doing new model
getModelNotifier().beginChanging(true);
XMLModelParser parser = getModelParser();
setActive(parser);
this.document.removeChildNodes();
try {
parser.replaceStructuredDocumentRegions(flatNodes, null);
} catch (Exception ex) {
Logger.logException(ex);
// meaningless to refresh, because the result might be the same
} finally {
setActive(null);
if (!isChanging) {
getModelNotifier().endChanging();
}
// ignore refresh
this.refresh = false;
}
}
use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList in project webtools.sourceediting by eclipse.
the class Debug method dump.
public static final void dump(IStructuredDocument structuredDocument, boolean verbose) {
ITextRegionCollection flatNode = null;
// $NON-NLS-1$
System.out.println("Dump of structuredDocument:");
IStructuredDocumentRegionList flatNodes = structuredDocument.getRegionList();
Enumeration structuredDocumentRegions = flatNodes.elements();
while (structuredDocumentRegions.hasMoreElements()) {
flatNode = (ITextRegionCollection) structuredDocumentRegions.nextElement();
if (!verbose) {
String outString = flatNode.toString();
outString = org.eclipse.wst.sse.core.utils.StringUtils.escape(outString);
System.out.println(outString);
} else {
dump(flatNode, verbose);
}
}
System.out.println();
// $NON-NLS-1$
System.out.println("= = = = = =");
System.out.println();
}
use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList in project webtools.sourceediting by eclipse.
the class ScannerUnitTests method testELtolerance_transparency_Squote.
public void testELtolerance_transparency_Squote() {
IStructuredDocumentRegionList nodes = setUpJSP("<a type='${out.foo}'/>");
boolean sizeCheck = checkSimpleRegionCounts(nodes, new int[] { 6 });
sizeCheck &= checkSimpleRegionCount(((ITextRegionContainer) nodes.item(0).getRegions().get(4)), 5);
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_SQUOTE, DOMJSPRegionContexts.JSP_EL_OPEN, DOMJSPRegionContexts.JSP_EL_CONTENT, DOMJSPRegionContexts.JSP_EL_CLOSE, DOMJSPRegionContexts.XML_TAG_ATTRIBUTE_VALUE_SQUOTE });
assertTrue("region context type check", typeCheck);
verifyModelLength();
}
use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList in project webtools.sourceediting by eclipse.
the class ScannerUnitTests method testEmbeddedJSPScriptletInCDATA.
public void testEmbeddedJSPScriptletInCDATA() {
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_SCRIPTLET_OPEN, DOMJSPRegionContexts.JSP_CLOSE } });
assertTrue("region context type check", typeCheck);
verifyModelLength();
}
Aggregations