src/Pure/Tools/build_dialog.scala
changeset 50930 23601c59f347
parent 50854 2b15227b17e8
child 51253 ab4c296a1e60
equal deleted inserted replaced
50922:b1939139f8f3 50930:23601c59f347
   118 
   118 
   119     var button_action: () => Unit = (() => is_stopped = true)
   119     var button_action: () => Unit = (() => is_stopped = true)
   120     val button = new Button("Cancel") {
   120     val button = new Button("Cancel") {
   121       reactions += { case ButtonClicked(_) => button_action() }
   121       reactions += { case ButtonClicked(_) => button_action() }
   122     }
   122     }
   123     def button_exit()
   123 
   124     {
   124     val delay_button_exit =
   125       check_auto_close()
   125       Swing_Thread.delay_first(Time.seconds(1.0))
   126       button.text = if (return_code == 0) "OK" else "Exit"
   126       {
   127       button_action = (() => sys.exit(return_code))
   127         check_auto_close()
   128       button.peer.getRootPane.setDefaultButton(button.peer)
   128         button.text = if (return_code == 0) "OK" else "Exit"
   129     }
   129         button_action = (() => sys.exit(return_code))
       
   130         button.peer.getRootPane.setDefaultButton(button.peer)
       
   131       }
   130 
   132 
   131 
   133 
   132     val action_panel = new FlowPanel(FlowPanel.Alignment.Center)(button, auto_close)
   134     val action_panel = new FlowPanel(FlowPanel.Alignment.Center)(button, auto_close)
   133 
   135 
   134 
   136 
   155         }
   157         }
   156         catch { case exn: Throwable => (Exn.message(exn) + "\n", 2) }
   158         catch { case exn: Throwable => (Exn.message(exn) + "\n", 2) }
   157       Swing_Thread.now {
   159       Swing_Thread.now {
   158         progress.echo(out + (if (rc == 0) "OK\n" else "Return code: " + rc + "\n"))
   160         progress.echo(out + (if (rc == 0) "OK\n" else "Return code: " + rc + "\n"))
   159         return_code = rc
   161         return_code = rc
   160         button_exit()
   162         delay_button_exit.invoke()
   161       }
   163       }
   162     })
   164     })
   163   }
   165   }
   164 }
   166 }
   165 
   167