* This method should only be called in this class and for containers in
* the primary structured document as all buffer appends will be direct
*/
protected void translateRegionContainer(ITextRegionCollection container, int JSPType) {
ITextRegionCollection containerRegion = container;
Iterator regions = containerRegion.getRegions().iterator();
ITextRegion region = null;
while (regions.hasNext()) {
region = (ITextRegion) regions.next();
String type = region.getType();
// content assist was not showing up in JSP inside a javascript region
if (DOMRegionContext.BLOCK_TEXT == type) {
// check if it's nested jsp in a script tag...
if (region instanceof ITextRegionContainer) {
// pass in block text's container & iterator
Iterator regionIterator = ((ITextRegionCollection) region).getRegions().iterator();
translateJSPNode(region, regionIterator, type, EMBEDDED_JSP);
}
else {
//be sure to combine all of the text from the block region
StringBuffer fullText = new StringBuffer(containerRegion.getFullText(region));
while(regions.hasNext()) {
region = (ITextRegion)regions.next();
if (region instanceof ITextRegionContainer) {
// pass in block text's container & iterator
Iterator regionIterator = ((ITextRegionCollection) region).getRegions().iterator();
translateJSPNode(region, regionIterator, type, EMBEDDED_JSP);
}
if(region.getType() == DOMRegionContext.BLOCK_TEXT) {
fullText.append(containerRegion.getFullText(region));
} else {
//update type for when we exit if statement for BLOCK_TEXT
type = region.getType();
break;
}
}
/**
* LIMITATION - Normally the script content within a
* script tag is a single document region with a single
* BLOCK_TEXT text region within it. Any JSP scripting
* will be within its own region container (for the sake
* of keeping the scripting open/content/end as a group)
* also of BLOCK_TEXT. That ignores custom tags that might
* be in there, though, as they require proper scoping and
* variable declaration to be performed even though
* they're not proper nodes in the DOM. The only way to
* really do this is to treat the entire script content as
* JSP content on its own, akin to an included segment.
* Further complicating this solution is that tagdependent
* custom tags have their comment marked as BLOCK_TEXT as
* well, so there's no clear way to tell the two cases
* apart.
*/
// ////////////////////////////////////////////////////////////////////////////////
// THIS EMBEDDED JSP TEXT WILL COME OUT LATER WHEN
// PARTITIONING HAS
// SUPPORT FOR NESTED XML-JSP
// CMVC 241882
decodeScriptBlock(fullText.toString(), containerRegion.getStartOffset());
// ////////////////////////////////////////////////////////////////////////////////
}
}
// if (region instanceof ITextRegionCollection &&
// ((ITextRegionCollection) region).getNumberOfRegions() > 0) {