src/Pure/Tools/build_dialog.scala
author wenzelm
Mon, 26 Aug 2013 21:56:08 +0200
changeset 53212 387b9f7cb0ac
parent 52115 3660205b96fa
child 53449 913df2adc99c
permissions -rw-r--r--
added SHA1 library integrity test, which is invoked at compile time and Isabelle_Process run-time;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50686
d703e3aafa8c moved files;
wenzelm
parents: 50546
diff changeset
     1
/*  Title:      Pure/Tools/build_dialog.scala
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
     3
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
     4
Dialog for session build process.
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
     5
*/
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
     6
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
     7
package isabelle
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
     8
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
     9
50378
72367327bab2 evade ugly default font, notably on Windows laf;
wenzelm
parents: 50377
diff changeset
    10
import java.awt.{GraphicsEnvironment, Point, Font}
50379
a8b0d3729a69 added keyboard shortcut for button (canonical way to do that?);
wenzelm
parents: 50378
diff changeset
    11
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    12
import scala.swing.{ScrollPane, Button, CheckBox, FlowPanel,
51254
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
    13
  BorderPanel, MainFrame, TextArea, SwingApplication, Component, Label}
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    14
import scala.swing.event.ButtonClicked
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    15
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    16
50404
898cac1dad5e avoid startup within GUI thread -- it is only required later for dialog;
wenzelm
parents: 50403
diff changeset
    17
