src/Tools/jEdit/src/document_dockable.scala
changeset 76035 97060c904a08
parent 76034 dda3c117f13c
child 76036 181bf8567f41
equal deleted inserted replaced
76034:dda3c117f13c 76035:97060c904a08
   120 
   120 
   121   /* document build process */
   121   /* document build process */
   122 
   122 
   123   private def cancel(): Unit =
   123   private def cancel(): Unit =
   124     current_state.change { st => st.process.cancel(); st }
   124     current_state.change { st => st.process.cancel(); st }
   125 
       
   126   private def finish(result: Document_Dockable.Result): Unit = {
       
   127     current_state.change { _ => Document_Dockable.State.finish(result) }
       
   128     show_state()
       
   129     show_page(output_page)
       
   130   }
       
   131 
   125 
   132   private def build_document(): Unit = {
   126   private def build_document(): Unit = {
   133     current_state.change { st =>
   127     current_state.change { st =>
   134       if (st.process.is_finished) {
   128       if (st.process.is_finished) {
   135         val progress = init_progress()
   129         val progress = init_progress()
   146               res match {
   140               res match {
   147                 case Exn.Res(_) => Protocol.make_message(XML.string("OK"))
   141                 case Exn.Res(_) => Protocol.make_message(XML.string("OK"))
   148                 case Exn.Exn(exn) => Protocol.error_message(XML.string(Exn.message(exn)))
   142                 case Exn.Exn(exn) => Protocol.error_message(XML.string(Exn.message(exn)))
   149               }
   143               }
   150             val result = Document_Dockable.Result(output = List(msg))
   144             val result = Document_Dockable.Result(output = List(msg))
   151             finish(result)
   145             current_state.change(_ => Document_Dockable.State.finish(result))
       
   146             show_state()
       
   147             show_page(output_page)
   152           }
   148           }
   153         st.copy(progress = progress, process = process, status = Document_Dockable.Status.RUNNING)
   149         st.copy(progress = progress, process = process, status = Document_Dockable.Status.RUNNING)
   154       }
   150       }
   155       else st
   151       else st
   156     }
   152     }