ITypedRegion[] regions= TextUtilities.computePartitioning(fDocument, fPartitioning, region.getOffset(), region.getLength(), false);
TypedPosition[] positions= new TypedPosition[regions.length];
for (int i= 0; i < regions.length; i++) {
positions[i]= new TypedPosition(regions[i]);
try {
fDocument.addPosition(PARTITIONING, positions[i]);
} catch (BadPositionCategoryException x) {
// should not happen
}