explicit checks;
authorwenzelm
Wed, 02 Sep 2009 20:49:04 +0200
changeset 32494 4ab2292e452a
parent 32493 457ea5ddbb9b
child 32500 7106aeb6dd64
child 32501 41aa620885c2
explicit checks;
src/Pure/General/swing_thread.scala
--- 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 })
   }