Assert.isTrue(firstLine <= captionLine,
"first folded line is greater than the caption line"); //$NON-NLS-1$
Assert.isTrue(captionLine <= lastLine,
"caption line is greater than the last folded line"); //$NON-NLS-1$
IRegion preRegion;
if (firstLine < captionLine) {
// preRegion= new Region(offset + prefixEnd, contentStart -
// prefixEnd);
final int preOffset = document.getLineOffset(firstLine);
final IRegion preEndLineInfo = document.getLineInformation(captionLine);
final int preEnd = preEndLineInfo.getOffset();
preRegion = new Region(preOffset, preEnd - preOffset);
} else {
preRegion = null;
}
if (captionLine < lastLine) {
final int postOffset = document.getLineOffset(captionLine + 1);
final IRegion postRegion = new Region(postOffset, offset + length
- postOffset);
if (preRegion == null) {
return new IRegion[] { postRegion };
}