| author | wenzelm | 
| Thu, 23 Jun 2011 14:52:32 +0200 | |
| changeset 43520 | cec9b95fa35d | 
| parent 43514 | 45cf8d5e109a | 
| child 43650 | f00da558b78e | 
| 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  | 
|
| 
43520
 
cec9b95fa35d
explicit import java.lang.System to prevent odd scope problems;
 
wenzelm 
parents: 
43514 
diff
changeset
 | 
9  | 
import java.lang.System  | 
| 
 
cec9b95fa35d
explicit import java.lang.System to prevent odd scope problems;
 
wenzelm 
parents: 
43514 
diff
changeset
 | 
10  | 
|
| 36994 | 11  | 
import scala.swing.{Button, FlowPanel, BorderPanel, MainFrame, TextArea, SwingApplication}
 | 
12  | 
import scala.swing.event.ButtonClicked  | 
|
| 
31827
 
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
 
wenzelm 
parents:  
diff
changeset
 | 
13  | 
|
| 
 
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  | 
object GUI_Setup extends SwingApplication  | 
| 
31827
 
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
 
wenzelm 
parents:  
diff
changeset
 | 
16  | 
{
 | 
| 
36678
 
49918c180e8c
use SwingApplication instead of deprecated GUIApplication;
 
wenzelm 
parents: 
36207 
diff
changeset
 | 
17  | 
def startup(args: Array[String]) =  | 
| 31828 | 18  | 
  {
 | 
| 36786 | 19  | 
Platform.init_laf()  | 
| 
36678
 
49918c180e8c
use SwingApplication instead of deprecated GUIApplication;
 
wenzelm 
parents: 
36207 
diff
changeset
 | 
20  | 
top.pack()  | 
| 
 
49918c180e8c
use SwingApplication instead of deprecated GUIApplication;
 
wenzelm 
parents: 
36207 
diff
changeset
 | 
21  | 
top.visible = true  | 
| 31828 | 22  | 
}  | 
23  | 
||
| 
31827
 
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
 
wenzelm 
parents:  
diff
changeset
 | 
24  | 
  def top = new MainFrame {
 | 
| 
 
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
 
wenzelm 
parents:  
diff
changeset
 | 
25  | 
title = "Isabelle setup"  | 
| 
 
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
 
wenzelm 
parents:  
diff
changeset
 | 
26  | 
|
| 31843 | 27  | 
// components  | 
28  | 
    val text = new TextArea {
 | 
|
29  | 
editable = false  | 
|
| 31860 | 30  | 
columns = 80  | 
31  | 
rows = 20  | 
|
| 31843 | 32  | 
}  | 
| 36994 | 33  | 
    val ok = new Button { text = "OK" }
 | 
34  | 
val ok_panel = new FlowPanel(FlowPanel.Alignment.Center)(ok)  | 
|
35  | 
||
36  | 
val panel = new BorderPanel  | 
|
37  | 
panel.layout(text) = BorderPanel.Position.Center  | 
|
38  | 
panel.layout(ok_panel) = BorderPanel.Position.South  | 
|
39  | 
contents = panel  | 
|
| 
31827
 
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
 
wenzelm 
parents:  
diff
changeset
 | 
40  | 
|
| 31843 | 41  | 
// values  | 
| 
36195
 
9c098598db2a
system properties determine the JVM platform, not the Isabelle one;
 
wenzelm 
parents: 
36193 
diff
changeset
 | 
42  | 
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
 | 
43  | 
      text.append("Cygwin root: " + Cygwin.check_root() + "\n")
 | 
| 41381 | 44  | 
    text.append("JVM name: " + Platform.jvm_name + "\n")
 | 
| 36207 | 45  | 
    text.append("JVM platform: " + Platform.jvm_platform + "\n")
 | 
| 31928 | 46  | 
    try {
 | 
| 
43514
 
45cf8d5e109a
lazy Isabelle_System.default supports implicit boot;
 
wenzelm 
parents: 
41381 
diff
changeset
 | 
47  | 
val isabelle_system = Isabelle_System.default  | 
| 36206 | 48  | 
      text.append("ML platform: " + isabelle_system.getenv("ML_PLATFORM") + "\n")
 | 
| 36197 | 49  | 
      text.append("Isabelle platform: " + isabelle_system.getenv("ISABELLE_PLATFORM") + "\n")
 | 
50  | 
      val platform64 = isabelle_system.getenv("ISABELLE_PLATFORM64")
 | 
|
51  | 
      if (platform64 != "") text.append("Isabelle platform (64 bit): " + platform64 + "\n")
 | 
|
| 36206 | 52  | 
      text.append("Isabelle home: " + isabelle_system.getenv("ISABELLE_HOME") + "\n")
 | 
| 36197 | 53  | 
      text.append("Isabelle java: " + isabelle_system.this_java() + "\n")
 | 
| 31928 | 54  | 
    } catch {
 | 
55  | 
case e: RuntimeException => text.append(e.getMessage + "\n")  | 
|
56  | 
}  | 
|
| 31843 | 57  | 
|
58  | 
// reactions  | 
|
| 
31827
 
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
 
wenzelm 
parents:  
diff
changeset
 | 
59  | 
listenTo(ok)  | 
| 
 
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
 
wenzelm 
parents:  
diff
changeset
 | 
60  | 
    reactions += {
 | 
| 
 
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
 
wenzelm 
parents:  
diff
changeset
 | 
61  | 
case ButtonClicked(`ok`) => System.exit(0)  | 
| 
 
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
 
wenzelm 
parents:  
diff
changeset
 | 
62  | 
}  | 
| 
 
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
 
wenzelm 
parents:  
diff
changeset
 | 
63  | 
}  | 
| 
 
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
 
wenzelm 
parents:  
diff
changeset
 | 
64  | 
}  | 
| 
 
b54362b9fbef
minimal GUI_Setup, which is the main class of Pure.jar;
 
wenzelm 
parents:  
diff
changeset
 | 
65  |