tuned handling of accumulated results;
authorwenzelm
Tue, 20 Jan 2009 13:56:55 +0100
changeset 34486 7985efd78aa1
parent 34485 6475bfb4ff99
child 34487 b88ee385308d
tuned handling of accumulated results;
src/Tools/jEdit/src/jedit/ProverSetup.scala
src/Tools/jEdit/src/prover/Command.scala
--- a/src/Tools/jEdit/src/jedit/ProverSetup.scala	Mon Jan 19 23:29:44 2009 +0100
+++ b/src/Tools/jEdit/src/jedit/ProverSetup.scala	Tue Jan 20 13:56:55 2009 +0100
@@ -69,7 +69,7 @@
         if (state == null)
           state_panel.setDocument(null: Document)
         else
-          state_panel.setDocument(state.results_xml, UserAgent.baseURL)
+          state_panel.setDocument(state.result_document, UserAgent.baseURL)
       }
     })
   
--- a/src/Tools/jEdit/src/prover/Command.scala	Mon Jan 19 23:29:44 2009 +0100
+++ b/src/Tools/jEdit/src/prover/Command.scala	Tue Jan 20 13:56:55 2009 +0100
@@ -11,6 +11,8 @@
 import javax.swing.text.Position
 import javax.swing.tree.DefaultMutableTreeNode
 
+import scala.collection.mutable.ListBuffer
+
 import isabelle.proofdocument.{Token, ProofDocument}
 import isabelle.jedit.{Isabelle, Plugin}
 import isabelle.XML
@@ -59,17 +61,15 @@
 
   /* accumulated results */
 
-  var results: List[XML.Tree] = Nil
+  private val results = new ListBuffer[XML.Tree]
+  def add_result(tree: XML.Tree) { results += tree }
 
-  def results_xml = XML.document(
-    results match {
+  def result_document = XML.document(
+    results.toList match {
       case Nil => XML.Elem("message", Nil, Nil)
       case List(elem) => elem
-      case _ => XML.Elem("messages", Nil, List(results.first, results.last))
+      case elems => XML.Elem("messages", Nil, List(elems.first, elems.last))  // FIXME all elems!?
     }, "style")
-  def add_result(tree: XML.Tree) {
-    results = results ::: List(tree)    // FIXME canonical reverse order
-  }
 
 
   /* content */