renamed object Plugin to Isabelle;
authorwenzelm
Sat, 27 Dec 2008 14:13:05 +0100
changeset 34440 561a6d19bd95
parent 34439 7df6275c4b3f
child 34441 ff3b7ae2b12a
renamed object Plugin to Isabelle; renamed Plugin.self to Isabelle.plugin; renamed Isabelle.plugin.symbols to Isabelle.symbols;
src/Tools/jEdit/plugin/actions.xml
src/Tools/jEdit/src/jedit/IsabelleSideKickParser.scala
src/Tools/jEdit/src/jedit/OptionPane.scala
src/Tools/jEdit/src/jedit/Plugin.scala
src/Tools/jEdit/src/jedit/ProverSetup.scala
src/Tools/jEdit/src/jedit/ScrollerDockable.scala
src/Tools/jEdit/src/jedit/SelectionActions.scala
src/Tools/jEdit/src/jedit/StateViewDockable.scala
src/Tools/jEdit/src/jedit/TheoryView.scala
src/Tools/jEdit/src/jedit/VFS.scala
--- a/src/Tools/jEdit/plugin/actions.xml	Sat Dec 27 12:29:15 2008 +0100
+++ b/src/Tools/jEdit/plugin/actions.xml	Sat Dec 27 14:13:05 2008 +0100
@@ -16,10 +16,10 @@
 	</ACTION>
 	<ACTION NAME="isabelle.activate">
 		<CODE>
-			isabelle.jedit.Plugin$.MODULE$.self().install(view);
+			isabelle.jedit.Isabelle.plugin().install(view);
 		</CODE>
 		<IS_SELECTED>
-			return isabelle.jedit.Plugin$.MODULE$.self().is_active(view.getBuffer());
+			return isabelle.jedit.Isabelle.plugin().is_active(view.getBuffer());
 		</IS_SELECTED>
 	</ACTION>
 </ACTIONS>
\ No newline at end of file
--- a/src/Tools/jEdit/src/jedit/IsabelleSideKickParser.scala	Sat Dec 27 12:29:15 2008 +0100
+++ b/src/Tools/jEdit/src/jedit/IsabelleSideKickParser.scala	Sat Dec 27 14:13:05 2008 +0100
@@ -27,7 +27,7 @@
     
     val data = new SideKickParsedData(buffer.getName)
     
