tuned;
authorwenzelm
Mon, 06 Apr 2020 21:22:42 +0200
changeset 71716 d1538d4de057
parent 71715 9e2f52d0aec3
child 71717 f871ccd358b3
tuned;
src/Pure/GUI/gui_thread.scala
--- a/src/Pure/GUI/gui_thread.scala	Mon Apr 06 21:18:16 2020 +0200
+++ b/src/Pure/GUI/gui_thread.scala	Mon Apr 06 21:22:42 2020 +0200
@@ -16,13 +16,13 @@
 
   def assert[A](body: => A): A =
   {
-    Predef.assert(SwingUtilities.isEventDispatchThread())
+    Predef.assert(SwingUtilities.isEventDispatchThread)
     body
   }
 
   def require[A](body: => A): A =
   {
-    Predef.require(SwingUtilities.isEventDispatchThread())
+    Predef.require(SwingUtilities.isEventDispatchThread)
     body
   }
 
@@ -31,23 +31,23 @@
 
   def now[A](body: => A): A =
   {
-    if (SwingUtilities.isEventDispatchThread()) body
+    if (SwingUtilities.isEventDispatchThread) body
     else {
-      lazy val result = { assert { Exn.capture(body) } }
-      SwingUtilities.invokeAndWait(new Runnable { def run = result })
+      lazy val result = assert { Exn.capture(body) }
+      SwingUtilities.invokeAndWait(() => result)
       Exn.release(result)
     }
   }
 
   def later(body: => Unit)
   {
-    if (SwingUtilities.isEventDispatchThread()) body
-    else SwingUtilities.invokeLater(new Runnable { def run = body })
+    if (SwingUtilities.isEventDispatchThread) body
+    else SwingUtilities.invokeLater(() => body)
   }
 
   def future[A](body: => A): Future[A] =
   {
-    if (SwingUtilities.isEventDispatchThread()) Future.value(body)
+    if (SwingUtilities.isEventDispatchThread) Future.value(body)
     else {
       val promise = Future.promise[A]
       later { promise.fulfill_result(Exn.capture(body)) }