Fixed bug 357068: [implementation] TextViewer returns null for
getControl() although this is not spec'd in Viewer's javadoc API
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java
index 8b7e0c5..4e9b534 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java
@@ -1682,7 +1682,6 @@
* @since 3.0
*/
protected FindReplaceDocumentAdapter fFindReplaceDocumentAdapter;
-
/**
* The text viewer's hyperlink detectors.
* @since 3.1
@@ -1719,6 +1718,12 @@
* @since 3.5
*/
private int fLastEventTime;
+ /**
+ * Pointer to disposed control.
+ *
+ * @since 3.8
+ */
+ private Control fDisposedControl;
//---- Construction and disposal ------------------
@@ -1797,6 +1802,7 @@
fTextWidget.addDisposeListener(
new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
+ fDisposedControl= getControl();
handleDispose();
}
}
@@ -1841,7 +1847,7 @@
* @see Viewer#getControl()
*/
public Control getControl() {
- return fTextWidget;
+ return fTextWidget != null ? fTextWidget : fDisposedControl;
}
/*