src/Tools/jEdit/src/document_dockable.scala
changeset 77145 de618831ffd9
parent 77144 42c3970e1ac1
child 77146 eb114301c4df
equal deleted inserted replaced
77144:42c3970e1ac1 77145:de618831ffd9
   148   }
   148   }
   149 
   149 
   150   private def finish_process(output: XML.Body): Unit =
   150   private def finish_process(output: XML.Body): Unit =
   151     current_state.change(_.finish(output))
   151     current_state.change(_.finish(output))
   152 
   152 
   153   private def run_process(only_running: Boolean = false)(body: Log_Progress => Unit): Boolean = {
   153   private def run_process(body: Log_Progress => Unit): Boolean = {
   154     val started =
   154     val started =
   155       current_state.change_result { st =>
   155       current_state.change_result { st =>
   156         if (st.process.is_finished) {
   156         if (st.process.is_finished) {
   157           st.progress.stop()
   157           st.progress.stop()
   158           val progress = new Log_Progress
   158           val progress = new Log_Progress
   169     started
   169     started
   170   }
   170   }
   171 
   171 
   172   private def load_document(session: String): Boolean = {
   172   private def load_document(session: String): Boolean = {
   173     val options = PIDE.options.value
   173     val options = PIDE.options.value
   174     run_process() { _ =>
   174     run_process { _ =>
   175       try {
   175       try {
   176         val session_background =
   176         val session_background =
   177           Document_Build.session_background(
   177           Document_Build.session_background(
   178             options, session, dirs = JEdit_Sessions.session_dirs)
   178             options, session, dirs = JEdit_Sessions.session_dirs)
   179         PIDE.editor.document_setup(Some(session_background))
   179         PIDE.editor.document_setup(Some(session_background))
   223   private def document_build_attempt(): Boolean = {
   223   private def document_build_attempt(): Boolean = {
   224     val document_session = PIDE.editor.document_session()
   224     val document_session = PIDE.editor.document_session()
   225     if (document_session.is_vacuous) true
   225     if (document_session.is_vacuous) true
   226     else if (document_session.is_pending) false
   226     else if (document_session.is_pending) false
   227     else {
   227     else {
   228       run_process(only_running = true) { progress =>
   228       run_process { progress =>
   229         show_page(output_page)
   229         show_page(output_page)
   230         val result = Exn.capture { document_build(document_session, progress) }
   230         val result = Exn.capture { document_build(document_session, progress) }
   231         val msgs =
   231         val msgs =
   232           result match {
   232           result match {
   233             case Exn.Res(_) =>
   233             case Exn.Res(_) =>