50365
|
1 |
/* Title: Pure/System/build_dialog.scala
|
|
2 |
Author: Makarius
|
|
3 |
|
|
4 |
Dialog for session build process.
|
|
5 |
*/
|
|
6 |
|
|
7 |
package isabelle
|
|
8 |
|
|
9 |
|
|
10 |
import scala.swing.{ScrollPane, Button, CheckBox, FlowPanel,
|
|
11 |
BorderPanel, MainFrame, TextArea, SwingApplication}
|
|
12 |
import scala.swing.event.ButtonClicked
|
|
13 |
|
|
14 |
|
|
15 |
object Build_Dialog extends SwingApplication
|
|
16 |
{
|
|
17 |
def startup(args: Array[String]) =
|
|
18 |
{
|
|
19 |
Platform.init_laf()
|
|
20 |
|
|
21 |
try {
|
|
22 |
args.toList match {
|
|
23 |
case Command_Line.Chunks(include_dirs, List(session)) =>
|
|
24 |
val top = build_dialog(include_dirs.map(Path.explode), session)
|
|
25 |
top.pack()
|
|
26 |
top.visible = true
|
|
27 |
case _ => error("Bad arguments:\n" + cat_lines(args))
|
|
28 |
}
|
|
29 |
}
|
|
30 |
catch {
|
|
31 |
case exn: Throwable =>
|
|
32 |
Library.error_dialog(null, "Isabelle build failure",
|
|
33 |
Library.scrollable_text(Exn.message(exn)))
|
|
34 |
sys.exit(2)
|
|
35 |
}
|
|
36 |
}
|
|
37 |
|
|
38 |
|
|
39 |
def build_dialog(include_dirs: List[Path], session: String): MainFrame = new MainFrame
|
|
40 |
{
|
|
41 |
title = "Isabelle session build"
|
|
42 |
|
|
43 |
|
|
44 |
/* controls */
|
|
45 |
|
|
46 |
private var clean_build = false
|
|
47 |
private var system_build = false
|
|
48 |
private var verbose = false
|
|
49 |
|
|
50 |
private val clean = new CheckBox("Clean build") {
|
|
51 |
reactions += { case ButtonClicked(_) => clean_build = this.selected }
|
|
52 |
}
|
|
53 |
clean.selected = clean_build
|
|
54 |
clean.tooltip = "Delete outdated session images"
|
|
55 |
|
|
56 |
private val system = new CheckBox("System build") {
|
|
57 |
reactions += { case ButtonClicked(_) => system_build = this.selected }
|
|
58 |
}
|
|
59 |
system.selected = system_build
|
|
60 |
system.tooltip = "Produce output in $ISABELLE_HOME instead of $ISABELLE_HOME_USER"
|
|
61 |
|
|
62 |
private val verbose_mode = new CheckBox("Verbose mode") {
|
|
63 |
reactions += { case ButtonClicked(_) => verbose = this.selected }
|
|
64 |
}
|
|
65 |
verbose_mode.selected = verbose
|
|
66 |
verbose_mode.tooltip = "More output during build process"
|
|
67 |
|
|
68 |
val controls = new FlowPanel(FlowPanel.Alignment.Right)(clean, system, verbose_mode)
|
|
69 |
|
|
70 |
|
|
71 |
/* text */
|
|
72 |
|
|
73 |
val text = new TextArea {
|
|
74 |
editable = false
|
|
75 |
columns = 80
|
|
76 |
rows = 15
|
|
77 |
}
|
|
78 |
|
|
79 |
|
|
80 |
/* actions */
|
|
81 |
|
|
82 |
val ok = new Button { text = "OK" }
|
|
83 |
val ok_panel = new FlowPanel(FlowPanel.Alignment.Center)(ok)
|
|
84 |
|
|
85 |
listenTo(ok)
|
|
86 |
reactions += {
|
|
87 |
case ButtonClicked(`ok`) => sys.exit(0)
|
|
88 |
}
|
|
89 |
|
|
90 |
|
|
91 |
/* main panel */
|
|
92 |
|
|
93 |
val panel = new BorderPanel
|
|
94 |
panel.layout(controls) = BorderPanel.Position.North
|
|
95 |
panel.layout(new ScrollPane(text)) = BorderPanel.Position.Center
|
|
96 |
panel.layout(ok_panel) = BorderPanel.Position.South
|
|
97 |
contents = panel
|
|
98 |
}
|
|
99 |
}
|
|
100 |
|