src/Tools/jEdit/src/protocol_dockable.scala
author wenzelm
Wed Jun 08 17:42:07 2011 +0200 (2011-06-08)
changeset 43282 5d294220ca43
parent 39588 src/Tools/jEdit/src/jedit/protocol_dockable.scala@507fcf86e1e0
child 43520 cec9b95fa35d
permissions -rw-r--r--
moved sources -- eliminated Netbeans artifact of jedit package directory;
wenzelm@43282
     1
/*  Title:      Tools/jEdit/src/protocol_dockable.scala
wenzelm@36760
     2
    Author:     Makarius
wenzelm@36760
     3
wenzelm@37067
     4
Dockable window for protocol messages.
wenzelm@36760
     5
*/
wenzelm@34408
     6
wenzelm@34318
     7
package isabelle.jedit
wenzelm@34318
     8
wenzelm@34318
     9
wenzelm@36015
    10
import isabelle._
wenzelm@36015
    11
wenzelm@34772
    12
import scala.actors.Actor._
wenzelm@37067
    13
import scala.swing.{TextArea, ScrollPane}
wenzelm@34318
    14
wenzelm@34318
    15
import org.gjt.sp.jedit.View
wenzelm@34424
    16
wenzelm@34318
    17
wenzelm@37067
    18
class Protocol_Dockable(view: View, position: String) extends Dockable(view, position)
wenzelm@34760
    19
{
wenzelm@37067
    20
  private val text_area = new TextArea
wenzelm@37067
    21
  set_content(new ScrollPane(text_area))
wenzelm@34772
    22
wenzelm@34772
    23
wenzelm@37067
    24
  /* main actor */
immler@34671
    25
wenzelm@37067
    26
  private val main_actor = actor {
wenzelm@34772
    27
    loop {
wenzelm@34772
    28
      react {
wenzelm@34772
    29
        case result: Isabelle_Process.Result =>
wenzelm@36987
    30
          Swing_Thread.now { text_area.append(result.message.toString + "\n") }
wenzelm@34772
    31
wenzelm@37067
    32
        case bad => System.err.println("Protocol_Dockable: ignoring bad message " + bad)
wenzelm@34772
    33
      }
wenzelm@34772
    34
    }
wenzelm@34772
    35
  }
wenzelm@34772
    36
wenzelm@39588
    37
  override def init() { Isabelle.session.raw_messages += main_actor }
wenzelm@39588
    38
  override def exit() { Isabelle.session.raw_messages -= main_actor }
wenzelm@34318
    39
}