public void repairPresentation(ITextViewer viewer) {
if (fRememberedStyleRange != null) {
if (viewer instanceof ITextViewerExtension2) {
// attempts to reduce the redraw area
ITextViewerExtension2 viewer2 = (ITextViewerExtension2) viewer;
if (viewer instanceof ITextViewerExtension5) {
ITextViewerExtension5 extension = (ITextViewerExtension5) viewer;
IRegion modelRange = extension.widgetRange2ModelRange(new Region(fRememberedStyleRange.start,
fRememberedStyleRange.length));
if (modelRange != null)
viewer2.invalidateTextPresentation(modelRange.getOffset(), modelRange.getLength());
} else {
viewer2.invalidateTextPresentation(fRememberedStyleRange.start
+ viewer.getVisibleRegion().getOffset(), fRememberedStyleRange.length);
}
} else
viewer.invalidateTextPresentation();