overridedef output(msgs: Progress.Output): Unit = { super.output(msgs); delay.invoke() } overridedef stop_program(): Unit = { super.stop_program(); delay.invoke() }
}
/* document build process */
privatedef init_state(): Unit =
current_state.change { st =>
st.progress.stop()
Document_Dockable.State(progress = new Log_Progress)
}
privatedef cancel_process(): Unit =
current_state.change { st => st.process.cancel(); st }
privatedef await_process(): Unit =
current_state.guarded_access(st => if (st.process.is_finished) None else Some((), st))
privatedef output_process(progress: Log_Progress): Unit = { val (results, main) = progress.output()
current_state.change(_.output(results, main))
}
privatedef pending_process(): Unit =
current_state.change { st => if (st.pending) st else {
delay_auto_build.revoke()
delay_build.invoke()
st.copy(pending = true)
}
}
privatedef finish_process(output: List[XML.Elem]): Unit =
current_state.change { st => if (st.pending) {
delay_auto_build.revoke()
delay_build.invoke()
}
st.finish(output)
}
privatedef run_process(reset_pending: Boolean = false)(body: Log_Progress => Unit): Boolean = { val started =
current_state.change_result { st => if (st.process.is_finished) {
st.progress.stop() val progress = new Log_Progress val process =
Future.thread[Unit](name = "Document_Dockable.process") {
await_process()
body(progress)
}
(true, st.run(process, progress, reset_pending))
} else (false, st)
}
show_state()
started
}
val result = Exn.capture { val snapshot = document_session.get_snapshot
using(PIDE.session.open_session_context(document_snapshot = Some(snapshot)))(
Document_Editor.build(_, document_session, progress))
} val msgs =
result match { case Exn.Res(_) =>
List(Protocol.writeln_message("DONE")) case Exn.Exn(exn: Document_Build.Build_Error) =>
exn.log_errors.map(s => Protocol.error_message(YXML.parse_body(YXML.Source(s)))) case Exn.Exn(exn) =>
List(Protocol.error_message(YXML.parse_body(YXML.Source(Exn.print(exn)))))
}
overridedef focusOnDefaultComponent(): Unit = build_button.requestFocus()
/* message pane with pages */
privateval all_button = new GUI.Button("All") {
tooltip = "Select all document theories" overridedef clicked(): Unit = PIDE.editor.document_select_all(set = true)
}
privateval none_button = new GUI.Button("None") {
tooltip = "Deselect all document theories" overridedef clicked(): Unit = PIDE.editor.document_select_all(set = false)
}
privateval purge_button = new GUI.Button("Purge") {
tooltip = "Remove theories that are no longer required" overridedef clicked(): Unit = PIDE.editor.purge()
}
privateval theories = new Theories_Status(view, document = true) privateval theories_pane = new ScrollPane(theories.gui)
privatedef refresh_theories(): Unit = { val domain = PIDE.editor.document_theories().toSet
theories.update(domain = Some(domain), trim = true, force = true)
theories.refresh()
}
privateval input_page = new TabbedPane.Page("Input", new BorderPanel {
layout(input_controls) = BorderPanel.Position.North
layout(theories_pane) = BorderPanel.Position.Center
}, "Selection and status of document theories")
privateval cancel_button = new GUI.Button("Cancel") {
tooltip = "Cancel build process" overridedef clicked(): Unit = cancel_process()
}
privateval main =
Session.Consumer[Any](getClass.getName) { case _: Session.Global_Options =>
GUI_Thread.later {
document_session.load()
output.handle_resize()
refresh_theories()
} case changed: Session.Commands_Changed =>
GUI_Thread.later { val domain = PIDE.editor.document_theories().filter(changed.nodes).toSet if (domain.nonEmpty) {
theories.update(domain = Some(domain))
val pending = document_pending() val auto = document_auto() if ((pending || auto) && PIDE.editor.document_session().is_ready) { if (pending) {
delay_auto_build.revoke()
delay_build.invoke()
} elseif (auto) {
delay_auto_build.invoke()
}
}
}
}
}
overridedef init(): Unit = {
PIDE.editor.document_init(dockable)
init_state()
PIDE.session.global_options += main
PIDE.session.commands_changed += main
output.init()
delay_load.invoke()
}
overridedef exit(): Unit = {
PIDE.session.global_options -= main
PIDE.session.commands_changed -= main
output.exit()
PIDE.editor.document_exit(dockable)
}
}
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.