src/Pure/System/system_dialog.scala
changeset 53455 e9a3390217b3
parent 53454 1a0c39c728a1
child 53456 d12be8f62285
--- a/src/Pure/System/system_dialog.scala	Sat Sep 07 14:07:12 2013 +0200
+++ b/src/Pure/System/system_dialog.scala	Sat Sep 07 14:14:25 2013 +0200
@@ -8,6 +8,7 @@
 
 
 import java.awt.{GraphicsEnvironment, Point, Font}
+import javax.swing.WindowConstants
 
 import scala.swing.{ScrollPane, Button, CheckBox, FlowPanel,
   BorderPanel, Frame, TextArea, SwingApplication, Component, Label}
@@ -69,8 +70,6 @@
     title = _title
     iconImage = GUI.isabelle_image()
 
-    override def closeOperation { if (_return_code.isDefined) conclude() }
-
 
     /* text */
 
@@ -102,7 +101,24 @@
     }
 
 
-    /* actions */
+    /* close */
+
+    peer.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE)
+
+    override def closeOperation {
+      if (_return_code.isDefined) conclude()
+      else stopping()
+    }
+
+    def stopping()
+    {
+      is_stopped = true
+      set_actions(new Label("Stopping ..."))
+    }
+
+    val stop_button = new Button("Stop") {
+      reactions += { case ButtonClicked(_) => stopping() }
+    }
 
     var do_auto_close = true
     def can_auto_close: Boolean = do_auto_close && _return_code == Some(0)
@@ -116,15 +132,6 @@
     auto_close.selected = do_auto_close
     auto_close.tooltip = "Automatically close dialog when finished"
 
-
-    val stop_button = new Button("Stop") {
-      reactions += {
-        case ButtonClicked(_) =>
-          is_stopped = true
-          set_actions(new Label("Stopping ..."))
-      }
-    }
-
     set_actions(stop_button, auto_close)