added option "jedit_auto_load";
authorwenzelm
Wed, 18 Sep 2013 20:09:26 +0200
changeset 53715 68c664737d04
parent 53714 89fb20ae9b73
child 53716 b42d9a71fc1a
added option "jedit_auto_load"; allow in-place change of option "editor_continuous_checking";
src/Tools/jEdit/etc/options
src/Tools/jEdit/src/isabelle.scala
src/Tools/jEdit/src/plugin.scala
src/Tools/jEdit/src/theories_dockable.scala
--- a/src/Tools/jEdit/etc/options	Wed Sep 18 16:18:17 2013 +0200
+++ b/src/Tools/jEdit/etc/options	Wed Sep 18 20:09:26 2013 +0200
@@ -3,6 +3,9 @@
 public option jedit_logic : string = ""
   -- "default logic session"
 
+public option jedit_auto_load : bool = false
+  -- "load all required files automatically to resolve theory imports"
+
 public option jedit_reset_font_size : int = 18
   -- "reset font size for main text area"
 
--- a/src/Tools/jEdit/src/isabelle.scala	Wed Sep 18 16:18:17 2013 +0200
+++ b/src/Tools/jEdit/src/isabelle.scala	Wed Sep 18 20:09:26 2013 +0200
@@ -9,6 +9,9 @@
 
 import isabelle._
 
+import scala.swing.CheckBox
+import scala.swing.event.ButtonClicked
+
 import org.gjt.sp.jedit.{jEdit, View, Buffer}
 import org.gjt.sp.jedit.textarea.JEditTextArea
 import org.gjt.sp.jedit.gui.{DockableWindowManager, CompleteWord}
@@ -112,6 +115,14 @@
   def reset_continuous_checking() { continuous_checking = false }
   def toggle_continuous_checking() { continuous_checking = !continuous_checking }
 
+  class Continuous_Checking extends CheckBox("Continuous checking")
+  {
+    tooltip = "Continuous checking of proof document (visible and required parts)"
+    reactions += { case ButtonClicked(_) => continuous_checking = selected }
+    def load() { selected = continuous_checking }
+    load()
+  }
+
 
   /* required document nodes */
 
--- a/src/Tools/jEdit/src/plugin.scala	Wed Sep 18 16:18:17 2013 +0200
+++ b/src/Tools/jEdit/src/plugin.scala	Wed Sep 18 20:09:26 2013 +0200
@@ -170,21 +170,27 @@
             filter(file => !loaded_buffer(file) && PIDE.thy_load.check_file(view, file))
 
           if (!files.isEmpty) {
-            val files_list = new ListView(files.sorted)
-            for (i <- 0 until files.length)
-              files_list.selection.indices += i
+            if (PIDE.options.bool("jedit_auto_load")) {
+              files.foreach(file => jEdit.openFile(null: View, file))
+            }
+            else {
+              val files_list = new ListView(files.sorted)
+              for (i <- 0 until files.length)
+                files_list.selection.indices += i
 
-            val answer =
-              GUI.confirm_dialog(view,
-                "Auto loading of required files",
-                JOptionPane.YES_NO_OPTION,
-                "The following files are required to resolve theory imports.",
-                "Reload selected files now?",
-                new ScrollPane(files_list))
-            if (answer == 0) {
-              files.foreach(file =>
-                if (files_list.selection.items.contains(file))
-                  jEdit.openFile(null: View, file))
+              val answer =
+                GUI.confirm_dialog(view,
+                  "Auto loading of required files",
+                  JOptionPane.YES_NO_OPTION,
+                  "The following files are required to resolve theory imports.",
+                  "Reload selected files now?",
+                  new ScrollPane(files_list),
+                  new Isabelle.Continuous_Checking)
+              if (answer == 0) {
+                files.foreach(file =>
+                  if (files_list.selection.items.contains(file))
+                    jEdit.openFile(null: View, file))
+              }
             }
           }
         }
--- a/src/Tools/jEdit/src/theories_dockable.scala	Wed Sep 18 16:18:17 2013 +0200
+++ b/src/Tools/jEdit/src/theories_dockable.scala	Wed Sep 18 20:09:26 2013 +0200
@@ -12,7 +12,7 @@
 import scala.actors.Actor._
 import scala.swing.{Button, TextArea, Label, ListView, Alignment,
   ScrollPane, Component, CheckBox, BorderPanel}
-import scala.swing.event.{ButtonClicked, MouseClicked, MouseMoved}
+import scala.swing.event.{MouseClicked, MouseMoved}
 
 import java.lang.System
 import java.awt.{BorderLayout, Graphics2D, Color, Point, Dimension}
@@ -73,12 +73,7 @@
     session_phase.text = " " + phase_text(phase) + " "
   }
 
-  private val continuous_checking = new CheckBox("Continuous checking") {
-    tooltip = "Continuous checking of proof document (visible and required parts)"
-    reactions += { case ButtonClicked(_) => Isabelle.continuous_checking = selected }
-    def load() { selected = Isabelle.continuous_checking }
-    load()
-  }
+  private val continuous_checking = new Isabelle.Continuous_Checking
 
   private val logic = Isabelle_Logic.logic_selector(true)