-    Plugin.self.prover_setup(buffer) match {
+    Isabelle.plugin.prover_setup(buffer) match {
       case None =>
         data.root.add(new DefaultMutableTreeNode("<buffer inactive>"))
       case Some(prover_setup) =>
--- a/src/Tools/jEdit/src/jedit/OptionPane.scala	Sat Dec 27 12:29:15 2008 +0100
+++ b/src/Tools/jEdit/src/jedit/OptionPane.scala	Sat Dec 27 14:13:05 2008 +0100
@@ -20,7 +20,7 @@
 import org.gjt.sp.jedit.AbstractOptionPane
 
 class OptionPane extends AbstractOptionPane("isabelle") {
-  import Plugin.property
+  import Isabelle.property
   
   var pathName = new JTextField()
   var fontSize = new JSpinner()
@@ -77,7 +77,7 @@
       property("font-size", size.toString)
       SwingUtilities invokeLater new Runnable() {
         override def run() = 
-          Plugin.self.set_font(name, size.asInstanceOf[Integer].intValue)
+          Isabelle.plugin.set_font(name, size.asInstanceOf[Integer].intValue)
       }
     }
     
--- a/src/Tools/jEdit/src/jedit/Plugin.scala	Sat Dec 27 12:29:15 2008 +0100
+++ b/src/Tools/jEdit/src/jedit/Plugin.scala	Sat Dec 27 14:13:05 2008 +0100
@@ -24,7 +24,7 @@
 import org.gjt.sp.jedit.msg.{EditPaneUpdate, PropertiesChanged}
 
 
-object Plugin {
+object Isabelle {
   // name
   val NAME = "Isabelle"
   val OPTION_PREFIX = "options.isabelle."
@@ -35,21 +35,22 @@
   def property(name: String, value: String) = 
     jEdit.setProperty(OPTION_PREFIX + name, value)
 
-  // dynamic instance
-  var self: Plugin = null
+
+  // Isabelle symbols
+  var symbols: Symbol.Interpretation = null
+
+
+  // plugin instance
+  var plugin: Plugin = null
 
   // provers
-  def prover(buffer: JEditBuffer) = self.prover_setup(buffer).get.prover
-  def prover_setup(buffer: JEditBuffer) = self.prover_setup(buffer).get
+  def prover(buffer: JEditBuffer) = plugin.prover_setup(buffer).get.prover
+  def prover_setup(buffer: JEditBuffer) = plugin.prover_setup(buffer).get
 }
 
 
 class Plugin extends EBPlugin {
 
-  // Isabelle symbols
-  val symbols = new Symbol.Interpretation
-
-
   // Isabelle font
 
   var font: Font = null
@@ -129,11 +130,12 @@
   }
 
   override def start() {
-    Plugin.self = this
+    Isabelle.symbols = new Symbol.Interpretation
+    Isabelle.plugin = this
     
-    if (Plugin.property("font-path") != null && Plugin.property("font-size") != null)
+    if (Isabelle.property("font-path") != null && Isabelle.property("font-size") != null)
       try {
-        set_font(Plugin.property("font-path"), Plugin.property("font-size").toFloat)
+        set_font(Isabelle.property("font-path"), Isabelle.property("font-size").toFloat)
       }
       catch {
         case e: NumberFormatException =>
@@ -142,6 +144,7 @@
   
   override def stop() {
     // TODO: proper cleanup
-    Plugin.self = null
+    Isabelle.plugin = null
+    Isabelle.symbols = null
   }
 }
--- a/src/Tools/jEdit/src/jedit/ProverSetup.scala	Sat Dec 27 12:29:15 2008 +0100
+++ b/src/Tools/jEdit/src/jedit/ProverSetup.scala	Sat Dec 27 14:13:05 2008 +0100
@@ -40,14 +40,14 @@
   val output_text_view = new JTextArea("== Isabelle output ==\n")
   
   def activate(view : View) {
-    val logic = Plugin.property("logic")
-    prover.start(if (logic == null) logic else "HOL")
+    val logic = Isabelle.property("logic")
+    prover.start(if (logic == null) logic else "HOL")  // FIXME avoid hardwired logic
     val buffer = view.getBuffer
     val dir = buffer.getDirectory()
 
     theory_view = new TheoryView(view.getTextArea)
     prover.setDocument(theory_view ,
-                       if (dir.startsWith(Plugin.VFS_PREFIX)) dir.substring(Plugin.VFS_PREFIX.length) else dir)
+                       if (dir.startsWith(Isabelle.VFS_PREFIX)) dir.substring(Isabelle.VFS_PREFIX.length) else dir)
     theory_view.activate
     prover.outputInfo.add( text => {
         output_text_view.append(text)
@@ -78,7 +78,7 @@
     //register for theory-view
 
     // could also use this:
-    // prover.commandInfo.add(c => Plugin.theory_view.repaint(c.command))
+    // prover.commandInfo.add(c => Isabelle.theory_view.repaint(c.command))
 
   }
 
--- a/src/Tools/jEdit/src/jedit/ScrollerDockable.scala	Sat Dec 27 12:29:15 2008 +0100
+++ b/src/Tools/jEdit/src/jedit/ScrollerDockable.scala	Sat Dec 27 14:13:05 2008 +0100
@@ -175,7 +175,7 @@
 
   
   // TODO: register
-  //Plugin.self.prover.allInfo.add(add_result(_))
+  //Isabelle.plugin.prover.allInfo.add(add_result(_))
 }
 
 //Concrete Implementations
@@ -222,15 +222,15 @@
     val panel = new XHTMLPanel(new UserAgent())
     val fontResolver =
       panel.getSharedContext.getFontResolver.asInstanceOf[AWTFontResolver]
-    if (Plugin.self.font != null)
-      fontResolver.setFontMapping("Isabelle", Plugin.self.font)
+    if (Isabelle.plugin.font != null)
+      fontResolver.setFontMapping("Isabelle", Isabelle.plugin.font)
 
-    Plugin.self.font_changed.add(font => {
-      if (Plugin.self.font != null)
-        fontResolver.setFontMapping("Isabelle", Plugin.self.font)
+    Isabelle.plugin.font_changed.add(font => {
+      if (Isabelle.plugin.font != null)
+        fontResolver.setFontMapping("Isabelle", Isabelle.plugin.font)
       panel.relayout()
     })
-    val tree = parse_failsafe(Plugin.self.symbols.decode(r.result))
+    val tree = parse_failsafe(Isabelle.symbols.decode(r.result))
     val document = XML.document(tree)
     panel.setDocument(document, UserAgent.baseURL)
     val sa = new SelectionActions
--- a/src/Tools/jEdit/src/jedit/SelectionActions.scala	Sat Dec 27 12:29:15 2008 +0100
+++ b/src/Tools/jEdit/src/jedit/SelectionActions.scala	Sat Dec 27 14:13:05 2008 +0100
@@ -25,7 +25,7 @@
 
   def copyaction {
       val selected_string = getSelectionRange.toString
-      val encoded = Plugin.self.symbols.encode(selected_string)
+      val encoded = Isabelle.symbols.encode(selected_string)
       val clipboard = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard;
       val transferable = new java.awt.datatransfer.StringSelection(selected_string)
       clipboard.setContents(transferable, null)
--- a/src/Tools/jEdit/src/jedit/StateViewDockable.scala	Sat Dec 27 12:29:15 2008 +0100
+++ b/src/Tools/jEdit/src/jedit/StateViewDockable.scala	Sat Dec 27 14:13:05 2008 +0100
@@ -64,12 +64,12 @@
 
   private val fontResolver =
     panel.getSharedContext.getFontResolver.asInstanceOf[AWTFontResolver]
-  if (Plugin.self.font != null)
-    fontResolver.setFontMapping("Isabelle", Plugin.self.font)
+  if (Isabelle.plugin.font != null)
+    fontResolver.setFontMapping("Isabelle", Isabelle.plugin.font)
 
-  Plugin.self.font_changed.add(font => {
-    if (Plugin.self.font != null)
-      fontResolver.setFontMapping("Isabelle", Plugin.self.font)
+  Isabelle.plugin.font_changed.add(font => {
+    if (Isabelle.plugin.font != null)
+      fontResolver.setFontMapping("Isabelle", Isabelle.plugin.font)
 
     panel.relayout()
   })
--- a/src/Tools/jEdit/src/jedit/TheoryView.scala	Sat Dec 27 12:29:15 2008 +0100
+++ b/src/Tools/jEdit/src/jedit/TheoryView.scala	Sat Dec 27 14:13:05 2008 +0100
@@ -81,11 +81,11 @@
   })
   
   val changesSource = new EventSource[Changed]
-  val phase_overview = new PhaseOverviewPanel(Plugin.prover(buffer))
+  val phase_overview = new PhaseOverviewPanel(Isabelle.prover(buffer))
 
     val repaint_delay = new isabelle.utils.Delay(100, () => repaintAll())
-    Plugin.prover(buffer).commandInfo.add(_ => repaint_delay.delay_or_ignore())
-    Plugin.self.font_changed.add(font => updateFont())
+    Isabelle.prover(buffer).commandInfo.add(_ => repaint_delay.delay_or_ignore())
+    Isabelle.plugin.font_changed.add(font => updateFont())
 
     colTimer.stop
     colTimer.setRepeats(true)
@@ -102,13 +102,13 @@
   private def updateFont() {
     if (text_area != null) {
       val painter = text_area.getPainter()
-      if (Plugin.self.font != null) {
+      if (Isabelle.plugin.font != null) {
         painter.setStyles(painter.getStyles.map(style =>
           new SyntaxStyle(style.getForegroundColor, 
                           style.getBackgroundColor, 
-                          Plugin.self.font)
+                          Isabelle.plugin.font)
         ))
-        painter.setFont(Plugin.self.font)
+        painter.setFont(Isabelle.plugin.font)
         repaintAll()
       }
     }
@@ -122,10 +122,10 @@
   
   val selectedStateController = new CaretListener() {
     override def caretUpdate(e : CaretEvent) {
-      val cmd = Plugin.prover(buffer).document.getNextCommandContaining(e.getDot())
+      val cmd = Isabelle.prover(buffer).document.getNextCommandContaining(e.getDot())
       if (cmd != null && cmd.start <= e.getDot() && 
-            Plugin.prover_setup(buffer).selectedState != cmd)
-        Plugin.prover_setup(buffer).selectedState = cmd
+            Isabelle.prover_setup(buffer).selectedState != cmd)
+        Isabelle.prover_setup(buffer).selectedState = cmd
     }
   }
 
@@ -149,8 +149,8 @@
       var stop = text_area.getLineOfOffset(toCurrent(cmd.stop) - 1)
       text_area.invalidateLineRange(start, stop)
       
-      if (Plugin.prover_setup(buffer).selectedState == cmd)
-        Plugin.prover_setup(buffer).selectedState = cmd // update State view
+      if (Isabelle.prover_setup(buffer).selectedState == cmd)
+        Isabelle.prover_setup(buffer).selectedState = cmd // update State view
     }
   }
   
@@ -181,7 +181,7 @@
   {	
     val fm = text_area.getPainter.getFontMetrics
     var savedColor = gfx.getColor
-    var e = Plugin.prover(buffer).document.getNextCommandContaining(fromCurrent(start))
+    var e = Isabelle.prover(buffer).document.getNextCommandContaining(fromCurrent(start))
 
     //Encolor Phase
     while (e != null && toCurrent(e.start) < end) {
--- a/src/Tools/jEdit/src/jedit/VFS.scala	Sat Dec 27 12:29:15 2008 +0100
+++ b/src/Tools/jEdit/src/jedit/VFS.scala	Sat Dec 27 14:13:05 2008 +0100
@@ -38,13 +38,13 @@
         buffer.append(array, 0, length)
     }
 
-    val str = Plugin.self.symbols.decode(buffer.toString)
+    val str = Isabelle.symbols.decode(buffer.toString)
     new ByteArrayInputStream(str.getBytes(IsabelleSystem.charset))
   }
   
   class OutputConverter(out: OutputStream) extends ByteArrayOutputStream {
     override def close() {
-      out.write(Plugin.self.symbols.encode(new String(buf, 0, count)).getBytes)
+      out.write(Isabelle.symbols.encode(new String(buf, 0, count)).getBytes)
       out.close()
     }
   }
@@ -74,7 +74,7 @@
       base.getName()
 
     override def getPath() =
-      Plugin.VFS_PREFIX + base.getPath()
+      Isabelle.VFS_PREFIX + base.getPath()
 
     override def getSymlinkPath() =
       base.getSymlinkPath()
@@ -131,7 +131,7 @@
   private var baseVFS = VFSManager.getVFSForProtocol("file")
 
   private def cutPath(path: String) = 
-    if (path.startsWith(Plugin.VFS_PREFIX)) path.substring(Plugin.VFS_PREFIX.length)
+    if (path.startsWith(Isabelle.VFS_PREFIX)) path.substring(Isabelle.VFS_PREFIX.length)
     else path
   
   override def createVFSSession(path: String, comp: Component) = 
@@ -144,10 +144,10 @@
     baseVFS.getExtendedAttributes()
   
   override def getParentOfPath(path: String) = 
-    Plugin.VFS_PREFIX + baseVFS.getParentOfPath(cutPath(path))
+    Isabelle.VFS_PREFIX + baseVFS.getParentOfPath(cutPath(path))
   
   override def constructPath(parent: String, path: String) = 
-    Plugin.VFS_PREFIX + baseVFS.constructPath(cutPath(parent), path)
+    Isabelle.VFS_PREFIX + baseVFS.constructPath(cutPath(parent), path)
   
   override def getFileName(path: String) = 
     baseVFS.getFileName(path)
@@ -156,10 +156,10 @@
     baseVFS.getFileSeparator()
   
   override def getTwoStageSaveName(path: String) = 
-    Plugin.VFS_PREFIX + baseVFS.getTwoStageSaveName(cutPath(path))
+    Isabelle.VFS_PREFIX + baseVFS.getTwoStageSaveName(cutPath(path))
   
   override def _canonPath(session: Object, path: String, comp: Component) =
-    Plugin.VFS_PREFIX + baseVFS._canonPath(session, cutPath(path), comp)
+    Isabelle.VFS_PREFIX + baseVFS._canonPath(session, cutPath(path), comp)
   
   override def _createInputStream(session: Object, path: String,
       ignoreErrors: Boolean, comp: Component) =