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;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31827
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
     1
/*  Title:      Pure/System/gui_setup.scala
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
     3
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
     4
GUI for basic system setup.
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
     5
*/
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
     6
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
     7
package isabelle
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
     8
31828
31584cf201cc sane platform look-and-feel;
wenzelm
parents: 31827
diff changeset
     9
import javax.swing.UIManager
31584cf201cc sane platform look-and-feel;
wenzelm
parents: 31827
diff changeset
    10
31827
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    11
import scala.swing._
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    12
import scala.swing.event._
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    13
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    14
31828
31584cf201cc sane platform look-and-feel;
wenzelm
parents: 31827
diff changeset
    15
object GUI_Setup extends GUIApplication
31827
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    16
{
31828
31584cf201cc sane platform look-and-feel;
wenzelm
parents: 31827
diff changeset
    17
  def main(args: Array[String]) =
31584cf201cc sane platform look-and-feel;
wenzelm
parents: 31827
diff changeset
    18
  {
31862
53acb8ec6c51 renamed Swing to Swing_Thread, to avoid overlap with scala.swing.Swing;
wenzelm
parents: 31860
diff changeset
    19
    Swing_Thread.later {
31828
31584cf201cc sane platform look-and-feel;
wenzelm
parents: 31827
diff changeset
    20
      UIManager.setLookAndFeel(Platform.look_and_feel)
31584cf201cc sane platform look-and-feel;
wenzelm
parents: 31827
diff changeset
    21
      top.pack()
31584cf201cc sane platform look-and-feel;
wenzelm
parents: 31827
diff changeset
    22
      top.visible = true
31584cf201cc sane platform look-and-feel;
wenzelm
parents: 31827
diff changeset
    23
    }
31584cf201cc sane platform look-and-feel;
wenzelm
parents: 31827
diff changeset
    24
  }
31584cf201cc sane platform look-and-feel;
wenzelm
parents: 31827
diff changeset
    25
31827
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    26
  def top = new MainFrame {
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    27
    title = "Isabelle setup"
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    28
31843
f02c6a43f1b3 display some platform information;
wenzelm
parents: 31828
diff changeset
    29
    // components
f02c6a43f1b3 display some platform information;
wenzelm
parents: 31828
diff changeset
    30
    val text = new TextArea {
f02c6a43f1b3 display some platform information;
wenzelm
parents: 31828
diff changeset
    31
      editable = false
31860
e49011bb85da more display;
wenzelm
parents: 31844
diff changeset
    32
      columns = 80
e49011bb85da more display;
wenzelm
parents: 31844
diff changeset
    33
      rows = 20
31843
f02c6a43f1b3 display some platform information;
wenzelm
parents: 31828
diff changeset
    34
      xLayoutAlignment = 0.5
f02c6a43f1b3 display some platform information;
wenzelm
parents: 31828
diff changeset
    35
    }
f02c6a43f1b3 display some platform information;
wenzelm
parents: 31828
diff changeset
    36
    val ok = new Button {
f02c6a43f1b3 display some platform information;
wenzelm
parents: 31828
diff changeset
    37
      text = "OK"
f02c6a43f1b3 display some platform information;
wenzelm
parents: 31828
diff changeset
    38
      xLayoutAlignment = 0.5
f02c6a43f1b3 display some platform information;
wenzelm
parents: 31828
diff changeset
    39
    }
31827
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    40
    contents = new BoxPanel(Orientation.Vertical) {
31843
f02c6a43f1b3 display some platform information;
wenzelm
parents: 31828
diff changeset
    41
      contents += text
31827
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    42
      contents += ok
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    43
    }
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    44
31843
f02c6a43f1b3 display some platform information;
wenzelm
parents: 31828
diff changeset
    45
    // values
36205
e86d9a10e982 check JVM platform at most once -- still non-strict to prevent potential failure during initialization of object Platform;
wenzelm
parents: 36197
diff changeset
    46
    text.append("JVM platform: " + Platform.jvm_platform + "\n")
36195
9c098598db2a system properties determine the JVM platform, not the Isabelle one;
wenzelm
parents: 36193
diff changeset
    47
    if (Platform.is_windows)
34045
bc71778a327d simplified Cygwin setup, assuming 1.7 registry layout (version 1.5 suffers from upcaseenv problem anyway);
wenzelm
parents: 31928
diff changeset
    48
      text.append("Cygwin root: " + Cygwin.check_root() + "\n")
31928
2d8e50886558 init/check Isabelle_System;
wenzelm
parents: 31862
diff changeset
    49
    try {
2d8e50886558 init/check Isabelle_System;
wenzelm
parents: 31862
diff changeset
    50
      val isabelle_system = new Isabelle_System
36206
a7d7f928d8b8 more platform information;
wenzelm
parents: 36205
diff changeset
    51
      text.append("ML platform: " + isabelle_system.getenv("ML_PLATFORM") + "\n")
36197
2e92aca73cab more platform info;
wenzelm
parents: 36195
diff changeset
    52
      text.append("Isabelle platform: " + isabelle_system.getenv("ISABELLE_PLATFORM") + "\n")
2e92aca73cab more platform info;
wenzelm
parents: 36195
diff changeset
    53
      val platform64 = isabelle_system.getenv("ISABELLE_PLATFORM64")
2e92aca73cab more platform info;
wenzelm
parents: 36195
diff changeset
    54
      if (platform64 != "") text.append("Isabelle platform (64 bit): " + platform64 + "\n")
36206
a7d7f928d8b8 more platform information;
wenzelm
parents: 36205
diff changeset
    55
      text.append("Isabelle home: " + isabelle_system.getenv("ISABELLE_HOME") + "\n")
36197
2e92aca73cab more platform info;
wenzelm
parents: 36195
diff changeset
    56
      text.append("Isabelle java: " + isabelle_system.this_java() + "\n")
31928
2d8e50886558 init/check Isabelle_System;
wenzelm
parents: 31862
diff changeset
    57
    } catch {
2d8e50886558 init/check Isabelle_System;
wenzelm
parents: 31862
diff changeset
    58
      case e: RuntimeException => text.append(e.getMessage + "\n")
2d8e50886558 init/check Isabelle_System;
wenzelm
parents: 31862
diff changeset
    59
    }
31843
f02c6a43f1b3 display some platform information;
wenzelm
parents: 31828
diff changeset
    60
f02c6a43f1b3 display some platform information;
wenzelm
parents: 31828
diff changeset
    61
    // reactions
31827
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    62
    listenTo(ok)
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    63
    reactions += {
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    64
      case ButtonClicked(`ok`) => System.exit(0)
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    65
    }
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    66
  }
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    67
}
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    68