author | wenzelm |
Sat, 22 May 2010 20:59:55 +0200 | |
changeset 37065 | 2a73253b5898 |
parent 36987 | 8af34e160968 |
child 37067 | 31093f3687b5 |
permissions | -rw-r--r-- |
36760 | 1 |
/* Title: Tools/jEdit/src/jedit/protocol_dockable.scala |
2 |
Author: Makarius |
|
3 |
||
37065
2a73253b5898
separate event bus and dockable for raw output (stdout);
wenzelm
parents:
36987
diff
changeset
|
4 |
Dockable window for raw 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._ |
13 |
||
14 |
import java.awt.{Dimension, Graphics, BorderLayout} |
|
34424 | 15 |
import javax.swing.{JPanel, JTextArea, JScrollPane} |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
16 |
|
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
17 |
import org.gjt.sp.jedit.View |
34424 | 18 |
import org.gjt.sp.jedit.gui.DockableWindowManager |
19 |
||
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
20 |
|
34791 | 21 |
class Protocol_Dockable(view: View, position: String) extends JPanel(new BorderLayout) |
34760 | 22 |
{ |
34424 | 23 |
if (position == DockableWindowManager.FLOATING) |
24 |
setPreferredSize(new Dimension(500, 250)) |
|
25 |
||
34772 | 26 |
private val text_area = new JTextArea |
27 |
add(new JScrollPane(text_area), BorderLayout.CENTER) |
|
28 |
||
29 |
||
30 |
/* actor wiring */ |
|
34671 | 31 |
|
37065
2a73253b5898
separate event bus and dockable for raw output (stdout);
wenzelm
parents:
36987
diff
changeset
|
32 |
private val protocol_actor = actor { |
34772 | 33 |
loop { |
34 |
react { |
|
35 |
case result: Isabelle_Process.Result => |
|
36987 | 36 |
Swing_Thread.now { text_area.append(result.message.toString + "\n") } |
34772 | 37 |
|
37065
2a73253b5898
separate event bus and dockable for raw output (stdout);
wenzelm
parents:
36987
diff
changeset
|
38 |
case bad => System.err.println("protocol_actor: ignoring bad message " + bad) |
34772 | 39 |
} |
40 |
} |
|
41 |
} |
|
42 |
||
43 |
override def addNotify() |
|
44 |
{ |
|
45 |
super.addNotify() |
|
37065
2a73253b5898
separate event bus and dockable for raw output (stdout);
wenzelm
parents:
36987
diff
changeset
|
46 |
Isabelle.session.raw_results += protocol_actor |
34772 | 47 |
} |
48 |
||
49 |
override def removeNotify() |
|
50 |
{ |
|
37065
2a73253b5898
separate event bus and dockable for raw output (stdout);
wenzelm
parents:
36987
diff
changeset
|
51 |
Isabelle.session.raw_results -= protocol_actor |
34772 | 52 |
super.removeNotify() |
34671 | 53 |
} |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
54 |
} |