--- a/src/Pure/General/swing_thread.scala Wed Sep 02 17:33:25 2009 +0200
+++ b/src/Pure/General/swing_thread.scala Wed Sep 02 20:49:04 2009 +0200
@@ -13,17 +13,23 @@
object Swing_Thread
{
+ /* checks */
+
+ def assert() = Predef.assert(SwingUtilities.isEventDispatchThread())
+ def require() = Predef.require(SwingUtilities.isEventDispatchThread())
+
+
/* main dispatch queue */
def now[A](body: => A): A = {
var result: Option[A] = None
- if (SwingUtilities.isEventDispatchThread) { result = Some(body) }
+ if (SwingUtilities.isEventDispatchThread()) { result = Some(body) }
else SwingUtilities.invokeAndWait(new Runnable { def run = { result = Some(body) } })
result.get
}
def later(body: => Unit) {
- if (SwingUtilities.isEventDispatchThread) body
+ if (SwingUtilities.isEventDispatchThread()) body
else SwingUtilities.invokeLater(new Runnable { def run = body })
}