Modifier and Type | Field and Description |
---|---|
static boolean |
DEBUG |
defaultEDTPollPeriod
Constructor and Description |
---|
SWTEDTUtil(Display newtDisplay,
org.eclipse.swt.widgets.Display swtDisplay) |
Modifier and Type | Method and Description |
---|---|
org.eclipse.swt.widgets.Display |
getDisplay() |
long |
getPollPeriod() |
void |
invoke(boolean wait,
Runnable task)
Shall start the thread if not running.
Append task to the EDT task queue. Wait until execution is finished if wait == true .Can be issued from within EDT, ie from within an enqueued task. |
void |
invokeStop(Runnable task)
Append the final task to the EDT task queue,
signals EDT to stop and wait until stopped.
Due to the nature of this method: All previous queued tasks will be finished. No new tasks are allowed, an Exception is thrown. Can be issued from within EDT, ie from within an enqueued task. EDTUtil.reset() may follow immediately, ie creating a new EDT
|
boolean |
isCurrentThreadEDT()
Returns true if the current thread is the event dispatch thread (EDT).
|
boolean |
isCurrentThreadEDTorNEDT()
Returns
true if either EDTUtil.isCurrentThreadEDT() or EDTUtil.isCurrentThreadNEDT() is true ,
otherwise false . |
boolean |
isCurrentThreadNEDT()
Returns true if the current thread is the internal NEWT event dequeue thread (NEDT).
|
boolean |
isRunning() |
void |
reset()
Create a new EDT.
|
void |
setPollPeriod(long ms) |
void |
waitUntilIdle()
Wait until the EDT task queue is empty.
The last task may still be in execution when this method returns. |
void |
waitUntilStopped()
Wait until EDT task is stopped.
No stop action is performed, EDTUtil.invokeStop(java.lang.Runnable) should be used before. |
public SWTEDTUtil(Display newtDisplay, org.eclipse.swt.widgets.Display swtDisplay)
public final org.eclipse.swt.widgets.Display getDisplay()
public long getPollPeriod()
getPollPeriod
in interface EDTUtil
public void setPollPeriod(long ms)
setPollPeriod
in interface EDTUtil
ms
- poll period in millisecondspublic void reset()
EDTUtil
reset()
invokeStop(..)
in case another start via invoke(..)
is expected.reset
in interface EDTUtil
EDTUtil.invoke(boolean, java.lang.Runnable)
,
EDTUtil.invokeStop(java.lang.Runnable)
public boolean isCurrentThreadEDT()
EDTUtil
The EDT is the platform specific thread dispatching toolkit-events
and executing toolkit-tasks enqueued via EDTUtil.invoke(boolean, Runnable)
.
Usually it is the same thread as used to dequeue informal NEWTEvent
s (NEDT), see EDTUtil.isCurrentThreadNEDT()
,
however, this may differ, e.g. SWT and AWT implementation.
isCurrentThreadEDT
in interface EDTUtil
public final boolean isCurrentThreadNEDT()
EDTUtil
The NEDT is the NEWT thread used to dequeue informal NEWTEvent
s enqueued internally
via DisplayImpl.enqueueEvent(boolean, NEWTEvent)
.
Usually it is the same thread as the EDT, see EDTUtil.isCurrentThreadEDT()
,
however, this may differ, e.g. SWT and AWT implementation.
isCurrentThreadNEDT
in interface EDTUtil
public final boolean isCurrentThreadEDTorNEDT()
EDTUtil
true
if either EDTUtil.isCurrentThreadEDT()
or EDTUtil.isCurrentThreadNEDT()
is true
,
otherwise false
.isCurrentThreadEDTorNEDT
in interface EDTUtil
public boolean isRunning()
public final void invokeStop(Runnable task)
EDTUtil
EDTUtil.reset()
may follow immediately, ie creating a new EDTinvokeStop
in interface EDTUtil
public final void invoke(boolean wait, Runnable task)
EDTUtil
wait == true
.public final void waitUntilIdle()
EDTUtil
waitUntilIdle
in interface EDTUtil
public final void waitUntilStopped()
EDTUtil
stop
action is performed, EDTUtil.invokeStop(java.lang.Runnable)
should be used before.waitUntilStopped
in interface EDTUtil
Copyright 2010 JogAmp Community.