src/Pure/System/gui_setup.scala
author wenzelm
Mon Aug 23 16:53:22 2010 +0200 (2010-08-23)
changeset 38639 f642faca303e
parent 36994 797af3ebd5f1
child 40567 a87a6b90e900
permissions -rw-r--r--
main session actor as independent thread, to avoid starvation via regular worker pool;
tuned;
     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 scala.swing.{Button, FlowPanel, BorderPanel, MainFrame, TextArea, SwingApplication}
    10 import scala.swing.event.ButtonClicked
    11 
    12 
    13 object GUI_Setup extends SwingApplication
    14 {
    15   def startup(args: Array[String]) =
    16   {
    17     Platform.init_laf()
    18     top.pack()
    19     top.visible = true
    20   }
    21 
    22   def top = new MainFrame {
    23     title = "Isabelle setup"
    24 
    25     // components
    26     val text = new TextArea {
    27       editable = false
    28       columns = 80
    29       rows = 20
    30     }
    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
    38 
    39     // values
    40     if (Platform.is_windows)
    41       text.append("Cygwin root: " + Cygwin.check_root() + "\n")
    42     text.append("JVM platform: " + Platform.jvm_platform + "\n")
    43     try {
    44       val isabelle_system = new Isabelle_System
    45       text.append("ML platform: " + isabelle_system.getenv("ML_PLATFORM") + "\n")
    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")
    49       text.append("Isabelle home: " + isabelle_system.getenv("ISABELLE_HOME") + "\n")
    50       text.append("Isabelle java: " + isabelle_system.this_java() + "\n")
    51     } catch {
    52       case e: RuntimeException => text.append(e.getMessage + "\n")
    53     }
    54 
    55     // reactions
    56     listenTo(ok)
    57     reactions += {
    58       case ButtonClicked(`ok`) => System.exit(0)
    59     }
    60   }
    61 }
    62