author | wenzelm |
Sat, 21 Nov 2015 14:09:08 +0100 | |
changeset 61716 | 08236d919586 |
parent 61326 | 3ad2b2055ffc |
child 62052 | 8bcbf1c93119 |
permissions | -rw-r--r-- |
50299 | 1 |
/* Title: Tools/jEdit/src/theories_dockable.scala |
39515 | 2 |
Author: Makarius |
3 |
||
50299 | 4 |
Dockable window for theories managed by prover. |
39515 | 5 |
*/ |
6 |
||
7 |
package isabelle.jedit |
|
8 |
||
9 |
||
10 |
import isabelle._ |
|
11 |
||
53711
8ce7795256e1
improved FlowLayout for wrapping of components over multiple lines;
wenzelm
parents:
53178
diff
changeset
|
12 |
import scala.swing.{Button, TextArea, Label, ListView, Alignment, |
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
13 |
ScrollPane, Component, CheckBox, BorderPanel} |
53715 | 14 |
import scala.swing.event.{MouseClicked, MouseMoved} |
39593 | 15 |
|
53178 | 16 |
import java.awt.{BorderLayout, Graphics2D, Color, Point, Dimension} |
56389 | 17 |
import javax.swing.{JList, BorderFactory, UIManager} |
18 |
import javax.swing.border.{BevelBorder, SoftBevelBorder} |
|
39515 | 19 |
|
44865 | 20 |
import org.gjt.sp.jedit.{View, jEdit} |
39515 | 21 |
|
22 |
||
50299 | 23 |
class Theories_Dockable(view: View, position: String) extends Dockable(view, position) |
39515 | 24 |
{ |
48021
d899be1cfe6d
separate syslog dockable -- discontinued tendency of sub-window management via tabs;
wenzelm
parents:
48018
diff
changeset
|
25 |
/* status */ |
39591 | 26 |
|
48021
d899be1cfe6d
separate syslog dockable -- discontinued tendency of sub-window management via tabs;
wenzelm
parents:
48018
diff
changeset
|
27 |
private val status = new ListView(Nil: List[Document.Node.Name]) { |
56389 | 28 |
background = |
29 |
{ |
|
30 |
// enforce default value |
|
31 |
val c = UIManager.getDefaults.getColor("Panel.background") |
|
32 |
new Color(c.getRed, c.getGreen, c.getBlue, c.getAlpha) |
|
33 |
} |
|
44991 | 34 |
listenTo(mouse.clicks) |
52817 | 35 |
listenTo(mouse.moves) |
44991 | 36 |
reactions += { |
52816
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
37 |
case MouseClicked(_, point, _, clicks, _) => |
44991 | 38 |
val index = peer.locationToIndex(point) |
52817 | 39 |
if (index >= 0) { |
40 |
if (in_checkbox(peer.indexToLocation(index), point)) { |
|
41 |
if (clicks == 1) { |
|
42 |
for { |
|
56457
eea4bbe15745
tuned signature -- prefer static type Document.Node.Name;
wenzelm
parents:
56407
diff
changeset
|
43 |
buffer <- JEdit_Lib.jedit_buffer(listData(index)) |
52817 | 44 |
model <- PIDE.document_model(buffer) |
45 |
} model.node_required = !model.node_required |
|
46 |
} |
|
52816
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
47 |
} |
60893 | 48 |
else if (clicks == 2) PIDE.editor.goto_file(true, view, listData(index).node) |
52816
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
49 |
} |
52817 | 50 |
case MouseMoved(_, point, _) => |
51 |
val index = peer.locationToIndex(point) |
|
52 |
if (index >= 0 && in_checkbox(peer.indexToLocation(index), point)) |
|
53 |
tooltip = "Mark as required for continuous checking" |
|
54 |
else |
|
55 |
tooltip = null |
|
44991 | 56 |
} |
57 |
} |
|
50250 | 58 |
status.peer.setLayoutOrientation(JList.HORIZONTAL_WRAP) |
59 |
status.peer.setVisibleRowCount(0) |
|
44609 | 60 |
status.selection.intervalMode = ListView.IntervalMode.Single |
61 |
||
49038 | 62 |
set_content(new ScrollPane(status)) |
39515 | 63 |
|
64 |
||
39593 | 65 |
/* controls */ |
66 |
||
50299 | 67 |
def phase_text(phase: Session.Phase): String = |
56599 | 68 |
"Prover: " + Word.lowercase(phase.toString) |
50299 | 69 |
|
70 |
private val session_phase = new Label(phase_text(PIDE.session.phase)) |
|
39697 | 71 |
session_phase.border = new SoftBevelBorder(BevelBorder.LOWERED) |
50299 | 72 |
session_phase.tooltip = "Status of prover session" |
39635 | 73 |
|
48018
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
74 |
private def handle_phase(phase: Session.Phase) |
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
75 |
{ |
57612
990ffb84489b
clarified module name: facilitate alternative GUI frameworks;
wenzelm
parents:
56715
diff
changeset
|
76 |
GUI_Thread.require {} |
53177
dcac8d837b9c
more uniform treatment of Swing_Thread context switch: prefer asynchronous Swing_Thread.later from actor;
wenzelm
parents:
53176
diff
changeset
|
77 |
session_phase.text = " " + phase_text(phase) + " " |
48018
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
78 |
} |
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
79 |
|
53715 | 80 |
private val continuous_checking = new Isabelle.Continuous_Checking |
54652
07ee041537a5
non-focusable button, to avoid second interpretation of SPACE in C+e SPACE (isabelle.set-node-required);
wenzelm
parents:
53715
diff
changeset
|
81 |
continuous_checking.focusable = false |
44776
47e8c8daccae
added "check" button: adhoc change to full buffer perspective;
wenzelm
parents:
44775
diff
changeset
|
82 |
|
49246 | 83 |
private val logic = Isabelle_Logic.logic_selector(true) |
39702 | 84 |
|
44775
27930cf6f0f7
added "cancel" button based on cancel_execution, not interrupt (cf. 156be0e43336);
wenzelm
parents:
44734
diff
changeset
|
85 |
private val controls = |
53711
8ce7795256e1
improved FlowLayout for wrapping of components over multiple lines;
wenzelm
parents:
53178
diff
changeset
|
86 |
new Wrap_Panel(Wrap_Panel.Alignment.Right)(continuous_checking, session_phase, logic) |
39593 | 87 |
add(controls.peer, BorderLayout.NORTH) |
88 |
||
89 |
||
57612
990ffb84489b
clarified module name: facilitate alternative GUI frameworks;
wenzelm
parents:
56715
diff
changeset
|
90 |
/* component state -- owned by GUI thread */ |
44609 | 91 |
|
45709
87017fcbad83
clarified modules (again) -- NB: both Document and Protocol are specific to this particular prover;
wenzelm
parents:
45672
diff
changeset
|
92 |
private var nodes_status: Map[Document.Node.Name, Protocol.Node_Status] = Map.empty |
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
93 |
private var nodes_required: Set[Document.Node.Name] = Set.empty |
44866 | 94 |
|
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
95 |
private def update_nodes_required() |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
96 |
{ |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
97 |
nodes_required = Set.empty |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
98 |
for { |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
99 |
buffer <- JEdit_Lib.jedit_buffers |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
100 |
model <- PIDE.document_model(buffer) |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
101 |
if model.node_required |
52973 | 102 |
} nodes_required += model.node_name |
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
103 |
} |
52860
f155c38242c1
initial update of nodes_required, for proper GUI state;
wenzelm
parents:
52819
diff
changeset
|
104 |
update_nodes_required() |
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
105 |
|
52817 | 106 |
private def in_checkbox(loc0: Point, p: Point): Boolean = |
107 |
Node_Renderer_Component != null && |
|
108 |
(Node_Renderer_Component.checkbox_geometry match { |
|
109 |
case Some((loc, size)) => |
|
110 |
loc0.x + loc.x <= p.x && p.x < loc0.x + size.width && |
|
111 |
loc0.y + loc.y <= p.y && p.y < loc0.y + size.height |
|
112 |
case None => false |
|
113 |
}) |
|
114 |
||
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
115 |
private object Node_Renderer_Component extends BorderPanel |
44866 | 116 |
{ |
56389 | 117 |
opaque = true |
53176 | 118 |
border = BorderFactory.createEmptyBorder(2, 2, 2, 2) |
44957
098dd95349e7
more elaborate Node_Renderer, which paints node_name.theory only;
wenzelm
parents:
44867
diff
changeset
|
119 |
|
098dd95349e7
more elaborate Node_Renderer, which paints node_name.theory only;
wenzelm
parents:
44867
diff
changeset
|
120 |
var node_name = Document.Node.Name.empty |
52816
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
121 |
|
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
122 |
var checkbox_geometry: Option[(Point, Dimension)] = None |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
123 |
val checkbox = new CheckBox { |
52819 | 124 |
opaque = false |
52816
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
125 |
override def paintComponent(gfx: Graphics2D) |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
126 |
{ |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
127 |
super.paintComponent(gfx) |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
128 |
if (location != null && size != null) |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
129 |
checkbox_geometry = Some((location, size)) |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
130 |
} |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
131 |
} |
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
132 |
|
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
133 |
val label = new Label { |
56389 | 134 |
background = view.getTextArea.getPainter.getBackground |
135 |
foreground = view.getTextArea.getPainter.getForeground |
|
136 |
border = |
|
137 |
BorderFactory.createCompoundBorder( |
|
138 |
BorderFactory.createLineBorder(foreground, 1), |
|
139 |
BorderFactory.createEmptyBorder(1, 1, 1, 1)) |
|
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
140 |
opaque = false |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
141 |
xAlignment = Alignment.Leading |
52809
e750169a5884
paint unassigned/unchanged nodes as unprocessed -- relevant for editor_continuous_checking = false;
wenzelm
parents:
52807
diff
changeset
|
142 |
|
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
143 |
override def paintComponent(gfx: Graphics2D) |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
144 |
{ |
53178 | 145 |
def paint_segment(x: Int, w: Int, color: Color) |
146 |
{ |
|
147 |
gfx.setColor(color) |
|
148 |
gfx.fillRect(x, 0, w, size.height) |
|
149 |
} |
|
50900
6d80709ab862
separate color ranges by 1px to improve discernment of overall theory status;
wenzelm
parents:
50895
diff
changeset
|
150 |
|
56389 | 151 |
paint_segment(0, size.width, background) |
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
152 |
nodes_status.get(node_name) match { |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
153 |
case Some(st) if st.total > 0 => |
53178 | 154 |
val segments = |
155 |
List( |
|
156 |
(st.unprocessed, PIDE.options.color_value("unprocessed1_color")), |
|
157 |
(st.running, PIDE.options.color_value("running_color")), |
|
158 |
(st.warned, PIDE.options.color_value("warning_color")), |
|
159 |
(st.failed, PIDE.options.color_value("error_color")) |
|
160 |
).filter(_._1 > 0) |
|
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
161 |
|
56407
8e7ebc4b30f1
tuned rendering -- take 1px line border into account;
wenzelm
parents:
56389
diff
changeset
|
162 |
((size.width - 1) /: segments)({ case (last, (n, color)) => |
8e7ebc4b30f1
tuned rendering -- take 1px line border into account;
wenzelm
parents:
56389
diff
changeset
|
163 |
val w = (n * ((size.width - 2) - segments.length) / st.total) max 4 |
53178 | 164 |
paint_segment(last - w, w, color) |
165 |
last - w - 1 |
|
166 |
}) |
|
167 |
||
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
168 |
case _ => |
53178 | 169 |
paint_segment(0, size.width, PIDE.options.color_value("unprocessed1_color")) |
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
170 |
} |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
171 |
super.paintComponent(gfx) |
44866 | 172 |
} |
173 |
} |
|
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
174 |
|
52816
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
175 |
layout(checkbox) = BorderPanel.Position.West |
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
176 |
layout(label) = BorderPanel.Position.Center |
44866 | 177 |
} |
178 |
||
44990 | 179 |
private class Node_Renderer extends ListView.Renderer[Document.Node.Name] |
44957
098dd95349e7
more elaborate Node_Renderer, which paints node_name.theory only;
wenzelm
parents:
44867
diff
changeset
|
180 |
{ |
44990 | 181 |
def componentFor(list: ListView[_], isSelected: Boolean, focused: Boolean, |
182 |
name: Document.Node.Name, index: Int): Component = |
|
44957
098dd95349e7
more elaborate Node_Renderer, which paints node_name.theory only;
wenzelm
parents:
44867
diff
changeset
|
183 |
{ |
44990 | 184 |
val component = Node_Renderer_Component |
44957
098dd95349e7
more elaborate Node_Renderer, which paints node_name.theory only;
wenzelm
parents:
44867
diff
changeset
|
185 |
component.node_name = name |
52816
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
186 |
component.checkbox.selected = nodes_required.contains(name) |
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
187 |
component.label.text = name.theory |
44990 | 188 |
component |
44957
098dd95349e7
more elaborate Node_Renderer, which paints node_name.theory only;
wenzelm
parents:
44867
diff
changeset
|
189 |
} |
098dd95349e7
more elaborate Node_Renderer, which paints node_name.theory only;
wenzelm
parents:
44867
diff
changeset
|
190 |
} |
098dd95349e7
more elaborate Node_Renderer, which paints node_name.theory only;
wenzelm
parents:
44867
diff
changeset
|
191 |
status.renderer = new Node_Renderer |
44609 | 192 |
|
45011
436ea69d5d37
more careful treatment of initial update, similar to output panel;
wenzelm
parents:
44991
diff
changeset
|
193 |
private def handle_update(restriction: Option[Set[Document.Node.Name]] = None) |
44609 | 194 |
{ |
61326
3ad2b2055ffc
produce nodes_status outside GUI thread, to avoid a few milliseconds of blocking;
wenzelm
parents:
60893
diff
changeset
|
195 |
val (snapshot, nodes_status0) = |
3ad2b2055ffc
produce nodes_status outside GUI thread, to avoid a few milliseconds of blocking;
wenzelm
parents:
60893
diff
changeset
|
196 |
GUI_Thread.now { (PIDE.session.snapshot(), nodes_status) } |
53177
dcac8d837b9c
more uniform treatment of Swing_Thread context switch: prefer asynchronous Swing_Thread.later from actor;
wenzelm
parents:
53176
diff
changeset
|
197 |
|
57619 | 198 |
val nodes = snapshot.version.nodes |
44613 | 199 |
|
53177
dcac8d837b9c
more uniform treatment of Swing_Thread context switch: prefer asynchronous Swing_Thread.later from actor;
wenzelm
parents:
53176
diff
changeset
|
200 |
val iterator = |
57615
df1b3452d71c
more explicit discrimination of empty nodes -- suppress from Theories panel;
wenzelm
parents:
57612
diff
changeset
|
201 |
restriction match { |
57619 | 202 |
case Some(names) => names.iterator.map(name => (name, nodes(name))) |
203 |
case None => nodes.iterator |
|
57615
df1b3452d71c
more explicit discrimination of empty nodes -- suppress from Theories panel;
wenzelm
parents:
57612
diff
changeset
|
204 |
} |
53177
dcac8d837b9c
more uniform treatment of Swing_Thread context switch: prefer asynchronous Swing_Thread.later from actor;
wenzelm
parents:
53176
diff
changeset
|
205 |
val nodes_status1 = |
61326
3ad2b2055ffc
produce nodes_status outside GUI thread, to avoid a few milliseconds of blocking;
wenzelm
parents:
60893
diff
changeset
|
206 |
(nodes_status0 /: iterator)({ case (status, (name, node)) => |
57619 | 207 |
if (!name.is_theory || PIDE.resources.loaded_theories(name.theory) || node.is_empty) |
208 |
status |
|
53177
dcac8d837b9c
more uniform treatment of Swing_Thread context switch: prefer asynchronous Swing_Thread.later from actor;
wenzelm
parents:
53176
diff
changeset
|
209 |
else status + (name -> Protocol.node_status(snapshot.state, snapshot.version, node)) }) |
44672 | 210 |
|
57619 | 211 |
val nodes_status2 = |
212 |
nodes_status1 -- nodes_status1.keysIterator.filter(nodes.is_hidden(_)) |
|
213 |
||
61326
3ad2b2055ffc
produce nodes_status outside GUI thread, to avoid a few milliseconds of blocking;
wenzelm
parents:
60893
diff
changeset
|
214 |
if (nodes_status0 != nodes_status2) |
3ad2b2055ffc
produce nodes_status outside GUI thread, to avoid a few milliseconds of blocking;
wenzelm
parents:
60893
diff
changeset
|
215 |
GUI_Thread.now { |
3ad2b2055ffc
produce nodes_status outside GUI thread, to avoid a few milliseconds of blocking;
wenzelm
parents:
60893
diff
changeset
|
216 |
nodes_status = nodes_status2 |
3ad2b2055ffc
produce nodes_status outside GUI thread, to avoid a few milliseconds of blocking;
wenzelm
parents:
60893
diff
changeset
|
217 |
status.listData = nodes.topological_order.filter(nodes_status.isDefinedAt(_)) |
61716 | 218 |
status.repaint() |
61326
3ad2b2055ffc
produce nodes_status outside GUI thread, to avoid a few milliseconds of blocking;
wenzelm
parents:
60893
diff
changeset
|
219 |
} |
44609 | 220 |
} |
221 |
||
222 |
||
56715
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
223 |
/* main */ |
39515 | 224 |
|
56715
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
225 |
private val main = |
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
226 |
Session.Consumer[Any](getClass.getName) { |
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
227 |
case phase: Session.Phase => |
57612
990ffb84489b
clarified module name: facilitate alternative GUI frameworks;
wenzelm
parents:
56715
diff
changeset
|
228 |
GUI_Thread.later { handle_phase(phase) } |
39635 | 229 |
|
56715
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
230 |
case _: Session.Global_Options => |
57612
990ffb84489b
clarified module name: facilitate alternative GUI frameworks;
wenzelm
parents:
56715
diff
changeset
|
231 |
GUI_Thread.later { |
56715
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
232 |
continuous_checking.load() |
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
233 |
logic.load () |
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
234 |
update_nodes_required() |
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
235 |
status.repaint() |
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
236 |
} |
49247 | 237 |
|
56715
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
238 |
case changed: Session.Commands_Changed => |
61326
3ad2b2055ffc
produce nodes_status outside GUI thread, to avoid a few milliseconds of blocking;
wenzelm
parents:
60893
diff
changeset
|
239 |
handle_update(Some(changed.nodes)) |
39515 | 240 |
} |
241 |
||
48018
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
242 |
override def init() |
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
243 |
{ |
56715
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
244 |
PIDE.session.phase_changed += main |
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
245 |
PIDE.session.global_options += main |
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
246 |
PIDE.session.commands_changed += main |
53177
dcac8d837b9c
more uniform treatment of Swing_Thread context switch: prefer asynchronous Swing_Thread.later from actor;
wenzelm
parents:
53176
diff
changeset
|
247 |
|
dcac8d837b9c
more uniform treatment of Swing_Thread context switch: prefer asynchronous Swing_Thread.later from actor;
wenzelm
parents:
53176
diff
changeset
|
248 |
handle_phase(PIDE.session.phase) |
dcac8d837b9c
more uniform treatment of Swing_Thread context switch: prefer asynchronous Swing_Thread.later from actor;
wenzelm
parents:
53176
diff
changeset
|
249 |
handle_update() |
39635 | 250 |
} |
251 |
||
48018
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
252 |
override def exit() |
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
253 |
{ |
56715
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
254 |
PIDE.session.phase_changed -= main |
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
255 |
PIDE.session.global_options -= main |
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
256 |
PIDE.session.commands_changed -= main |
39635 | 257 |
} |
39515 | 258 |
} |