src/Pure/System/gui_setup.scala
author wenzelm
Sat, 07 Apr 2012 16:41:59 +0200
changeset 47389 e8552cba702d
parent 47113 b5a5662528fb
child 47467 a0007b769a34
permissions -rw-r--r--
explicit checks stable_finished_theory/stable_command allow parallel asynchronous command transactions; tuned;
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
43520
cec9b95fa35d explicit import java.lang.System to prevent odd scope problems;
wenzelm
parents: 43514
diff changeset
     9
import java.lang.System
cec9b95fa35d explicit import java.lang.System to prevent odd scope problems;
wenzelm
parents: 43514
diff changeset
    10
36994
797af3ebd5f1 simplified alignment via FlowPanel;
wenzelm
parents: 36786
diff changeset
    11
import scala.swing.{Button, FlowPanel, BorderPanel, MainFrame, TextArea, SwingApplication}
797af3ebd5f1 simplified alignment via FlowPanel;
wenzelm
parents: 36786
diff changeset
    12
import scala.swing.event.ButtonClicked
31827
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
36678
49918c180e8c use SwingApplication instead of deprecated GUIApplication;
wenzelm
parents: 36207
diff changeset
    15
object GUI_Setup extends SwingApplication
31827
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    16
{
36678
49918c180e8c use SwingApplication instead of deprecated GUIApplication;
wenzelm
parents: 36207
diff changeset
    17
  def startup(args: Array[String]) =
31828
31584cf201cc sane platform look-and-feel;
wenzelm
parents: 31827
diff changeset
    18
  {
36786
b7a62e7dec00 more convenient look-and-feel setup;
wenzelm
parents: 36678
diff changeset
    19
    Platform.init_laf()
36678
49918c180e8c use SwingApplication instead of deprecated GUIApplication;
wenzelm
parents: 36207
diff changeset
    20
    top.pack()
49918c180e8c use SwingApplication instead of deprecated GUIApplication;
wenzelm
parents: 36207
diff changeset
    21
    top.visible = true
31828
31584cf201cc sane platform look-and-feel;
wenzelm
parents: 31827
diff changeset
    22
  }
31584cf201cc sane platform look-and-feel;
wenzelm
parents: 31827
diff changeset
    23
31827
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    24
  def top = new MainFrame {
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    25
    title = "Isabelle setup"
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    26
31843
f02c6a43f1b3 display some platform information;
wenzelm
parents: 31828
diff changeset
    27
    // components
f02c6a43f1b3 display some platform information;
wenzelm
parents: 31828
diff changeset
    28
    val text = new TextArea {
f02c6a43f1b3 display some platform information;
wenzelm
parents: 31828
diff changeset
    29
      editable = false
31860
e49011bb85da more display;
wenzelm
parents: 31844
diff changeset
    30
      columns = 80
e49011bb85da more display;
wenzelm
parents: 31844
diff changeset
    31
      rows = 20
31843
f02c6a43f1b3 display some platform information;
wenzelm
parents: 31828
diff changeset
    32
    }
36994
797af3ebd5f1 simplified alignment via FlowPanel;
wenzelm
parents: 36786
diff changeset
    33
    val ok = new Button { text = "OK" }
797af3ebd5f1 simplified alignment via FlowPanel;
wenzelm
parents: 36786
diff changeset
    34
    val ok_panel = new FlowPanel(FlowPanel.Alignment.Center)(ok)
797af3ebd5f1 simplified alignment via FlowPanel;
wenzelm
parents: 36786
diff changeset
    35
797af3ebd5f1 simplified alignment via FlowPanel;
wenzelm
parents: 36786
diff changeset
    36
    val panel = new BorderPanel
797af3ebd5f1 simplified alignment via FlowPanel;
wenzelm
parents: 36786
diff changeset
    37
    panel.layout(text) = BorderPanel.Position.Center
797af3ebd5f1 simplified alignment via FlowPanel;
wenzelm
parents: 36786
diff changeset
    38
    panel.layout(ok_panel) = BorderPanel.Position.South
797af3ebd5f1 simplified alignment via FlowPanel;
wenzelm
parents: 36786
diff changeset
    39
    contents = panel
31827
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    40
31843
f02c6a43f1b3 display some platform information;
wenzelm
parents: 31828
diff changeset
    41
    // values
36195
9c098598db2a system properties determine the JVM platform, not the Isabelle one;
wenzelm
parents: 36193
diff changeset
    42
    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
    43
      text.append("Cygwin root: " + Cygwin.check_root() + "\n")
41381
77990a6cd558 more explicit jvm_name;
wenzelm
parents: 40567
diff changeset
    44
    text.append("JVM name: " + Platform.jvm_name + "\n")
36207
wenzelm
parents: 36206
diff changeset
    45
    text.append("JVM platform: " + Platform.jvm_platform + "\n")
47113
b5a5662528fb ISABELLE_JDK_HOME settings variable points to JDK with javac and jar (not just JRE);
wenzelm
parents: 43661
diff changeset
    46
    text.append("JVM home: " + java.lang.System.getProperty("java.home") + "\n")
31928
2d8e50886558 init/check Isabelle_System;
wenzelm
parents: 31862
diff changeset
    47
    try {
43661
39fdbd814c7f quasi-static Isabelle_System -- reduced tendency towards "functorial style";
wenzelm
parents: 43650
diff changeset
    48
      Isabelle_System.init()
39fdbd814c7f quasi-static Isabelle_System -- reduced tendency towards "functorial style";
wenzelm
parents: 43650
diff changeset
    49
      text.append("ML platform: " + Isabelle_System.getenv("ML_PLATFORM") + "\n")
39fdbd814c7f quasi-static Isabelle_System -- reduced tendency towards "functorial style";
wenzelm
parents: 43650
diff changeset
    50
      text.append("Isabelle platform: " + Isabelle_System.getenv("ISABELLE_PLATFORM") + "\n")
39fdbd814c7f quasi-static Isabelle_System -- reduced tendency towards "functorial style";
wenzelm
parents: 43650
diff changeset
    51
      val platform64 = Isabelle_System.getenv("ISABELLE_PLATFORM64")
36197
2e92aca73cab more platform info;
wenzelm
parents: 36195
diff changeset
    52
      if (platform64 != "") text.append("Isabelle platform (64 bit): " + platform64 + "\n")
43661
39fdbd814c7f quasi-static Isabelle_System -- reduced tendency towards "functorial style";
wenzelm
parents: 43650
diff changeset
    53
      text.append("Isabelle home: " + Isabelle_System.getenv("ISABELLE_HOME") + "\n")
47113
b5a5662528fb ISABELLE_JDK_HOME settings variable points to JDK with javac and jar (not just JRE);
wenzelm
parents: 43661
diff changeset
    54
      text.append("Isabelle jdk home: " + Isabelle_System.getenv("ISABELLE_JDK_HOME") + "\n")
43661
39fdbd814c7f quasi-static Isabelle_System -- reduced tendency towards "functorial style";
wenzelm
parents: 43650
diff changeset
    55
    }
39fdbd814c7f quasi-static Isabelle_System -- reduced tendency towards "functorial style";
wenzelm
parents: 43650
diff changeset
    56
    catch { case ERROR(msg) => text.append(msg + "\n") }
31843
f02c6a43f1b3 display some platform information;
wenzelm
parents: 31828
diff changeset
    57
f02c6a43f1b3 display some platform information;
wenzelm
parents: 31828
diff changeset
    58
    // reactions
31827
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    59
    listenTo(ok)
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    60
    reactions += {
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    61
      case ButtonClicked(`ok`) => System.exit(0)
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    62
    }
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    63
  }
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    64
}
b54362b9fbef minimal GUI_Setup, which is the main class of Pure.jar;
wenzelm
parents:
diff changeset
    65