author | wenzelm |
Thu, 20 May 2010 15:51:28 +0200 | |
changeset 36994 | 797af3ebd5f1 |
parent 36786 | b7a62e7dec00 |
child 40567 | a87a6b90e900 |
permissions | -rw-r--r-- |
31827
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff
changeset
|
1 |
/* Title: Pure/System/gui_setup.scala |
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff
changeset
|
2 |
Author: Makarius |
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff
changeset
|
3 |
|
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff
changeset
|
4 |
GUI for basic system setup. |
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff
changeset
|
5 |
*/ |
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff
changeset
|
6 |
|
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff
changeset
|
7 |
package isabelle |
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff
changeset
|
8 |
|
36994 | 9 |
import scala.swing.{Button, FlowPanel, BorderPanel, MainFrame, TextArea, SwingApplication} |
10 |
import scala.swing.event.ButtonClicked |
|
31827
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff
changeset
|
11 |
|
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff
changeset
|
12 |
|
36678
49918c180e8c
use SwingApplication instead of deprecated GUIApplication;
wenzelm
parents:
36207
diff
changeset
|
13 |
object GUI_Setup extends SwingApplication |
31827
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff
changeset
|
14 |
{ |
36678
49918c180e8c
use SwingApplication instead of deprecated GUIApplication;
wenzelm
parents:
36207
diff
changeset
|
15 |
def startup(args: Array[String]) = |
31828 | 16 |
{ |
36786 | 17 |
Platform.init_laf() |
36678
49918c180e8c
use SwingApplication instead of deprecated GUIApplication;
wenzelm
parents:
36207
diff
changeset
|
18 |
top.pack() |
49918c180e8c
use SwingApplication instead of deprecated GUIApplication;
wenzelm
parents:
36207
diff
changeset
|
19 |
top.visible = true |
31828 | 20 |
} |
21 |
||
31827
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff
changeset
|
22 |
def top = new MainFrame { |
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff
changeset
|
23 |
title = "Isabelle setup" |
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff
changeset
|
24 |
|
31843 | 25 |
// components |
26 |
val text = new TextArea { |
|
27 |
editable = false |
|
31860 | 28 |
columns = 80 |
29 |
rows = 20 |
|
31843 | 30 |
} |
36994 | 31 |
val ok = new Button { text = "OK" } |
32 |
val ok_panel = new FlowPanel(FlowPanel.Alignment.Center)(ok) |
|
33 |
||
34 |
val panel = new BorderPanel |
|
35 |
panel.layout(text) = BorderPanel.Position.Center |
|
36 |
panel.layout(ok_panel) = BorderPanel.Position.South |
|
37 |
contents = panel |
|
31827
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff
changeset
|
38 |
|
31843 | 39 |
// values |
36195
9c098598db2a
system properties determine the JVM platform, not the Isabelle one;
wenzelm
parents:
36193
diff
changeset
|
40 |
if (Platform.is_windows) |
34045
bc71778a327d
simplified Cygwin setup, assuming 1.7 registry layout (version 1.5 suffers from upcaseenv problem anyway);
wenzelm
parents:
31928
diff
changeset
|
41 |
text.append("Cygwin root: " + Cygwin.check_root() + "\n") |
36207 | 42 |
text.append("JVM platform: " + Platform.jvm_platform + "\n") |
31928 | 43 |
try { |
44 |
val isabelle_system = new Isabelle_System |
|
36206 | 45 |
text.append("ML platform: " + isabelle_system.getenv("ML_PLATFORM") + "\n") |
36197 | 46 |
text.append("Isabelle platform: " + isabelle_system.getenv("ISABELLE_PLATFORM") + "\n") |
47 |
val platform64 = isabelle_system.getenv("ISABELLE_PLATFORM64") |
|
48 |
if (platform64 != "") text.append("Isabelle platform (64 bit): " + platform64 + "\n") |
|
36206 | 49 |
text.append("Isabelle home: " + isabelle_system.getenv("ISABELLE_HOME") + "\n") |
36197 | 50 |
text.append("Isabelle java: " + isabelle_system.this_java() + "\n") |
31928 | 51 |
} catch { |
52 |
case e: RuntimeException => text.append(e.getMessage + "\n") |
|
53 |
} |
|
31843 | 54 |
|
55 |
// reactions |
|
31827
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff
changeset
|
56 |
listenTo(ok) |
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff
changeset
|
57 |
reactions += { |
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff
changeset
|
58 |
case ButtonClicked(`ok`) => System.exit(0) |
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff
changeset
|
59 |
} |
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff
changeset
|
60 |
} |
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff
changeset
|
61 |
} |
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff
changeset
|
62 |