|
||||||||||
| PREV CLASS Documentation homepage. NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectilog.views.util.swt.IlvEventThreadUtil
public class IlvEventThreadUtil
This class contains utility functions for dealing with the SWT and AWT/Swing event threads in an SWT environment. In particular, it allows the "merge" between the SWT event thread and the AWT/Swing event thread, by redirecting all event handling from the AWT/Swing event thread to the SWT event thread.
This redirection has the following advantages:
EventQueue.invokeLater
or EventQueue.invokeAndWait from within the SWT event
thread in order to perform operations on Swing components.Display.asyncExec or
Display.syncExec from within the AWT/Swing event thread
in order to perform operations on SWT components.EventQueue.invokeAndWait or
Display.syncExec, is eliminated.
Limitations:
This redirection has the following restrictions:
Dialogs. If you use
this redirection, you cannot use AWT Dialogs, Swing
JDialogs, or modal JInternalFrames in
your application.IlvSwingUtil.isDispatchThread() must be used instead of
EventQueue.isDispatchThread() or
SwingUtilities.isEventDispatchThread().EventQueue.invokeAndWait() and
SwingUtilities.invokeAndWait must not be used (because
these invokeAndWait() methods are incompatible with
Display.syncExec(), and this class uses
Display.syncExec()).
Note: Some particular events, like WINDOW_DEACTIVATED,
WINDOW_GAINED_FOCUS, WINDOW_LOST_FOCUS are
still handled in the original AWT/Swing event thread. Be careful to
use SwingUtilities.invokeLater where necessary in such
event handlers.
| Method Summary | |
|---|---|
static void |
enableAWTThreadRedirect()
Redirects the SWT event thread to the SWT event thread of the default display. |
static void |
execNowOrAsync(Display display,
Runnable task)
Executes the given task in the display's
event thread, if not already executing in this thread. |
static IlvAWTEventFilter |
getAWTEventFilter()
Returns the currently active AWT event filter. |
static Display |
getAWTThreadRedirectDisplay()
Returns the SWT display to which the AWT/Swing event thread is currently redirected. |
static Thread |
getAWTThreadRedirectThread()
Returns the SWT event thread to which the AWT/Swing event thread is currently redirected. |
static void |
invokeLaterUnredirected(Runnable task)
Causes the given task to be executed later, in the AWT/Swing event thread, ignoring redirections. |
static void |
setAWTEventFilter(IlvAWTEventFilter filter)
Specifies the AWT event filter. |
static void |
setAWTThreadRedirect(Display display)
Redirects the SWT event thread to the SWT event thread of the given display. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void execNowOrAsync(Display display,
Runnable task)
task in the display's
event thread, if not already executing in this thread.
This is like Display.asyncExec(task), except
that it may run the task immediately.
Note: Throwables thrown by task
will not be displayed. If you want them to be displayed, you need to write a try/catch
block with printStackTrace() inside
task.
SWTException - public static Display getAWTThreadRedirectDisplay()
null if the AWT/Swing event thread is
not redirected.
Display or null.public static Thread getAWTThreadRedirectThread()
null if the AWT/Swing event
thread is not redirected.
null.public static void setAWTThreadRedirect(Display display)
See above for a description of the limitations of this redirection.
display - An SWT display.getAWTThreadRedirectDisplay(),
getAWTThreadRedirectThread(),
IlvSwingUtil.isDispatchThread(),
IlvSwingUtil.invokeNowOrLater(java.lang.Runnable)public static void enableAWTThreadRedirect()
See above for a description of the limitations of this redirection.
setAWTThreadRedirect(org.eclipse.swt.widgets.Display)public static void invokeLaterUnredirected(Runnable task)
setAWTThreadRedirect(org.eclipse.swt.widgets.Display),
EventQueue.invokeLater(java.lang.Runnable)public static IlvAWTEventFilter getAWTEventFilter()
setAWTEventFilter(ilog.views.util.swt.IlvAWTEventFilter)public static void setAWTEventFilter(IlvAWTEventFilter filter)
getAWTEventFilter()
|
||||||||||
| PREV CLASS Documentation homepage. NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||