clarified signature;
authorwenzelm
Sat, 13 Aug 2022 21:43:45 +0200
changeset 75851 56f3032f0747
parent 75850 4cd3036e1b82
child 75852 fcc25bb49def
clarified signature;
src/Tools/jEdit/src/jedit_options.scala
--- a/src/Tools/jEdit/src/jedit_options.scala	Sat Aug 13 21:42:52 2022 +0200
+++ b/src/Tools/jEdit/src/jedit_options.scala	Sat Aug 13 21:43:45 2022 +0200
@@ -52,6 +52,18 @@
   }
 
 
+  /* GUI components */
+
+  class Bool_GUI(access: Bool_Access, label: String, description: String)
+  extends CheckBox(label) {
+    tooltip = description
+    reactions += { case ButtonClicked(_) => access.update(selected) }
+    def load(): Unit = { selected = access() }
+
+    load()
+  }
+
+
   /* specific options */
 
   object continuous_checking extends Bool_Access("editor_continuous_checking") {
@@ -60,12 +72,8 @@
       PIDE.plugin.deps_changed()
     }
 
-    class GUI extends CheckBox("Continuous checking") {
-      tooltip = "Continuous checking of proof document (visible and required parts)"
-      reactions += { case ButtonClicked(_) => continuous_checking.update(selected) }
-      def load(): Unit = { selected = continuous_checking() }
-      load()
-    }
+    class GUI extends Bool_GUI(this, "Continuous checking",
+      "Continuous checking of proof document (visible and required parts)")
   }
 
   object output_state extends Bool_Access("editor_output_state") {
@@ -75,12 +83,8 @@
       PIDE.editor.flush()
     }
 
-    class GUI extends CheckBox("Proof state") {
-      tooltip = "Output of proof state (normally shown on State panel)"
-      reactions += { case ButtonClicked(_) => output_state.update(selected) }
-      def load(): Unit = { selected = output_state() }
-      load()
-    }
+    class GUI extends Bool_GUI(this, "Proof state",
+      "Output of proof state (normally shown on State panel)")
   }
 }