javauis/eswt_qt/com.nokia.swt.extensions/midp/org/eclipse/ercp/swt/midp/UIThreadSupport.java
equal
deleted
inserted
replaced
9 * Nokia Corporation - initial implementation |
9 * Nokia Corporation - initial implementation |
10 *******************************************************************************/ |
10 *******************************************************************************/ |
11 package org.eclipse.ercp.swt.midp; |
11 package org.eclipse.ercp.swt.midp; |
12 |
12 |
13 import org.eclipse.swt.SWT; |
13 import org.eclipse.swt.SWT; |
14 import org.eclipse.swt.internal.qt.UIThreadManager; |
14 import org.eclipse.swt.internal.qt.UIThreadHandOverManager; |
15 |
15 |
16 /** |
16 /** |
17 * <p> |
17 * <p> |
18 * To use eSWT API a MIDlet needs to dedicate a thread as the UI thread for |
18 * To use eSWT API a MIDlet needs to dedicate a thread as the UI thread for |
19 * running the event loop. This can't happen in the MIDlet.startApp() because |
19 * running the event loop. This can't happen in the MIDlet.startApp() because |
69 * <li>ERROR_FAILED_EXEC if called more than once</li> |
69 * <li>ERROR_FAILED_EXEC if called more than once</li> |
70 * @see MIDlet |
70 * @see MIDlet |
71 * @see MIDlet#startApp |
71 * @see MIDlet#startApp |
72 */ |
72 */ |
73 public static void startInUIThread(Runnable runnable) { |
73 public static void startInUIThread(Runnable runnable) { |
74 if(runnable == null) { |
74 if(runnable == null) { |
75 SWT.error(SWT.ERROR_NULL_ARGUMENT); |
75 SWT.error(SWT.ERROR_NULL_ARGUMENT); |
76 } |
76 } |
77 synchronized(UIThreadSupport.class) { |
77 synchronized(UIThreadSupport.class) { |
78 if(started) { |
78 if(started) { |
79 SWT.error(SWT.ERROR_FAILED_EXEC); |
79 SWT.error(SWT.ERROR_FAILED_EXEC); |
80 } |
80 } |
81 started = true; |
81 started = true; |
82 } |
82 } |
83 if(!UIThreadManager.startInUIThread(runnable)) { |
83 if(!UIThreadHandOverManager.startInUIThread(runnable)) { |
84 SWT.error(SWT.ERROR_NO_HANDLES); |
84 SWT.error(SWT.ERROR_NO_HANDLES); |
85 } |
85 } |
86 } |
86 } |
87 |
87 |
88 } |
88 } |