src/Tools/jEdit/src/prover/Prover.scala
changeset 34729 5bf8f8200762
parent 34728 e3df9c8699ea
child 34730 819862460a12
equal deleted inserted replaced
34728:e3df9c8699ea 34729:5bf8f8200762
   139   }
   139   }
   140 
   140 
   141 
   141 
   142   /* document changes */
   142   /* document changes */
   143 
   143 
   144   def handle_change(change: Change) {
   144   def begin_document(path: String) {
   145     val old = document(change.parent.get.id).get
       
   146     val (doc, structure_change) = old.text_changed(change)
       
   147     document_versions ::= doc
       
   148     edit_document(old, doc, structure_change)
       
   149     document_change.event(doc)
       
   150   }
       
   151 
       
   152   def set_document(path: String) {
       
   153     process.begin_document(document_0.id, path)
   145     process.begin_document(document_0.id, path)
   154   }
   146   }
   155 
   147 
   156   private def edit_document(old: ProofDocument, doc: ProofDocument,
   148   def handle_change(change: Change) {
   157     changes: ProofDocument.StructureChange) =
   149     val old = document(change.parent.get.id).get
   158   {
   150     val (doc, changes) = old.text_changed(change)
       
   151     document_versions ::= doc
       
   152 
   159     val id_changes = changes map { case (c1, c2) =>
   153     val id_changes = changes map { case (c1, c2) =>
   160       (c1.map(_.id).getOrElse(document_0.id),
   154       (c1.map(_.id).getOrElse(document_0.id),
   161       c2 match {
   155       c2 match {
   162         case None => None
   156         case None => None
   163         case Some(command) =>
   157         case Some(command) =>
   165           process.define_command(command.id, system.symbols.encode(command.content))
   159           process.define_command(command.id, system.symbols.encode(command.content))
   166           Some(command.id)
   160           Some(command.id)
   167       })
   161       })
   168     }
   162     }
   169     process.edit_document(old.id, doc.id, id_changes)
   163     process.edit_document(old.id, doc.id, id_changes)
       
   164 
       
   165     document_change.event(doc)
   170   }
   166   }
   171 }
   167 }