if (fFrameColor != null) {
fFrameColor.dispose();
fFrameColor= null;
}
StyledText text= fViewer.getTextWidget();
text.removePaintListener(this);
text.removeModifyListener(this);
text.removeVerifyListener(this);
Shell shell= text.getShell();
shell.removeShellListener(this);
ITextViewerExtension extension= (ITextViewerExtension) fViewer;
extension.removeVerifyKeyListener(this);
if (fViewer instanceof ITextViewerExtension2 && fContentType != null)
((ITextViewerExtension2) fViewer).removeAutoEditStrategy(fManager, fContentType);
fContentType= null;
fViewer.removeTextListener(this);
fViewer.removeTextInputListener(this);
try {
IDocument document= fViewer.getDocument();
if (((flags & COMMIT) != 0) &&
((flags & DOCUMENT_CHANGED) == 0) &&
((flags & UPDATE_CARET) != 0))
{
Position[] positions= document.getPositions(CARET_POSITION);
if ((positions != null) && (positions.length != 0)) {
if (fViewer instanceof ITextViewerExtension5) {
ITextViewerExtension5 extension3= (ITextViewerExtension5) fViewer;
int widgetOffset= extension3.modelOffset2WidgetOffset(positions[0].getOffset());
if (widgetOffset >= 0)
text.setSelection(widgetOffset, widgetOffset);
} else {
IRegion region= fViewer.getVisibleRegion();
int offset= positions[0].getOffset() - region.getOffset();
if ((offset >= 0) && (offset <= region.getLength()))
text.setSelection(offset, offset);
}
}
}
document.removePositionUpdater(fgUpdater);
document.removePositionCategory(CARET_POSITION);
if (fExitListener != null)
fExitListener.exit(
((flags & COMMIT) != 0) ||
((flags & DOCUMENT_CHANGED) != 0));
} catch (BadPositionCategoryException e) {
//PHPeclipsePlugin.log(e);
e.printStackTrace();
Assert.isTrue(false);
}
if ((flags & DOCUMENT_CHANGED) == 0)
text.redraw();
}