src/Pure/System/gui_setup.scala
author wenzelm
Sat Apr 17 23:05:52 2010 +0200 (2010-04-17)
changeset 36197 2e92aca73cab
parent 36195 9c098598db2a
child 36205 e86d9a10e982
permissions -rw-r--r--
more platform info;
wenzelm@31827
     1
/*  Title:      Pure/System/gui_setup.scala
wenzelm@31827
     2
    Author:     Makarius
wenzelm@31827
     3
wenzelm@31827
     4
GUI for basic system setup.
wenzelm@31827
     5
*/
wenzelm@31827
     6
wenzelm@31827
     7
package isabelle
wenzelm@31827
     8
wenzelm@31828
     9
import javax.swing.UIManager
wenzelm@31828
    10
wenzelm@31827
    11
import scala.swing._
wenzelm@31827
    12
import scala.swing.event._
wenzelm@31827
    13
wenzelm@31827
    14
wenzelm@31828
    15
object GUI_Setup extends GUIApplication
wenzelm@31827
    16
{
wenzelm@31828
    17
  def main(args: Array[String]) =
wenzelm@31828
    18
  {
wenzelm@31862
    19
    Swing_Thread.later {
wenzelm@31828
    20
      UIManager.setLookAndFeel(Platform.look_and_feel)
wenzelm@31828
    21
      top.pack()
wenzelm@31828
    22
      top.visible = true
wenzelm@31828
    23
    }
wenzelm@31828
    24
  }
wenzelm@31828
    25
wenzelm@31827
    26
  def top = new MainFrame {
wenzelm@31827
    27
    title = "Isabelle setup"
wenzelm@31827
    28
wenzelm@31843
    29
    // components
wenzelm@31843
    30
    val text = new TextArea {
wenzelm@31843
    31
      editable = false
wenzelm@31860
    32
      columns = 80
wenzelm@31860
    33
      rows = 20
wenzelm@31843
    34
      xLayoutAlignment = 0.5
wenzelm@31843
    35
    }
wenzelm@31843
    36
    val ok = new Button {
wenzelm@31843
    37
      text = "OK"
wenzelm@31843
    38
      xLayoutAlignment = 0.5
wenzelm@31843
    39
    }
wenzelm@31827
    40
    contents = new BoxPanel(Orientation.Vertical) {
wenzelm@31843
    41
      contents += text
wenzelm@31827
    42
      contents += ok
wenzelm@31827
    43
    }
wenzelm@31827
    44
wenzelm@31843
    45
    // values
wenzelm@36195
    46
    text.append("JVM platform: " + Platform.jvm_platform() + "\n")
wenzelm@36195
    47
    if (Platform.is_windows)
wenzelm@34045
    48
      text.append("Cygwin root: " + Cygwin.check_root() + "\n")
wenzelm@31928
    49
    try {
wenzelm@31928
    50
      val isabelle_system = new Isabelle_System
wenzelm@31928
    51
      text.append("Isabelle home: " + isabelle_system.getenv("ISABELLE_HOME") + "\n")
wenzelm@36197
    52
      text.append("Isabelle platform: " + isabelle_system.getenv("ISABELLE_PLATFORM") + "\n")
wenzelm@36197
    53
      val platform64 = isabelle_system.getenv("ISABELLE_PLATFORM64")
wenzelm@36197
    54
      if (platform64 != "") text.append("Isabelle platform (64 bit): " + platform64 + "\n")
wenzelm@36197
    55
      text.append("Isabelle java: " + isabelle_system.this_java() + "\n")
wenzelm@31928
    56
    } catch {
wenzelm@31928
    57
      case e: RuntimeException => text.append(e.getMessage + "\n")
wenzelm@31928
    58
    }
wenzelm@31843
    59
wenzelm@31843
    60
    // reactions
wenzelm@31827
    61
    listenTo(ok)
wenzelm@31827
    62
    reactions += {
wenzelm@31827
    63
      case ButtonClicked(`ok`) => System.exit(0)
wenzelm@31827
    64
    }
wenzelm@31827
    65
  }
wenzelm@31827
    66
}
wenzelm@31827
    67