1 "{ Package: 'jv:vdb' }" |
1 "{ Package: 'jv:vdb' }" |
2 |
2 |
3 VDBAbstractApplication subclass:#VDBStackApplication |
3 "{ NameSpace: Smalltalk }" |
|
4 |
|
5 VDBAbstractTreeApplication subclass:#VDBStackApplication |
4 instanceVariableNames:'selectedThreadGroupHolder selectedThreadHolder |
6 instanceVariableNames:'selectedThreadGroupHolder selectedThreadHolder |
5 selectedFrameHolder internalListHolder internalListView |
7 selectedFrameHolder' |
6 internalSelectionHolder' |
|
7 classVariableNames:'' |
8 classVariableNames:'' |
8 poolDictionaries:'' |
9 poolDictionaries:'' |
9 category:'VDB-UI-Others' |
10 category:'VDB-UI-Others' |
10 ! |
11 ! |
11 |
12 |
12 |
|
13 !VDBStackApplication class methodsFor:'interface specs'! |
|
14 |
|
15 windowSpec |
|
16 "This resource specification was automatically generated |
|
17 by the UIPainter of ST/X." |
|
18 |
|
19 "Do not manually edit this!! If it is corrupted, |
|
20 the UIPainter may not be able to read the specification." |
|
21 |
|
22 " |
|
23 UIPainter new openOnClass:VDBStackApplication andSelector:#windowSpec |
|
24 VDBStackApplication new openInterface:#windowSpec |
|
25 VDBStackApplication open |
|
26 " |
|
27 |
|
28 <resource: #canvas> |
|
29 |
|
30 ^ |
|
31 #(FullSpec |
|
32 name: windowSpec |
|
33 window: |
|
34 (WindowSpec |
|
35 label: 'Execution Stack' |
|
36 name: 'Execution Stack' |
|
37 min: (Point 10 10) |
|
38 bounds: (Rectangle 0 0 300 300) |
|
39 ) |
|
40 component: |
|
41 (SpecCollection |
|
42 collection: ( |
|
43 (HierarchicalListViewSpec |
|
44 name: 'Stack' |
|
45 layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
|
46 model: internalSelectionHolder |
|
47 menu: contextMenu |
|
48 hasHorizontalScrollBar: true |
|
49 hasVerticalScrollBar: true |
|
50 listModel: internalListHolder |
|
51 useIndex: false |
|
52 highlightMode: line |
|
53 showLines: false |
|
54 useDefaultIcons: false |
|
55 showRoot: false |
|
56 postBuildCallback: postBuildInternalListView: |
|
57 ) |
|
58 ) |
|
59 |
|
60 ) |
|
61 ) |
|
62 ! ! |
|
63 |
13 |
64 !VDBStackApplication class methodsFor:'menu specs'! |
14 !VDBStackApplication class methodsFor:'menu specs'! |
65 |
15 |
66 contextMenu |
16 contextMenu |
67 "This resource specification was automatically generated |
17 "This resource specification was automatically generated |
209 oldValue ~~ newValue ifTrue:[ |
159 oldValue ~~ newValue ifTrue:[ |
210 self update:#value with:newValue from:selectedThreadHolder. |
160 self update:#value with:newValue from:selectedThreadHolder. |
211 ]. |
161 ]. |
212 ! ! |
162 ! ! |
213 |
163 |
214 !VDBStackApplication methodsFor:'aspects-private'! |
|
215 |
|
216 internalListHolder |
|
217 "return/create the 'listHolder' value holder (automatically generated)" |
|
218 |
|
219 internalListHolder isNil ifTrue:[ |
|
220 internalListHolder := HierarchicalList new. |
|
221 internalListHolder showRoot: false. |
|
222 internalListHolder root: HierarchicalItem new. |
|
223 ]. |
|
224 ^ internalListHolder |
|
225 |
|
226 "Created: / 20-09-2014 / 23:03:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
227 ! |
|
228 |
|
229 internalSelectionHolder |
|
230 "return/create the 'internalSelectionHolder' value holder (automatically generated)" |
|
231 |
|
232 internalSelectionHolder isNil ifTrue:[ |
|
233 internalSelectionHolder := ValueHolder new. |
|
234 internalSelectionHolder addDependent:self. |
|
235 ]. |
|
236 ^ internalSelectionHolder |
|
237 ! ! |
|
238 |
|
239 !VDBStackApplication methodsFor:'change & update'! |
164 !VDBStackApplication methodsFor:'change & update'! |
|
165 |
|
166 enqueueUpdateInternalSelectionAfterThreadStopped: aGDBThread |
|
167 self window sensor pushUserEvent:#updateInternalSelectionAfterThreadStopped: for:self withArgument: aGDBThread |
|
168 |
|
169 "Created: / 22-09-2014 / 23:15:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
170 ! |
240 |
171 |
241 update:aspect with:param from:sender |
172 update:aspect with:param from:sender |
242 "Invoked when an object that I depend upon sends a change notification." |
173 "Invoked when an object that I depend upon sends a change notification." |
243 |
174 |
244 "stub code automatically generated - please change as required" |
175 "stub code automatically generated - please change as required" |
245 |
176 |
246 sender == selectedFrameHolder ifTrue:[ |
177 sender == selectedFrameHolder ifTrue:[ |
247 self updateInternalSelection. |
178 self updateInternalSelection. |
248 ^ self. |
179 ^ self. |
249 ]. |
180 ]. |
250 sender == internalSelectionHolder ifTrue:[ |
|
251 self updateSelection. |
|
252 ]. |
|
253 |
|
254 super update:aspect with:param from:sender |
181 super update:aspect with:param from:sender |
255 |
182 |
256 "Modified: / 20-09-2014 / 23:10:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
183 "Modified: / 27-02-2015 / 15:44:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
257 ! |
|
258 |
|
259 updateInternalList |
|
260 | root list | |
|
261 |
|
262 debugger isNil ifTrue:[ |
|
263 self internalListHolder root children:#(). |
|
264 ^ self. |
|
265 ]. |
|
266 root := self internalListHolder root. |
|
267 list := debugger inferiors |
|
268 select: [ :inferior | inferior isRunning or:[inferior isStopped] ] |
|
269 thenCollect:[ :inferior | VDBThreadGroupPresenter new setThreadGroup: inferior; parent: root ]. |
|
270 root children: list. |
|
271 root expand. |
|
272 root children size == 1 ifTrue:[ |
|
273 root children anElement expand. |
|
274 root children anElement children size == 1 ifTrue:[ |
|
275 root children anElement children anElement expand. |
|
276 ] |
|
277 ]. |
|
278 internalListView notNil ifTrue:[ |
|
279 internalListView invalidate. |
|
280 ] |
|
281 |
|
282 "Created: / 20-09-2014 / 23:05:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
283 "Modified: / 30-09-2014 / 00:56:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
284 ! |
184 ! |
285 |
185 |
286 updateInternalSelection |
186 updateInternalSelection |
287 "/ | selection internalSelection | |
187 "/ | selection internalSelection | |
288 "/ |
188 "/ |
335 "Modified: / 22-09-2014 / 00:17:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
235 "Modified: / 22-09-2014 / 00:17:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
336 ! ! |
236 ! ! |
337 |
237 |
338 !VDBStackApplication methodsFor:'change & update-delayed'! |
238 !VDBStackApplication methodsFor:'change & update-delayed'! |
339 |
239 |
340 enqueueUpdateInternalList |
240 delayedUpdateInternalList |
341 self window sensor pushUserEvent:#updateInternalList for:self |
241 | root list | |
342 |
242 |
343 "Created: / 20-09-2014 / 23:05:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
243 debugger isNil ifTrue:[ |
344 ! |
244 self internalListHolder root children:#(). |
345 |
245 ^ self. |
346 enqueueUpdateInternalSelectionAfterThreadStopped: aGDBThread |
246 ]. |
347 self window sensor pushUserEvent:#updateInternalSelectionAfterThreadStopped: for:self withArgument: aGDBThread |
247 root := self internalListHolder root. |
348 |
248 list := debugger inferiors |
349 "Created: / 22-09-2014 / 23:15:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
249 select:[:inferior | inferior isRunning or:[ inferior isStopped ] ] |
|
250 thenCollect:[:inferior | |
|
251 (VDBThreadGroupPresenter new) |
|
252 setThreadGroup:inferior; |
|
253 parent:root |
|
254 ]. |
|
255 root children:list. |
|
256 root expand. |
|
257 root children size == 1 ifTrue:[ |
|
258 root children anElement expand. |
|
259 root children anElement children size == 1 ifTrue:[ |
|
260 root children anElement children anElement expand. |
|
261 ] |
|
262 ]. |
|
263 internalListView notNil ifTrue:[ |
|
264 internalListView invalidate. |
|
265 ] |
|
266 |
|
267 "Created: / 20-09-2014 / 23:05:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
268 "Modified: / 30-09-2014 / 00:56:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
269 ! |
|
270 |
|
271 delayedUpdateSelection |
|
272 | internalSelection frame thread group | |
|
273 |
|
274 internalSelection := self internalSelectionHolder value. |
|
275 internalSelection notNil ifTrue:[ |
|
276 internalSelection isFramePresenter ifTrue:[ |
|
277 frame := internalSelection frame. |
|
278 thread := frame thread. |
|
279 group := thread group. |
|
280 ] ifFalse:[ |
|
281 internalSelection isThreadPresenter ifTrue:[ |
|
282 thread := internalSelection thread. |
|
283 group := thread group. |
|
284 ] ifFalse:[ |
|
285 group := internalSelection threadGroup. |
|
286 ] |
|
287 ]. |
|
288 ]. |
|
289 |
|
290 self selectedThreadGroupHolder value: group withoutNotifying: self. |
|
291 self selectedThreadHolder value: thread withoutNotifying: self. |
|
292 self selectedFrameHolder value: frame withoutNotifying: self. |
|
293 |
|
294 "Created: / 27-02-2015 / 15:33:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
350 ! ! |
295 ! ! |
351 |
296 |
352 !VDBStackApplication methodsFor:'event handling'! |
297 !VDBStackApplication methodsFor:'event handling'! |
353 |
298 |
354 onRunningEvent: event |
299 onRunningEvent: event |
355 self enqueueUpdateInternalList. |
300 self enqueueDelayedUpdateInternalList. |
356 |
301 |
357 "Created: / 30-09-2014 / 00:02:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
302 "Created: / 30-09-2014 / 00:02:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
358 ! |
303 ! |
359 |
304 |
360 onStoppedEvent: event |
305 onStoppedEvent: event |
361 self enqueueUpdateInternalList. |
306 self enqueueDelayedUpdateInternalList. |
362 self enqueueUpdateInternalSelectionAfterThreadStopped:event stoppedThread. |
307 self enqueueUpdateInternalSelectionAfterThreadStopped:event stoppedThread. |
363 |
308 |
364 "Created: / 17-09-2014 / 23:04:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
309 "Created: / 17-09-2014 / 23:04:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
365 "Modified: / 22-09-2014 / 23:26:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
310 "Modified: / 22-09-2014 / 23:26:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
366 ! |
311 ! |
367 |
312 |
368 onThreadExitedEvent: event |
313 onThreadExitedEvent: event |
369 self enqueueUpdateInternalList. |
314 self enqueueDelayedUpdateInternalList. |
370 |
315 |
371 "Created: / 18-09-2014 / 23:30:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
316 "Created: / 18-09-2014 / 23:30:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
372 "Modified: / 20-09-2014 / 23:08:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
317 "Modified: / 20-09-2014 / 23:08:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
373 ! |
318 ! |
374 |
319 |
375 onThreadGroupExitedEvent: event |
320 onThreadGroupExitedEvent: event |
376 self enqueueUpdateInternalList. |
321 self enqueueDelayedUpdateInternalList. |
377 |
322 |
378 "Created: / 18-09-2014 / 23:30:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
323 "Created: / 18-09-2014 / 23:30:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
379 "Modified: / 20-09-2014 / 23:08:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
324 "Modified: / 20-09-2014 / 23:08:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
380 ! ! |
|
381 |
|
382 !VDBStackApplication methodsFor:'hooks'! |
|
383 |
|
384 commonPostOpen |
|
385 "a common hook for postOpenWith:, postOpenAsSubcanvasWith: and postOpenAsDialogWith:." |
|
386 |
|
387 self enqueueUpdateInternalList |
|
388 |
|
389 "Created: / 18-09-2014 / 00:29:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
390 "Modified: / 20-09-2014 / 23:50:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
391 ! |
|
392 |
|
393 postBuildInternalListView: aView |
|
394 internalListView := aView |
|
395 |
|
396 "Modified: / 30-09-2014 / 00:00:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
397 ! ! |
325 ! ! |
398 |
326 |
399 !VDBStackApplication methodsFor:'initialization & release'! |
327 !VDBStackApplication methodsFor:'initialization & release'! |
400 |
328 |
401 subscribe |
329 subscribe |