ITextViewer viewer = getTextViewer();
if (viewer instanceof ITextViewerExtension5) {
// get document range, taking into account folding regions in
// viewer
ITextViewerExtension5 extension = (ITextViewerExtension5) viewer;
styleRegion = extension.widgetRange2ModelRange(new Region(offset, length));
}
else {
// get document range, taking into account viewer visible region
// get visible region in viewer
IRegion vr = null;