# HG changeset patch # User haftmann # Date 1233146184 -3600 # Node ID f2584b0c76b5466ce88005b7358a97bd453cfad1 # Parent 8b0c1397868e7b46bc8d6066654e5562be216347# Parent 881f328dfbb35614643408c743bf88ceb055283d merged diff -r 881f328dfbb3 -r f2584b0c76b5 src/Pure/General/swing.scala --- a/src/Pure/General/swing.scala Wed Jan 28 13:36:11 2009 +0100 +++ b/src/Pure/General/swing.scala Wed Jan 28 13:36:24 2009 +0100 @@ -10,9 +10,13 @@ object Swing { - def now(body: => Unit) = - SwingUtilities.invokeAndWait(new Runnable { def run = body }) + def now(body: => Unit) { + if (SwingUtilities.isEventDispatchThread) body + else SwingUtilities.invokeAndWait(new Runnable { def run = body }) + } - def later(body: => Unit) = - SwingUtilities.invokeLater(new Runnable { def run = body }) + def later(body: => Unit) { + if (SwingUtilities.isEventDispatchThread) body + else SwingUtilities.invokeLater(new Runnable { def run = body }) + } }