ITextRegionList regions = blockedRegion.getRegions();
int nRegions = regions.size();
StyleRange styleRange = null;
for (int i = 0; i < nRegions; i++) {
region = regions.get(i);
TextAttribute attr = null;
TextAttribute previousAttr = null;
if (blockedRegion.getStartOffset(region) > partitionEndOffset)
break;
if (blockedRegion.getEndOffset(region) <= partitionStartOffset)
continue;
if (region instanceof ITextRegionCollection) {
handled = prepareTextRegion((ITextRegionCollection) region, partitionStartOffset, partitionLength, holdResults);
} else {
attr = getAttributeFor(blockedRegion, region);
if (attr != null) {
handled = true;
// if this region's attr is the same as previous one, then
// just adjust the previous style range
// instead of creating a new instance of one
// note: to use 'equals' in this case is important, since
// sometimes
// different instances of attributes are associated with a
// region, even the
// the attribute has the same values.
// TODO: this needs to be improved to handle readonly
// regions correctly
if ((styleRange != null) && (previousAttr != null) && (previousAttr.equals(attr))) {
styleRange.length += region.getLength();
} else {
styleRange = createStyleRange(blockedRegion, region, attr, partitionStartOffset, partitionLength);
holdResults.add(styleRange);
// technically speaking, we don't need to update