@Deprecated public class IlvEventThreadUtil extends Object
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:
Dialog
s. If you use this
redirection, you cannot use AWT Dialog
s, Swing
JDialog
s, or modal JInternalFrame
s 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()
).java.awt.dnd.DropTargetListener.drop
implementations, need to
encapsulate their GUI actions in an invokeLater
call, so that
they get redirected from the AWT/Swing thread to the SWT thread.
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.
Modifier and Type | Method and Description |
---|---|
static void |
enableAWTThreadRedirect()
Deprecated.
Redirects the SWT event thread to the SWT event thread of the default
display.
|
static void |
execNowOrAsync(org.eclipse.swt.widgets.Display display,
Runnable task)
Deprecated.
Executes the given
task in the display's event
thread, if not already executing in this thread. |
static IlvAWTEventFilter |
getAWTEventFilter()
Deprecated.
Returns the currently active AWT event filter.
|
static org.eclipse.swt.widgets.Display |
getAWTThreadRedirectDisplay()
Deprecated.
Returns the SWT display to which the AWT/Swing event thread is currently
redirected.
|
static Thread |
getAWTThreadRedirectThread()
Deprecated.
Returns the SWT event thread to which the AWT/Swing event thread is
currently redirected.
|
static void |
invokeLaterUnredirected(Runnable task)
Deprecated.
Causes the given task to be executed later, in the AWT/Swing event thread,
ignoring redirections.
|
static void |
setAWTEventFilter(IlvAWTEventFilter filter)
Deprecated.
Specifies the AWT event filter.
|
static void |
setAWTThreadRedirect(org.eclipse.swt.widgets.Display display)
Deprecated.
Redirects the SWT event thread to the SWT event thread of the given
display.
|
public static void execNowOrAsync(org.eclipse.swt.widgets.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: Throwable
s 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
.
org.eclipse.swt.SWTException
- public static org.eclipse.swt.widgets.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(org.eclipse.swt.widgets.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.
public static void invokeLaterUnredirected(Runnable task)
public static IlvAWTEventFilter getAWTEventFilter()
setAWTEventFilter(ilog.views.util.swt.IlvAWTEventFilter)
public static void setAWTEventFilter(IlvAWTEventFilter filter)
getAWTEventFilter()
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.