28package com.jogamp.common.util.awt;
30import java.awt.EventQueue;
31import java.lang.reflect.InvocationTargetException;
33import com.jogamp.common.util.RunnableExecutor;
47 public void invoke(
final boolean wait,
final Runnable r) {
48 if(EventQueue.isDispatchThread()) {
53 EventQueue.invokeAndWait(r);
55 EventQueue.invokeLater(r);
57 }
catch (
final InvocationTargetException e) {
58 throw new RuntimeException(e.getTargetException());
59 }
catch (
final InterruptedException e) {
60 throw new RuntimeException(e);
86 public boolean invoke(
final Object treeLock,
final boolean allowOnNonEDT,
final boolean wait,
final Runnable r) {
87 if( EventQueue.isDispatchThread() ) {
90 }
else if ( !Thread.holdsLock(treeLock) ) {
93 EventQueue.invokeAndWait(r);
95 EventQueue.invokeLater(r);
97 }
catch (
final InvocationTargetException e) {
98 throw new RuntimeException(e.getTargetException());
99 }
catch (
final InterruptedException e) {
100 throw new RuntimeException(e);
103 }
else if ( allowOnNonEDT ) {
AWT EDT implementation of RunnableExecutor.
void invoke(final boolean wait, final Runnable r)
boolean invoke(final Object treeLock, final boolean allowOnNonEDT, final boolean wait, final Runnable r)
Executes the given runnable on the AWT-EDT and return true, if.
static final AWTEDTExecutor singleton
RunnableExecutor implementation invoking Runnable#run() on the AWT EDT.