tuned signature;
authorwenzelm
Wed, 05 Aug 2015 16:13:42 +0200
changeset 60843 9980f3bcdea2
parent 60842 5510c8444bc4
child 60844 f7f2bc0e4293
tuned signature;
etc/options
src/Tools/jEdit/src/isabelle.scala
src/Tools/jEdit/src/jedit_options.scala
--- a/etc/options	Wed Aug 05 14:18:07 2015 +0200
+++ b/etc/options	Wed Aug 05 16:13:42 2015 +0200
@@ -111,7 +111,7 @@
   -- "ML debugger in single-step mode"
 
 public option ML_statistics : bool = true
-  -- "ML runtime system statistics"
+  -- "ML run-time system statistics"
 
 
 section "Editor Reactivity"
--- a/src/Tools/jEdit/src/isabelle.scala	Wed Aug 05 14:18:07 2015 +0200
+++ b/src/Tools/jEdit/src/isabelle.scala	Wed Aug 05 16:13:42 2015 +0200
@@ -201,24 +201,8 @@
 
   /* ML statistics */
 
-  private val ML_STATISTICS = "ML_statistics"
-
-  def ml_statistics: Boolean = PIDE.options.bool(ML_STATISTICS)
-  def ml_statistics_=(b: Boolean): Unit =
-    GUI_Thread.require {
-      if (ml_statistics != b) {
-        PIDE.options.bool(ML_STATISTICS) = b
-        PIDE.session.update_options(PIDE.options.value)
-      }
-    }
-
-  class ML_Stats extends CheckBox("ML statistics")
-  {
-    tooltip = "Enable ML runtime system statistics"
-    reactions += { case ButtonClicked(_) => ml_statistics = selected }
-    def load() { selected = ml_statistics }
-    load()
-  }
+  class ML_Stats extends
+    JEdit_Options.Check_Box("ML_statistics", "ML statistics", "Enable ML runtime system statistics")
 
 
   /* required document nodes */
--- a/src/Tools/jEdit/src/jedit_options.scala	Wed Aug 05 14:18:07 2015 +0200
+++ b/src/Tools/jEdit/src/jedit_options.scala	Wed Aug 05 16:13:42 2015 +0200
@@ -14,6 +14,7 @@
 import javax.swing.text.JTextComponent
 
 import scala.swing.{Component, CheckBox, TextArea}
+import scala.swing.event.ButtonClicked
 
 import org.gjt.sp.jedit.gui.ColorWellButton
 
@@ -28,6 +29,23 @@
 object JEdit_Options
 {
   val RENDERING_SECTION = "Rendering of Document Content"
+
+  class Check_Box(name: String, label: String, description: String) extends CheckBox(label)
+  {
+    tooltip = description
+    reactions += { case ButtonClicked(_) => update(selected) }
+
+    def stored: Boolean = PIDE.options.bool(name)
+    def load() { selected = stored }
+    def update(b: Boolean): Unit =
+      GUI_Thread.require {
+        if (selected != b) selected = b
+        if (stored != b) {
+          PIDE.options.bool(name) = b
+          PIDE.session.update_options(PIDE.options.value)
+        }
+      }
+  }
 }
 
 class JEdit_Options extends Options_Variable