Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarolyn MacLeod2004-06-16 19:09:10 +0000
committerCarolyn MacLeod2004-06-16 19:09:10 +0000
commitf53c2aed2cf2ccc8edf4e875d6619527fea4c906 (patch)
tree67b7871c8d1420d621910aff463ec6bd93ca0404 /examples
parent2e4ddac09eea1876df572c1b719ea946889f6c4c (diff)
downloadeclipse.platform.swt-f53c2aed2cf2ccc8edf4e875d6619527fea4c906.tar.gz
eclipse.platform.swt-f53c2aed2cf2ccc8edf4e875d6619527fea4c906.tar.xz
eclipse.platform.swt-f53c2aed2cf2ccc8edf4e875d6619527fea4c906.zip
Fix for 67132.
Diffstat (limited to 'examples')
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/StyledTextTab.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/StyledTextTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/StyledTextTab.java
index 0102f2e17c..9ef531defa 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/StyledTextTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/StyledTextTab.java
@@ -29,6 +29,9 @@ class StyledTextTab extends ScrollableTab {
/* Buttons for adding StyleRanges to StyledText */
Button boldButton, italicButton, redButton, yellowButton;
Image boldImage, italicImage, redImage, yellowImage;
+
+ /* Variables for saving state. */
+ StyleRange[] styleRanges;
/**
* Creates the Tab within a given instance of ControlExample.
@@ -90,6 +93,11 @@ class StyledTextTab extends ScrollableTab {
styledText.setText (ControlExample.getResourceString("Example_string"));
styledText.append ("\n");
styledText.append (ControlExample.getResourceString("One_Two_Three"));
+
+ if (styleRanges != null) {
+ styledText.setStyleRanges(styleRanges);
+ styleRanges = null;
+ }
}
/**
@@ -240,6 +248,17 @@ class StyledTextTab extends ScrollableTab {
}
/**
+ * Disposes the "Example" widgets.
+ */
+ void disposeExampleWidgets () {
+ /* store the state of the styledText if applicable */
+ if (styledText != null) {
+ styleRanges = styledText.getStyleRanges();
+ }
+ super.disposeExampleWidgets();
+ }
+
+ /**
* Gets the "Example" widget children.
*/
Control [] getExampleWidgets () {

Back to the top