src/Pure/GUI/gui_setup.scala
changeset 53855 11debf826dd6
parent 53837 65c775430caa
parent 53854 78afb4c4e683
child 53856 54c8dee1295a
equal deleted inserted replaced
53837:65c775430caa 53855:11debf826dd6
     1 /*  Title:      Pure/GUI/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     GUI.init_laf()
       
    21     top.pack()
       
    22     top.visible = true
       
    23   }
       
    24 
       
    25   def top = new MainFrame {
       
    26     iconImage = GUI.isabelle_image()
       
    27 
       
    28     title = "Isabelle setup"
       
    29 
       
    30     // components
       
    31     val text = new TextArea {
       
    32       editable = false
       
    33       columns = 80
       
    34       rows = 20
       
    35     }
       
    36     val ok = new Button { text = "OK" }
       
    37     val ok_panel = new FlowPanel(FlowPanel.Alignment.Center)(ok)
       
    38 
       
    39     val panel = new BorderPanel
       
    40     panel.layout(new ScrollPane(text)) = BorderPanel.Position.Center
       
    41     panel.layout(ok_panel) = BorderPanel.Position.South
       
    42     contents = panel
       
    43 
       
    44     // values
       
    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       if (Platform.is_windows)
       
    51         text.append("Cygwin root: " + Isabelle_System.get_cygwin_root() + "\n")
       
    52       text.append("ML platform: " + Isabelle_System.getenv("ML_PLATFORM") + "\n")
       
    53       text.append("Isabelle platform: " + Isabelle_System.getenv("ISABELLE_PLATFORM") + "\n")
       
    54       val platform64 = Isabelle_System.getenv("ISABELLE_PLATFORM64")
       
    55       if (platform64 != "") text.append("Isabelle platform (64 bit): " + platform64 + "\n")
       
    56       text.append("Isabelle home: " + Isabelle_System.getenv("ISABELLE_HOME") + "\n")
       
    57       val isabelle_home_windows = Isabelle_System.getenv("ISABELLE_HOME_WINDOWS")
       
    58       if (isabelle_home_windows != "")
       
    59         text.append("Isabelle home (Windows): " + isabelle_home_windows + "\n")
       
    60       text.append("Isabelle JDK home: " + Isabelle_System.getenv("ISABELLE_JDK_HOME") + "\n")
       
    61     }
       
    62     catch { case ERROR(msg) => text.append(msg + "\n") }
       
    63 
       
    64     // reactions
       
    65     listenTo(ok)
       
    66     reactions += {
       
    67       case ButtonClicked(`ok`) => sys.exit(0)
       
    68     }
       
    69   }
       
    70 }
       
    71