src/Pure/System/gui_setup.scala
author wenzelm
Thu Aug 02 12:36:54 2012 +0200 (2012-08-02)
changeset 48646 91281e9472d8
parent 48192 07a32140ce0d
child 50652 ead5714cc480
permissions -rw-r--r--
more official command specifications, including source position;
     1 /*  Title:      Pure/System/gui_setup.scala
     2     Author:     Makarius
     3 
     4 GUI for basic system setup.
     5 */
     6 
     7 package isabelle
     8 
     9 import java.lang.System
    10 
    11 import scala.swing.{ScrollPane, Button, FlowPanel,
    12   BorderPanel, MainFrame, TextArea, SwingApplication}
    13 import scala.swing.event.ButtonClicked
    14 
    15 
    16 object GUI_Setup extends SwingApplication
    17 {
    18   def startup(args: Array[String]) =
    19   {
    20     Platform.init_laf()
    21     top.pack()
    22     top.visible = true
    23   }
    24 
    25   def top = new MainFrame {
    26     title = "Isabelle setup"
    27 
    28     // components
    29     val text = new TextArea {
    30       editable = false
    31       columns = 80
    32       rows = 20
    33     }
    34     val ok = new Button { text = "OK" }
    35     val ok_panel = new FlowPanel(FlowPanel.Alignment.Center)(ok)
    36 
    37     val panel = new BorderPanel
    38     panel.layout(new ScrollPane(text)) = BorderPanel.Position.Center
    39     panel.layout(ok_panel) = BorderPanel.Position.South
    40     contents = panel
    41 
    42     // values
    43     if (Platform.is_windows)
    44       text.append("Cygwin root: " + Standard_System.cygwin_root() + "\n")
    45     text.append("JVM name: " + Platform.jvm_name + "\n")
    46     text.append("JVM platform: " + Platform.jvm_platform + "\n")
    47     text.append("JVM home: " + java.lang.System.getProperty("java.home") + "\n")
    48     try {
    49       Isabelle_System.init()
    50       text.append("ML platform: " + Isabelle_System.getenv("ML_PLATFORM") + "\n")
    51       text.append("Isabelle platform: " + Isabelle_System.getenv("ISABELLE_PLATFORM") + "\n")
    52       val platform64 = Isabelle_System.getenv("ISABELLE_PLATFORM64")
    53       if (platform64 != "") text.append("Isabelle platform (64 bit): " + platform64 + "\n")
    54       text.append("Isabelle home: " + Isabelle_System.getenv("ISABELLE_HOME") + "\n")
    55       val isabelle_home_windows = Isabelle_System.getenv("ISABELLE_HOME_WINDOWS")
    56       if (isabelle_home_windows != "")
    57         text.append("Isabelle home (Windows): " + isabelle_home_windows + "\n")
    58       text.append("Isabelle JDK home: " + Isabelle_System.getenv("ISABELLE_JDK_HOME") + "\n")
    59     }
    60     catch { case ERROR(msg) => text.append(msg + "\n") }
    61 
    62     // reactions
    63     listenTo(ok)
    64     reactions += {
    65       case ButtonClicked(`ok`) => sys.exit(0)
    66     }
    67   }
    68 }
    69