src/Pure/System/gui_setup.scala
author wenzelm
Mon, 19 Apr 2010 17:31:48 +0200
changeset 36206 a7d7f928d8b8
parent 36205 e86d9a10e982
child 36207 a94bbede91c7
permissions -rw-r--r--
more platform information;
     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 javax.swing.UIManager
    10 
    11 import scala.swing._
    12 import scala.swing.event._
    13 
    14 
    15 object GUI_Setup extends GUIApplication
    16 {
    17   def main(args: Array[String]) =
    18   {
    19     Swing_Thread.later {
    20       UIManager.setLookAndFeel(Platform.look_and_feel)
    21       top.pack()
    22       top.visible = true
    23     }
    24   }
    25 
    26   def top = new MainFrame {
    27     title = "Isabelle setup"
    28 
    29     // components
    30     val text = new TextArea {
    31       editable = false
    32       columns = 80
    33       rows = 20
    34       xLayoutAlignment = 0.5
    35     }
    36     val ok = new Button {
    37       text = "OK"
    38       xLayoutAlignment = 0.5
    39     }
    40     contents = new BoxPanel(Orientation.Vertical) {
    41       contents += text
    42       contents += ok
    43     }
    44 
    45     // values
    46     text.append("JVM platform: " + Platform.jvm_platform + "\n")
    47     if (Platform.is_windows)
    48       text.append("Cygwin root: " + Cygwin.check_root() + "\n")
    49     try {
    50       val isabelle_system = new Isabelle_System
    51       text.append("ML platform: " + isabelle_system.getenv("ML_PLATFORM") + "\n")
    52       text.append("Isabelle platform: " + isabelle_system.getenv("ISABELLE_PLATFORM") + "\n")
    53       val platform64 = isabelle_system.getenv("ISABELLE_PLATFORM64")
    54       if (platform64 != "") text.append("Isabelle platform (64 bit): " + platform64 + "\n")
    55       text.append("Isabelle home: " + isabelle_system.getenv("ISABELLE_HOME") + "\n")
    56       text.append("Isabelle java: " + isabelle_system.this_java() + "\n")
    57     } catch {
    58       case e: RuntimeException => text.append(e.getMessage + "\n")
    59     }
    60 
    61     // reactions
    62     listenTo(ok)
    63     reactions += {
    64       case ButtonClicked(`ok`) => System.exit(0)
    65     }
    66   }
    67 }
    68