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