Bug 540809 - Wait for shell in Snippet146

Change-Id: Ie7aaf40df7f56b6c323aa88df37a8c04feb8277e
Signed-off-by: Xi Yan <xixiyan@redhat.com>
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet146.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet146.java
index 3772b09..423a2db 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet146.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet146.java
@@ -36,6 +36,11 @@
 	new Thread(){
 		@Override
 		public void run(){
+			// wait for shell to be opened
+			try {
+				Thread.sleep(100);
+			} catch (InterruptedException e) {}
+
 			String string = "Love the method.";
 			for (int i = 0; i < string.length(); i++) {
 				char ch = string.charAt(i);