equal
deleted
inserted
replaced
|
1 /* |
|
2 * Dockable window for raw process output |
|
3 * |
|
4 * @author Makarius |
|
5 */ |
|
6 |
|
7 package isabelle.jedit |
|
8 |
|
9 |
|
10 import scala.actors.Actor._ |
|
11 |
|
12 import java.awt.{Dimension, Graphics, BorderLayout} |
|
13 import javax.swing.{JPanel, JTextArea, JScrollPane} |
|
14 |
|
15 import org.gjt.sp.jedit.View |
|
16 import org.gjt.sp.jedit.gui.DockableWindowManager |
|
17 |
|
18 |
|
19 class Protocol_Dockable(view: View, position: String) extends JPanel |
|
20 { |
|
21 // outer panel |
|
22 |
|
23 if (position == DockableWindowManager.FLOATING) |
|
24 setPreferredSize(new Dimension(500, 250)) |
|
25 |
|
26 setLayout(new BorderLayout) |
|
27 |
|
28 |
|
29 // text area |
|
30 |
|
31 private val text_area = new JTextArea |
|
32 add(new JScrollPane(text_area), BorderLayout.CENTER) |
|
33 |
|
34 |
|
35 /* actor wiring */ |
|
36 |
|
37 private val raw_actor = actor { |
|
38 loop { |
|
39 react { |
|
40 case result: Isabelle_Process.Result => |
|
41 Swing_Thread.now { text_area.append(result.toString + "\n") } |
|
42 |
|
43 case bad => System.err.println("raw_actor: ignoring bad message " + bad) |
|
44 } |
|
45 } |
|
46 } |
|
47 |
|
48 override def addNotify() |
|
49 { |
|
50 super.addNotify() |
|
51 Isabelle.plugin.raw_results += raw_actor |
|
52 } |
|
53 |
|
54 override def removeNotify() |
|
55 { |
|
56 Isabelle.plugin.raw_results -= raw_actor |
|
57 super.removeNotify() |
|
58 } |
|
59 } |