author | wenzelm |
Thu, 20 Feb 2014 14:36:17 +0100 | |
changeset 55618 | 995162143ef4 |
parent 50205 | 788c8263e634 |
child 56385 | 76acce58aeab |
permissions | -rw-r--r-- |
43282
5d294220ca43
moved sources -- eliminated Netbeans artifact of jedit package directory;
wenzelm
parents:
39588
diff
changeset
|
1 |
/* Title: Tools/jEdit/src/protocol_dockable.scala |
36760 | 2 |
Author: Makarius |
3 |
||
37067 | 4 |
Dockable window for protocol messages. |
36760 | 5 |
*/ |
34408 | 6 |
|
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
7 |
package isabelle.jedit |
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
8 |
|
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
9 |
|
36015 | 10 |
import isabelle._ |
11 |
||
34772 | 12 |
import scala.actors.Actor._ |
37067 | 13 |
import scala.swing.{TextArea, ScrollPane} |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
14 |
|
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
15 |
import org.gjt.sp.jedit.View |
34424 | 16 |
|
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
17 |
|
37067 | 18 |
class Protocol_Dockable(view: View, position: String) extends Dockable(view, position) |
34760 | 19 |
{ |
37067 | 20 |
private val text_area = new TextArea |
21 |
set_content(new ScrollPane(text_area)) |
|
34772 | 22 |
|
23 |
||
37067 | 24 |
/* main actor */ |
34671 | 25 |
|
37067 | 26 |
private val main_actor = actor { |
34772 | 27 |
loop { |
28 |
react { |
|
43721
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43520
diff
changeset
|
29 |
case input: Isabelle_Process.Input => |
46918
1752164d916b
prefer asynchronous context switch from actor to swing thread, to reduce danger of deadlocks;
wenzelm
parents:
46774
diff
changeset
|
30 |
Swing_Thread.later { text_area.append(input.toString + "\n") } |
43721
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43520
diff
changeset
|
31 |
|
46772
be21f050eda4
tuned signature -- emphasize Isabelle_Process Input vs. Output;
wenzelm
parents:
46120
diff
changeset
|
32 |
case output: Isabelle_Process.Output => |
46918
1752164d916b
prefer asynchronous context switch from actor to swing thread, to reduce danger of deadlocks;
wenzelm
parents:
46774
diff
changeset
|
33 |
Swing_Thread.later { text_area.append(output.message.toString + "\n") } |
34772 | 34 |
|
37067 | 35 |
case bad => System.err.println("Protocol_Dockable: ignoring bad message " + bad) |
34772 | 36 |
} |
37 |
} |
|
38 |
} |
|
39 |
||
50205 | 40 |
override def init() { PIDE.session.all_messages += main_actor } |
41 |
override def exit() { PIDE.session.all_messages -= main_actor } |
|
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
42 |
} |