DirtyRegion outer = null;
int region1NodeEnd = -1;
int region2NodeEnd = -1;
// then check if region1's end appears after
// region2's end
IndexedRegion region1EndNode = sModel.getIndexedRegion(region1.getOffset() + region1.getLength());
if (region1EndNode == null) {
// if no end, just assume region spans all the
// way to the end so it includes other region
outer = region1;
}
else {
region1NodeEnd = region1EndNode.getEndOffset();
IndexedRegion region2EndNode = sModel.getIndexedRegion(region2.getOffset() + region2.getLength());
region2NodeEnd = region2EndNode != null ? region2EndNode.getEndOffset() : getDocument().getLength();
if (region1NodeEnd >= region2NodeEnd) {
// root contains or is equal to possible
outer = region1;
}
else if (region1NodeStart == region2NodeStart && region2NodeEnd >= region1NodeEnd) {