object Build_Dialog
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    18
{
50404
898cac1dad5e avoid startup within GUI thread -- it is only required later for dialog;
wenzelm
parents: 50403
diff changeset
    19
  def main(args: Array[String]) =
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    20
  {
51617
4e49bba9772d tuned signature -- concentrate GUI tools;
wenzelm
parents: 51616
diff changeset
    21
    GUI.init_laf()
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    22
    try {
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    23
      args.toList match {
50369
622002c702ad more elementary dialog, with less interaction;
wenzelm
parents: 50368
diff changeset
    24
        case
50403
87868964733c more uniform default logic, using settings, options, args etc.;
wenzelm
parents: 50381
diff changeset
    25
          logic_option ::
50546
1b01a57d2749 clarified build_dialog command line;
wenzelm
parents: 50539
diff changeset
    26
          logic ::
50369
622002c702ad more elementary dialog, with less interaction;
wenzelm
parents: 50368
diff changeset
    27
          Properties.Value.Boolean(system_mode) ::
50403
87868964733c more uniform default logic, using settings, options, args etc.;
wenzelm
parents: 50381
diff changeset
    28
          include_dirs =>
50405
366c4a602500 clarified build_dialog: regular up-to-date check (extra cost of approx. 5s startup for HOL);
wenzelm
parents: 50404
diff changeset
    29
            val more_dirs = include_dirs.map(s => ((false, Path.explode(s))))
50404
898cac1dad5e avoid startup within GUI thread -- it is only required later for dialog;
wenzelm
parents: 50403
diff changeset
    30
898cac1dad5e avoid startup within GUI thread -- it is only required later for dialog;
wenzelm
parents: 50403
diff changeset
    31
            val options = Options.init()
50403
87868964733c more uniform default logic, using settings, options, args etc.;
wenzelm
parents: 50381
diff changeset
    32
            val session =
50404
898cac1dad5e avoid startup within GUI thread -- it is only required later for dialog;
wenzelm
parents: 50403
diff changeset
    33
              Isabelle_System.default_logic(logic,
898cac1dad5e avoid startup within GUI thread -- it is only required later for dialog;
wenzelm
parents: 50403
diff changeset
    34
                if (logic_option != "") options.string(logic_option) else "")
50403
87868964733c more uniform default logic, using settings, options, args etc.;
wenzelm
parents: 50381
diff changeset
    35
52115
3660205b96fa tuned signature;
wenzelm
parents: 51617
diff changeset
    36
            if (Build.build(options = options, build_heap = true, no_build = true,
50405
366c4a602500 clarified build_dialog: regular up-to-date check (extra cost of approx. 5s startup for HOL);
wenzelm
parents: 50404
diff changeset
    37
                more_dirs = more_dirs, sessions = List(session)) == 0) sys.exit(0)
50404
898cac1dad5e avoid startup within GUI thread -- it is only required later for dialog;
wenzelm
parents: 50403
diff changeset
    38
            else
898cac1dad5e avoid startup within GUI thread -- it is only required later for dialog;
wenzelm
parents: 50403
diff changeset
    39
              Swing_Thread.later {
50405
366c4a602500 clarified build_dialog: regular up-to-date check (extra cost of approx. 5s startup for HOL);
wenzelm
parents: 50404
diff changeset
    40
                val top = build_dialog(options, system_mode, more_dirs, session)
50404
898cac1dad5e avoid startup within GUI thread -- it is only required later for dialog;
wenzelm
parents: 50403
diff changeset
    41
                top.pack()
898cac1dad5e avoid startup within GUI thread -- it is only required later for dialog;
wenzelm
parents: 50403
diff changeset
    42
898cac1dad5e avoid startup within GUI thread -- it is only required later for dialog;
wenzelm
parents: 50403
diff changeset
    43
                val point = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint()
50532
345b25cf2e4f actually request heap image in initial up-to-date check;
wenzelm
parents: 50405
diff changeset
    44
                top.location =
345b25cf2e4f actually request heap image in initial up-to-date check;
wenzelm
parents: 50405
diff changeset
    45
                  new Point(point.x - top.size.width / 2, point.y - top.size.height / 2)
50404
898cac1dad5e avoid startup within GUI thread -- it is only required later for dialog;
wenzelm
parents: 50403
diff changeset
    46
898cac1dad5e avoid startup within GUI thread -- it is only required later for dialog;
wenzelm
parents: 50403
diff changeset
    47
                top.visible = true
898cac1dad5e avoid startup within GUI thread -- it is only required later for dialog;
wenzelm
parents: 50403
diff changeset
    48
              }
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    49
        case _ => error("Bad arguments:\n" + cat_lines(args))
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    50
      }
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    51
    }
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    52
    catch {
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    53
      case exn: Throwable =>
51616
949e2cf02a3d tuned signature -- concentrate GUI tools;
wenzelm
parents: 51615
diff changeset
    54
        GUI.error_dialog(null, "Isabelle build failure", GUI.scrollable_text(Exn.message(exn)))
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    55
        sys.exit(2)
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    56
    }
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    57
  }
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    58
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    59
50369
622002c702ad more elementary dialog, with less interaction;
wenzelm
parents: 50368
diff changeset
    60
  def build_dialog(
50404
898cac1dad5e avoid startup within GUI thread -- it is only required later for dialog;
wenzelm
parents: 50403
diff changeset
    61
    options: Options,
50369
622002c702ad more elementary dialog, with less interaction;
wenzelm
parents: 50368
diff changeset
    62
    system_mode: Boolean,
50405
366c4a602500 clarified build_dialog: regular up-to-date check (extra cost of approx. 5s startup for HOL);
wenzelm
parents: 50404
diff changeset
    63
    more_dirs: List[(Boolean, Path)],
50369
622002c702ad more elementary dialog, with less interaction;
wenzelm
parents: 50368
diff changeset
    64
    session: String): MainFrame = new MainFrame
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    65
  {
51615
072a7249e1ac separate module "GUI", to keep this out of the way of generic Isabelle_System operations, notably for non-Isabelle/jEdit applications;
wenzelm
parents: 51254
diff changeset
    66
    iconImage = GUI.isabelle_image()
50854
2b15227b17e8 add icon for toplevel windows;
wenzelm
parents: 50853
diff changeset
    67
2b15227b17e8 add icon for toplevel windows;
wenzelm
parents: 50853
diff changeset
    68
50368
e6c0720e4cef basic interaction with build process;
wenzelm
parents: 50365
diff changeset
    69
    /* GUI state */
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    70
51253
ab4c296a1e60 clarified Progress.stopped: rising edge only;
wenzelm
parents: 50930
diff changeset
    71
    @volatile private var is_stopped = false
50742
38114719a9bc premature window close means failure;
wenzelm
parents: 50740
diff changeset
    72
    private var return_code = 2
50368
e6c0720e4cef basic interaction with build process;
wenzelm
parents: 50365
diff changeset
    73
50740
21098a577294 proper return code on window close;
wenzelm
parents: 50686
diff changeset
    74
    override def closeOperation { sys.exit(return_code) }
21098a577294 proper return code on window close;
wenzelm
parents: 50686
diff changeset
    75
50368
e6c0720e4cef basic interaction with build process;
wenzelm
parents: 50365
diff changeset
    76
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    77
    /* text */
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    78
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    79
    val text = new TextArea {
51616
949e2cf02a3d tuned signature -- concentrate GUI tools;
wenzelm
parents: 51615
diff changeset
    80
      font = new Font("SansSerif", Font.PLAIN, GUI.resolution_scale(10) max 14)
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    81
      editable = false
50850
4cd2d090be8f tuned font size, notably for current HD displays;
wenzelm
parents: 50848
diff changeset
    82
      columns = 50
4cd2d090be8f tuned font size, notably for current HD displays;
wenzelm
parents: 50848
diff changeset
    83
      rows = 20
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    84
    }
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    85
50852
a667ac8c7afe forced scroll to bottom, for improved cross-platform appearance;
wenzelm
parents: 50850
diff changeset
    86
    val scroll_text = new ScrollPane(text)
a667ac8c7afe forced scroll to bottom, for improved cross-platform appearance;
wenzelm
parents: 50850
diff changeset
    87
50368
e6c0720e4cef basic interaction with build process;
wenzelm
parents: 50365
diff changeset
    88
    val progress = new Build.Progress
e6c0720e4cef basic interaction with build process;
wenzelm
parents: 50365
diff changeset
    89
    {
50846
529e652d389d more uniform theory progress in build -v and build_dialog;
wenzelm
parents: 50845
diff changeset
    90
      override def echo(msg: String): Unit =
50852
a667ac8c7afe forced scroll to bottom, for improved cross-platform appearance;
wenzelm
parents: 50850
diff changeset
    91
        Swing_Thread.later {
a667ac8c7afe forced scroll to bottom, for improved cross-platform appearance;
wenzelm
parents: 50850
diff changeset
    92
          text.append(msg + "\n")
a667ac8c7afe forced scroll to bottom, for improved cross-platform appearance;
wenzelm
parents: 50850
diff changeset
    93
          val vertical = scroll_text.peer.getVerticalScrollBar
a667ac8c7afe forced scroll to bottom, for improved cross-platform appearance;
wenzelm
parents: 50850
diff changeset
    94
          vertical.setValue(vertical.getMaximum)
a667ac8c7afe forced scroll to bottom, for improved cross-platform appearance;
wenzelm
parents: 50850
diff changeset
    95
        }
50846
529e652d389d more uniform theory progress in build -v and build_dialog;
wenzelm
parents: 50845
diff changeset
    96
      override def theory(session: String, theory: String): Unit =
529e652d389d more uniform theory progress in build -v and build_dialog;
wenzelm
parents: 50845
diff changeset
    97
        echo(session + ": theory " + theory)
51253
ab4c296a1e60 clarified Progress.stopped: rising edge only;
wenzelm
parents: 50930
diff changeset
    98
      override def stopped: Boolean = is_stopped
50368
e6c0720e4cef basic interaction with build process;
wenzelm
parents: 50365
diff changeset
    99
    }
e6c0720e4cef basic interaction with build process;
wenzelm
parents: 50365
diff changeset
   100
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
   101
51254
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   102
    /* layout panel with dynamic actions */
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   103
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   104
    val action_panel = new FlowPanel(FlowPanel.Alignment.Center)()
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   105
    val layout_panel = new BorderPanel
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   106
    layout_panel.layout(scroll_text) = BorderPanel.Position.Center
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   107
    layout_panel.layout(action_panel) = BorderPanel.Position.South
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   108
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   109
    contents = layout_panel
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   110
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   111
    def set_actions(cs: Component*)
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   112
    {
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   113
      action_panel.contents.clear
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   114
      action_panel.contents ++= cs
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   115
      layout_panel.revalidate
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   116
      layout_panel.repaint
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   117
    }
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   118
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   119
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   120
    /* actions */
50848
4e123d57c9b4 tuned build_dialog: auto_close checkbox avoids user sitting and waiting;
wenzelm
parents: 50846
diff changeset
   121
4e123d57c9b4 tuned build_dialog: auto_close checkbox avoids user sitting and waiting;
wenzelm
parents: 50846
diff changeset
   122
    var do_auto_close = true
4e123d57c9b4 tuned build_dialog: auto_close checkbox avoids user sitting and waiting;
wenzelm
parents: 50846
diff changeset
   123
    def check_auto_close(): Unit = if (do_auto_close && return_code == 0) sys.exit(return_code)
4e123d57c9b4 tuned build_dialog: auto_close checkbox avoids user sitting and waiting;
wenzelm
parents: 50846
diff changeset
   124
4e123d57c9b4 tuned build_dialog: auto_close checkbox avoids user sitting and waiting;
wenzelm
parents: 50846
diff changeset
   125
    val auto_close = new CheckBox("Auto close") {
4e123d57c9b4 tuned build_dialog: auto_close checkbox avoids user sitting and waiting;
wenzelm
parents: 50846
diff changeset
   126
      reactions += {
4e123d57c9b4 tuned build_dialog: auto_close checkbox avoids user sitting and waiting;
wenzelm
parents: 50846
diff changeset
   127
        case ButtonClicked(_) => do_auto_close = this.selected
4e123d57c9b4 tuned build_dialog: auto_close checkbox avoids user sitting and waiting;
wenzelm
parents: 50846
diff changeset
   128
        check_auto_close()
4e123d57c9b4 tuned build_dialog: auto_close checkbox avoids user sitting and waiting;
wenzelm
parents: 50846
diff changeset
   129
      }
4e123d57c9b4 tuned build_dialog: auto_close checkbox avoids user sitting and waiting;
wenzelm
parents: 50846
diff changeset
   130
    }
4e123d57c9b4 tuned build_dialog: auto_close checkbox avoids user sitting and waiting;
wenzelm
parents: 50846
diff changeset
   131
    auto_close.selected = do_auto_close
4e123d57c9b4 tuned build_dialog: auto_close checkbox avoids user sitting and waiting;
wenzelm
parents: 50846
diff changeset
   132
    auto_close.tooltip = "Automatically close dialog when finished"
4e123d57c9b4 tuned build_dialog: auto_close checkbox avoids user sitting and waiting;
wenzelm
parents: 50846
diff changeset
   133
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
   134
51254
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   135
    val stop_button = new Button("Stop") {
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   136
      reactions += {
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   137
        case ButtonClicked(_) =>
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   138
          is_stopped = true
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   139
          set_actions(new Label("Stopping ..."))
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   140
      }
50376
82cbe4051d98 more direct dialog via existing GUI components;
wenzelm
parents: 50374
diff changeset
   141
    }
50930
23601c59f347 delay to give users a chance to see what was happening, even with auto_close enabled;
wenzelm
parents: 50854
diff changeset
   142
51254
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   143
    set_actions(stop_button, auto_close)
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   144
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   145
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   146
    /* exit */
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   147
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   148
    val delay_exit =
50930
23601c59f347 delay to give users a chance to see what was happening, even with auto_close enabled;
wenzelm
parents: 50854
diff changeset
   149
      Swing_Thread.delay_first(Time.seconds(1.0))
23601c59f347 delay to give users a chance to see what was happening, even with auto_close enabled;
wenzelm
parents: 50854
diff changeset
   150
      {
23601c59f347 delay to give users a chance to see what was happening, even with auto_close enabled;
wenzelm
parents: 50854
diff changeset
   151
        check_auto_close()
51254
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   152
        val button =
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   153
          new Button(if (return_code == 0) "OK" else "Exit") {
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   154
            reactions += { case ButtonClicked(_) => sys.exit(return_code) }
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   155
          }
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   156
        set_actions(button)
50930
23601c59f347 delay to give users a chance to see what was happening, even with auto_close enabled;
wenzelm
parents: 50854
diff changeset
   157
        button.peer.getRootPane.setDefaultButton(button.peer)
23601c59f347 delay to give users a chance to see what was happening, even with auto_close enabled;
wenzelm
parents: 50854
diff changeset
   158
      }
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
   159
50848
4e123d57c9b4 tuned build_dialog: auto_close checkbox avoids user sitting and waiting;
wenzelm
parents: 50846
diff changeset
   160
50369
622002c702ad more elementary dialog, with less interaction;
wenzelm
parents: 50368
diff changeset
   161
    /* main build */
622002c702ad more elementary dialog, with less interaction;
wenzelm
parents: 50368
diff changeset
   162
50374
1a7cae0711d2 tuned message;
wenzelm
parents: 50372
diff changeset
   163
    title = "Isabelle build (" + Isabelle_System.getenv("ML_IDENTIFIER") + ")"
50372
11c96cac860d tuned message;
wenzelm
parents: 50371
diff changeset
   164
    progress.echo("Build started for Isabelle/" + session + " ...")
50369
622002c702ad more elementary dialog, with less interaction;
wenzelm
parents: 50368
diff changeset
   165
622002c702ad more elementary dialog, with less interaction;
wenzelm
parents: 50368
diff changeset
   166
    default_thread_pool.submit(() => {
622002c702ad more elementary dialog, with less interaction;
wenzelm
parents: 50368
diff changeset
   167
      val (out, rc) =
622002c702ad more elementary dialog, with less interaction;
wenzelm
parents: 50368
diff changeset
   168
        try {
622002c702ad more elementary dialog, with less interaction;
wenzelm
parents: 50368
diff changeset
   169
          ("",
52115
3660205b96fa tuned signature;
wenzelm
parents: 51617
diff changeset
   170
            Build.build(options = options, progress = progress,
3660205b96fa tuned signature;
wenzelm
parents: 51617
diff changeset
   171
              build_heap = true, more_dirs = more_dirs,
50370
d5dbb63df0c7 check for existing image (even if outdated);
wenzelm
parents: 50369
diff changeset
   172
              system_mode = system_mode, sessions = List(session)))
50369
622002c702ad more elementary dialog, with less interaction;
wenzelm
parents: 50368
diff changeset
   173
        }
622002c702ad more elementary dialog, with less interaction;
wenzelm
parents: 50368
diff changeset
   174
        catch { case exn: Throwable => (Exn.message(exn) + "\n", 2) }
50376
82cbe4051d98 more direct dialog via existing GUI components;
wenzelm
parents: 50374
diff changeset
   175
      Swing_Thread.now {
82cbe4051d98 more direct dialog via existing GUI components;
wenzelm
parents: 50374
diff changeset
   176
        progress.echo(out + (if (rc == 0) "OK\n" else "Return code: " + rc + "\n"))
50740
21098a577294 proper return code on window close;
wenzelm
parents: 50686
diff changeset
   177
        return_code = rc
51254
5bae6fc0e125 more explicit GUI components for dynamic actions;
wenzelm
parents: 51253
diff changeset
   178
        delay_exit.invoke()
50371
9b6f5f758c31 tuned OK feedback;
wenzelm
parents: 50370
diff changeset
   179
      }
50369
622002c702ad more elementary dialog, with less interaction;
wenzelm
parents: 50368
diff changeset
   180
    })
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
   181
  }
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
   182
}
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
   183