136 |
136 |
137 // process ready (after initialization) |
137 // process ready (after initialization) |
138 case XML.Elem(Markup.READY, _, _) |
138 case XML.Elem(Markup.READY, _, _) |
139 if !initialized => |
139 if !initialized => |
140 initialized = true |
140 initialized = true |
141 Swing.now { this ! ProverEvents.Activate } |
141 Swing_Thread.now { this ! ProverEvents.Activate } |
142 |
142 |
143 // document edits |
143 // document edits |
144 case XML.Elem(Markup.EDITS, (Markup.ID, doc_id) :: _, edits) |
144 case XML.Elem(Markup.EDITS, (Markup.ID, doc_id) :: _, edits) |
145 if document_versions.exists(_.id == doc_id) => |
145 if document_versions.exists(_.id == doc_id) => |
146 output_info.event(result.toString) |
146 output_info.event(result.toString) |
260 this.change_receiver = change_receiver |
260 this.change_receiver = change_receiver |
261 this ! ProverEvents.SetIsCommandKeyword(command_decls.contains) |
261 this ! ProverEvents.SetIsCommandKeyword(command_decls.contains) |
262 process.begin_document(document_id0, path) |
262 process.begin_document(document_id0, path) |
263 } |
263 } |
264 |
264 |
265 private def edit_document(old_id: String, document_id: String, changes: StructureChange) = Swing.now |
265 private def edit_document(old_id: String, document_id: String, changes: StructureChange) = |
266 { |
266 Swing_Thread.now { |
267 val removes = |
267 val removes = |
268 for (cmd <- changes.removed_commands) yield { |
268 for (cmd <- changes.removed_commands) yield { |
269 commands -= cmd.id |
269 commands -= cmd.id |
270 if (cmd.state_id != null) states -= cmd.state_id |
270 if (cmd.state_id != null) states -= cmd.state_id |
271 changes.before_change.map(_.id).getOrElse(document_id0) -> None |
271 changes.before_change.map(_.id).getOrElse(document_id0) -> None |
272 } |
272 } |
273 val inserts = |
273 val inserts = |
274 for (cmd <- changes.added_commands) yield { |
274 for (cmd <- changes.added_commands) yield { |
275 commands += (cmd.id -> cmd) |
275 commands += (cmd.id -> cmd) |
276 process.define_command(cmd.id, isabelle_system.symbols.encode(cmd.content)) |
276 process.define_command(cmd.id, isabelle_system.symbols.encode(cmd.content)) |
277 (document.commands.prev(cmd).map(_.id).getOrElse(document_id0)) -> Some(cmd.id) |
277 (document.commands.prev(cmd).map(_.id).getOrElse(document_id0)) -> Some(cmd.id) |
278 } |
278 } |
279 process.edit_document(old_id, document_id, removes.reverse ++ inserts) |
279 process.edit_document(old_id, document_id, removes.reverse ++ inserts) |
280 } |
280 } |
281 } |
281 } |