/*
* @see org.eclipse.jface.text.TextViewer#updateSlaveDocument(org.eclipse.jface.text.IDocument, int, int)
*/
protected boolean updateSlaveDocument(IDocument slaveDocument, int modelRangeOffset, int modelRangeLength) throws BadLocationException {
if (slaveDocument instanceof ProjectionDocument) {
ProjectionDocument projection= (ProjectionDocument) slaveDocument;
int offset= modelRangeOffset;
int length= modelRangeLength;
if (!isProjectionMode()) {
// mimic original TextViewer behavior
IDocument master= projection.getMasterDocument();
int line= master.getLineOfOffset(modelRangeOffset);
offset= master.getLineOffset(line);
length= (modelRangeOffset - offset) + modelRangeLength;
}
try {
fHandleProjectionChanges= false;
projection.replaceMasterDocumentRanges(offset, length);
} finally {
fHandleProjectionChanges= true;
}
return true;
}