author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Fri, 08 Feb 2013 08:51:42 +0100 | |
branch | jv |
changeset 12406 | 1fbd331e4489 |
parent 12401 | 4714b9640528 |
parent 12405 | 76f9a872362b |
child 12431 | 9f0c59c742d5 |
permissions | -rw-r--r-- |
10023 | 1 |
" |
2 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
10042 | 3 |
All Rights Reserved |
10023 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
"{ Package: 'stx:libtool' }" |
|
8775 | 13 |
|
14 |
"{ NameSpace: Tools }" |
|
15 |
||
16 |
CodeView subclass:#NewSystemBrowserCodeView |
|
10172
6e6165958f2c
changed: #leftClickMenuForVariableNode:
Claus Gittinger <cg@exept.de>
parents:
10042
diff
changeset
|
17 |
instanceVariableNames:'browser parseTree selectedNode parsingProcess |
6e6165958f2c
changed: #leftClickMenuForVariableNode:
Claus Gittinger <cg@exept.de>
parents:
10042
diff
changeset
|
18 |
parsingProcessRunning highlightEmphasis seqNum' |
6e6165958f2c
changed: #leftClickMenuForVariableNode:
Claus Gittinger <cg@exept.de>
parents:
10042
diff
changeset
|
19 |
classVariableNames:'' |
6e6165958f2c
changed: #leftClickMenuForVariableNode:
Claus Gittinger <cg@exept.de>
parents:
10042
diff
changeset
|
20 |
poolDictionaries:'' |
6e6165958f2c
changed: #leftClickMenuForVariableNode:
Claus Gittinger <cg@exept.de>
parents:
10042
diff
changeset
|
21 |
category:'Interface-Browsers-New' |
8775 | 22 |
! |
23 |
||
10023 | 24 |
!NewSystemBrowserCodeView class methodsFor:'documentation'! |
25 |
||
26 |
copyright |
|
27 |
" |
|
28 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
10042 | 29 |
All Rights Reserved |
10023 | 30 |
|
31 |
This software is furnished under a license and may be used |
|
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
! ! |
|
8775 | 39 |
|
12405
76f9a872362b
Merged 3efd83b86c07 and 1206aff1f11 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
40 |
|
8775 | 41 |
!NewSystemBrowserCodeView class methodsFor:'initialization'! |
42 |
||
43 |
initialize |
|
44 |
" |
|
45 |
self initialize |
|
46 |
" |
|
10024 | 47 |
"/ MUST be done in the keyboard.rc file |
10023 | 48 |
" |
49 |
Smalltalk addStartBlock: |
|
50 |
[Display keyboardMap |
|
51 |
bindValue:#ImplementorsOfIt to:#Cmdm; |
|
52 |
bindValue:#SendersOfIt to:#Cmdn; |
|
53 |
bindValue:#GoBack to:#CmdBackSpace] |
|
54 |
" |
|
8775 | 55 |
|
56 |
"Created: / 25-12-2007 / 19:58:53 / janfrog" |
|
57 |
"Modified: / 27-02-2008 / 12:16:10 / janfrog" |
|
10023 | 58 |
"Modified: / 15-04-2010 / 16:40:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10024 | 59 |
"Modified (comment): / 01-07-2011 / 16:21:38 / cg" |
8775 | 60 |
! ! |
61 |
||
12405
76f9a872362b
Merged 3efd83b86c07 and 1206aff1f11 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
62 |
|
8775 | 63 |
!NewSystemBrowserCodeView class methodsFor:'menu specs'! |
64 |
||
65 |
editMenuSpec |
|
66 |
"This resource specification was automatically generated |
|
67 |
by the MenuEditor of ST/X." |
|
68 |
||
69 |
"Do not manually edit this!! If it is corrupted, |
|
70 |
the MenuEditor may not be able to read the specification." |
|
71 |
||
72 |
" |
|
73 |
MenuEditor new openOnClass:Tools::NewSystemBrowserCodeView andSelector:#editMenuSpec |
|
74 |
(Menu new fromLiteralArrayEncoding:(Tools::NewSystemBrowserCodeView editMenuSpec)) startUp |
|
75 |
" |
|
76 |
||
77 |
<resource: #menu> |
|
78 |
||
79 |
^ |
|
80 |
#(Menu |
|
81 |
( |
|
82 |
(MenuItem |
|
83 |
label: 'Implementors' |
|
84 |
itemValue: browseImplementorsOfIt |
|
85 |
translateLabel: true |
|
86 |
shortcutKey: ImplementorsOfIt |
|
87 |
) |
|
88 |
(MenuItem |
|
89 |
label: 'Senders' |
|
90 |
itemValue: browseSendersOfIt |
|
91 |
translateLabel: true |
|
92 |
shortcutKey: SendersOfIt |
|
93 |
) |
|
94 |
(MenuItem |
|
95 |
label: 'Refactor' |
|
96 |
translateLabel: true |
|
97 |
isVisible: false |
|
98 |
shortcutKey: Shift |
|
99 |
) |
|
100 |
(MenuItem |
|
101 |
label: '-' |
|
102 |
) |
|
103 |
(MenuItem |
|
104 |
label: 'Accept' |
|
105 |
itemValue: accept |
|
106 |
translateLabel: true |
|
107 |
shortcutKey: Accept |
|
108 |
) |
|
109 |
(MenuItem |
|
110 |
label: '-' |
|
111 |
) |
|
112 |
(MenuItem |
|
113 |
label: 'Cut' |
|
114 |
itemValue: cut |
|
115 |
translateLabel: true |
|
116 |
shortcutKey: Cut |
|
117 |
) |
|
118 |
(MenuItem |
|
119 |
label: 'Copy' |
|
120 |
itemValue: copySelection |
|
121 |
translateLabel: true |
|
122 |
shortcutKey: Copy |
|
123 |
) |
|
124 |
(MenuItem |
|
125 |
label: 'Paste' |
|
126 |
itemValue: pasteOrReplace |
|
127 |
translateLabel: true |
|
128 |
shortcutKey: Paste |
|
129 |
) |
|
130 |
(MenuItem |
|
131 |
label: '-' |
|
132 |
) |
|
133 |
(MenuItem |
|
134 |
label: 'Undo' |
|
135 |
itemValue: undo |
|
136 |
translateLabel: true |
|
137 |
shortcutKey: Undo |
|
138 |
) |
|
139 |
(MenuItem |
|
140 |
label: '-' |
|
141 |
) |
|
142 |
(MenuItem |
|
143 |
label: 'Do it' |
|
144 |
itemValue: doIt |
|
145 |
translateLabel: true |
|
146 |
shortcutKey: DoIt |
|
147 |
) |
|
148 |
(MenuItem |
|
149 |
label: 'Print it' |
|
150 |
itemValue: printIt |
|
151 |
translateLabel: true |
|
152 |
shortcutKey: PrintIt |
|
153 |
) |
|
154 |
(MenuItem |
|
155 |
label: 'Inspect it' |
|
156 |
itemValue: inspectIt |
|
157 |
translateLabel: true |
|
158 |
shortcutKey: InspectIt |
|
159 |
) |
|
160 |
(MenuItem |
|
161 |
label: '-' |
|
162 |
) |
|
163 |
(MenuItem |
|
164 |
label: 'Special' |
|
165 |
translateLabel: true |
|
166 |
submenu: |
|
167 |
(Menu |
|
168 |
( |
|
169 |
(MenuItem |
|
170 |
label: 'Inspect RB Parse Tree' |
|
171 |
itemValue: inspectParseTree |
|
172 |
translateLabel: true |
|
173 |
) |
|
174 |
(MenuItem |
|
175 |
label: 'Inspect selected selector' |
|
176 |
itemValue: inspectSelectedSelector |
|
177 |
translateLabel: true |
|
178 |
) |
|
179 |
) |
|
180 |
nil |
|
181 |
nil |
|
182 |
) |
|
183 |
) |
|
184 |
(MenuItem |
|
185 |
label: 'More' |
|
186 |
nameKey: More |
|
187 |
translateLabel: true |
|
188 |
) |
|
189 |
) |
|
190 |
nil |
|
191 |
nil |
|
192 |
) |
|
193 |
||
194 |
"Modified: / 18-10-2008 / 18:50:01 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
195 |
! ! |
|
196 |
||
12405
76f9a872362b
Merged 3efd83b86c07 and 1206aff1f11 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
197 |
|
8775 | 198 |
!NewSystemBrowserCodeView methodsFor:'accessing'! |
199 |
||
200 |
browser |
|
201 |
^ browser ? menuHolder |
|
202 |
||
203 |
"Created: / 25-12-2007 / 10:20:01 / janfrog" |
|
204 |
"Modified: / 26-12-2007 / 12:22:56 / janfrog" |
|
205 |
! |
|
206 |
||
207 |
browser:something |
|
208 |
browser := something. |
|
209 |
||
210 |
"Created: / 25-12-2007 / 10:20:01 / janfrog" |
|
211 |
! |
|
212 |
||
213 |
findNode |
|
214 |
||
215 |
^selectedNode |
|
216 |
ifNil:[self findNodeForInterval: self selectedInterval] |
|
217 |
ifNotNil:[selectedNode] |
|
218 |
||
219 |
"Created: / 18-02-2008 / 22:52:24 / janfrog" |
|
220 |
"Modified: / 19-02-2008 / 09:35:11 / janfrog" |
|
221 |
! |
|
222 |
||
223 |
findNodeForInterval:anInterval |
|
224 |
||
225 |
" |
|
226 |
An empty interval check based on Claus suggestion |
|
227 |
(email Fri, 10 Oct 2008 16:10:25 +0200) |
|
228 |
" |
|
10023 | 229 |
anInterval isEmpty ifTrue:[^nil]. |
8775 | 230 |
|
231 |
^self findNodeIn: self parseTree forInterval: anInterval |
|
232 |
||
233 |
"Created: / 19-02-2008 / 09:44:50 / janfrog" |
|
234 |
"Modified: / 18-10-2008 / 16:47:53 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
10023 | 235 |
"Modified: / 01-09-2009 / 22:45:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
8775 | 236 |
! |
237 |
||
238 |
findNodeIn:tree forInterval:interval |
|
239 |
|node wouldReturn| |
|
240 |
||
241 |
node := nil. |
|
242 |
tree = #error ifTrue:[^nil]. |
|
243 |
tree nodesDo:[:each | |
|
244 |
(each intersectsInterval:interval) ifTrue:[ |
|
245 |
(node isNil or:[node == each parent]) ifTrue:[ |
|
246 |
node := each |
|
247 |
] ifFalse:[ |
|
248 |
(node parent notNil |
|
249 |
and:[node parent isCascade and:[each parent isCascade]]) ifFalse:[^ nil] |
|
250 |
] |
|
251 |
] ifFalse:[ |
|
252 |
node notNil ifTrue:[ |
|
253 |
"/ already found one - beyond that one; leave |
|
254 |
wouldReturn notNil ifTrue:[wouldReturn := node]. |
|
255 |
] |
|
256 |
]. |
|
257 |
]. |
|
258 |
(wouldReturn notNil and:[wouldReturn ~~ node]) ifTrue:[self halt]. |
|
259 |
^ node |
|
260 |
||
261 |
"Created: / 19-02-2008 / 09:40:24 / janfrog" |
|
262 |
"Modified: / 21-02-2008 / 09:35:31 / janfrog" |
|
263 |
! |
|
264 |
||
265 |
selectedClass |
|
266 |
||
267 |
^self browser theSingleSelectedClass |
|
268 |
||
269 |
"Created: / 21-02-2008 / 09:26:55 / janfrog" |
|
270 |
! |
|
271 |
||
272 |
selectedNode |
|
273 |
^ self findNode |
|
274 |
||
275 |
"Created: / 21-02-2008 / 09:17:29 / janfrog" |
|
276 |
! |
|
277 |
||
278 |
selectedSelector |
|
279 |
|selectedText| |
|
280 |
||
10463 | 281 |
^ (selectedText := self selectionAsString) isEmptyOrNil |
10023 | 282 |
ifFalse:[ (SystemBrowser extractSelectorFrom:selectedText) asSymbol ] |
8775 | 283 |
ifTrue:[ |
284 |
selectedNode ifNil:[ self highlightNodeAtCursor ]. |
|
285 |
(selectedNode notNil and:[ selectedNode isMessage ]) ifTrue:[ |
|
286 |
selectedNode selector |
|
287 |
] ifFalse:[ nil ] |
|
288 |
] |
|
289 |
||
290 |
"Created: / 26-12-2007 / 11:12:26 / janfrog" |
|
291 |
"Modified: / 19-02-2008 / 09:16:11 / janfrog" |
|
10463 | 292 |
"Modified: / 04-08-2011 / 19:05:43 / cg" |
8775 | 293 |
! ! |
294 |
||
12405
76f9a872362b
Merged 3efd83b86c07 and 1206aff1f11 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
295 |
|
8775 | 296 |
!NewSystemBrowserCodeView methodsFor:'accessing-contents'! |
297 |
||
298 |
list: anObject |
|
299 |
||
300 |
super list: anObject. |
|
301 |
self updateParseTree. |
|
302 |
||
303 |
"Created: / 25-12-2007 / 10:05:17 / janfrog" |
|
304 |
! ! |
|
305 |
||
12405
76f9a872362b
Merged 3efd83b86c07 and 1206aff1f11 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
306 |
|
8775 | 307 |
!NewSystemBrowserCodeView methodsFor:'change & update'! |
308 |
||
309 |
updateParseTree |
|
310 |
||
311 |
self startParsingProcess |
|
312 |
"/Transcript showCR:'Updating parse tree' |
|
313 |
||
314 |
"Created: / 25-12-2007 / 10:05:49 / janfrog" |
|
315 |
"Modified: / 25-12-2007 / 21:29:28 / janfrog" |
|
316 |
! ! |
|
317 |
||
12405
76f9a872362b
Merged 3efd83b86c07 and 1206aff1f11 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
318 |
|
8775 | 319 |
!NewSystemBrowserCodeView methodsFor:'event handling'! |
320 |
||
321 |
buttonMotion:button x:x y:y |
|
8874 | 322 |
(button == 0 and:[ self sensor ctrlDown ]) |
8775 | 323 |
ifTrue:[ |
8874 | 324 |
^ self |
8775 | 325 |
highlightNodeAtX:x y:y; |
326 |
redraw |
|
327 |
] |
|
328 |
ifFalse:[ |
|
8874 | 329 |
^ super |
8775 | 330 |
buttonMotion:button |
331 |
x:x |
|
332 |
y:y |
|
333 |
] |
|
334 |
||
335 |
"Created: / 25-12-2007 / 21:53:50 / janfrog" |
|
336 |
"Modified: / 19-02-2008 / 09:15:09 / janfrog" |
|
337 |
! |
|
338 |
||
10023 | 339 |
buttonPress: button x: x y: y |
340 |
| node | |
|
8775 | 341 |
|
10023 | 342 |
(self sensor ctrlDown and: [ (node := self selectedNode) notNil ]) |
343 |
ifTrue: |
|
344 |
[ button = 1 |
|
345 |
ifTrue: [ ^ self openMenu: (node leftClickMenuInCodeView: self) ]. |
|
346 |
button = #paste |
|
347 |
ifTrue: [ ^ self openMenu: (node middleClickMenuInCodeView: self) ]. |
|
348 |
button = 2 |
|
349 |
ifTrue: [ ^ self openMenu: (node rightClickMenuInCodeView: self) ] ]. |
|
8775 | 350 |
super |
10023 | 351 |
buttonPress: button |
352 |
x: x |
|
353 |
y: y |
|
8775 | 354 |
|
355 |
"Created: / 26-12-2007 / 11:39:50 / janfrog" |
|
356 |
"Modified: / 21-02-2008 / 09:17:29 / janfrog" |
|
357 |
! |
|
358 |
||
359 |
handleNonCommandKey:keyArg |
|
360 |
||
361 |
super handleNonCommandKey: keyArg. |
|
362 |
self startParsingProcess. |
|
363 |
||
364 |
"Created: / 18-02-2008 / 17:18:22 / janfrog" |
|
365 |
! |
|
366 |
||
367 |
keyPress:key x:x y:y |
|
12104
ef5283010b5f
class: Tools::NewSystemBrowserCodeView
Claus Gittinger <cg@exept.de>
parents:
11790
diff
changeset
|
368 |
<resource: #keyboard (#Control_L |
ef5283010b5f
class: Tools::NewSystemBrowserCodeView
Claus Gittinger <cg@exept.de>
parents:
11790
diff
changeset
|
369 |
#Tab #Return #BackSpace #Delete |
ef5283010b5f
class: Tools::NewSystemBrowserCodeView
Claus Gittinger <cg@exept.de>
parents:
11790
diff
changeset
|
370 |
#GoBack)> |
ef5283010b5f
class: Tools::NewSystemBrowserCodeView
Claus Gittinger <cg@exept.de>
parents:
11790
diff
changeset
|
371 |
|
8775 | 372 |
(x notNil and:[ y notNil ]) ifTrue:[ |
373 |
key = #'Control_L' ifTrue:[ |
|
374 |
self |
|
375 |
highlightNodeAtX:x y:y; |
|
376 |
redraw |
|
377 |
]. |
|
378 |
"key = #Alt_L ifTrue: [self highlightParseTreeNodeAtX: x y: y; redraw]" |
|
379 |
]. |
|
380 |
||
12104
ef5283010b5f
class: Tools::NewSystemBrowserCodeView
Claus Gittinger <cg@exept.de>
parents:
11790
diff
changeset
|
381 |
(#( #Tab #Return #BackSpace #Delete) includes:key) ifTrue:[ |
8775 | 382 |
self startParsingProcess |
383 |
]. |
|
384 |
||
385 |
key == #GoBack ifTrue:[self goBack]. |
|
386 |
||
387 |
^ super |
|
388 |
keyPress:key |
|
389 |
x:x |
|
390 |
y:y |
|
391 |
||
392 |
"Created: / 25-12-2007 / 23:49:38 / janfrog" |
|
393 |
"Modified: / 27-02-2008 / 12:18:56 / janfrog" |
|
394 |
"Modified: / 12-03-2009 / 16:35:56 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
395 |
! |
|
396 |
||
397 |
keyRelease: key x: x y: y |
|
12355
fbe8bf441be4
class: Tools::NewSystemBrowserCodeView
Claus Gittinger <cg@exept.de>
parents:
12104
diff
changeset
|
398 |
"/ textView isQuickMenuModifierReleased ifTrue:[ |
fbe8bf441be4
class: Tools::NewSystemBrowserCodeView
Claus Gittinger <cg@exept.de>
parents:
12104
diff
changeset
|
399 |
"/ selectedNode := nil. |
fbe8bf441be4
class: Tools::NewSystemBrowserCodeView
Claus Gittinger <cg@exept.de>
parents:
12104
diff
changeset
|
400 |
"/ self highlightClear; redraw |
fbe8bf441be4
class: Tools::NewSystemBrowserCodeView
Claus Gittinger <cg@exept.de>
parents:
12104
diff
changeset
|
401 |
"/ ]. |
8775 | 402 |
|
403 |
^ super |
|
404 |
keyRelease: key |
|
405 |
x: x |
|
406 |
y: y |
|
407 |
||
408 |
"Created: / 25-12-2007 / 23:15:15 / janfrog" |
|
409 |
"Modified: / 19-02-2008 / 09:16:11 / janfrog" |
|
410 |
! ! |
|
411 |
||
12405
76f9a872362b
Merged 3efd83b86c07 and 1206aff1f11 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
412 |
|
8775 | 413 |
!NewSystemBrowserCodeView methodsFor:'menu'! |
414 |
||
10023 | 415 |
browseClassesMenu: classes |
416 |
| menu| |
|
417 |
||
418 |
menu := Menu new. |
|
419 |
classes do: |
|
420 |
[:cls| |
|
421 |
menu addItem:(MenuItem |
|
422 |
label: ('Browse ' , cls fullName asText allBold) |
|
423 |
value:[self browseClass: cls])]. |
|
424 |
||
425 |
^ menu |
|
426 |
||
427 |
"Modified: / 19-10-2008 / 08:16:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
428 |
"Created: / 01-09-2009 / 09:41:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
429 |
! |
|
430 |
||
8775 | 431 |
editMenu |
432 |
||
433 |
| editMenu superEditMenu moreMenu moreMenuItem | |
|
434 |
editMenu := self class editMenuSpec decodeAsLiteralArray. |
|
435 |
superEditMenu := super editMenu. |
|
436 |
moreMenu := superEditMenu subMenuAt: superEditMenu numberOfItems. |
|
437 |
moreMenuItem := editMenu menuItemLabeled: 'More'. |
|
438 |
moreMenuItem submenu: moreMenu asMenu. |
|
439 |
editMenu findGuiResourcesIn: self. |
|
440 |
^editMenu |
|
441 |
||
442 |
"Created: / 25-12-2007 / 10:10:01 / janfrog" |
|
443 |
"Modified: / 25-12-2007 / 19:50:53 / janfrog" |
|
444 |
"Modified: / 18-10-2008 / 20:31:16 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
445 |
! |
|
446 |
||
447 |
messageNodeContextMenu:messageNode |
|
448 |
|menu| |
|
449 |
||
450 |
menu := Menu new. |
|
451 |
menu |
|
452 |
addItem:((MenuItem new) |
|
453 |
label:'Implementors'; |
|
454 |
shortcutKey:#ImplementorsOfIt; |
|
455 |
submenuChannel:(Promise |
|
456 |
value:[ self messageNodeImplementorsMenu:messageNode ])); |
|
457 |
addItem:((MenuItem new) |
|
458 |
label:'Senders'; |
|
459 |
shortcutKey:#SendersOfIt; |
|
460 |
submenuChannel:(Promise value:[ self messageNodeSendersMenu:messageNode ])). |
|
461 |
^ menu |
|
462 |
||
463 |
"Created: / 18-02-2008 / 21:05:36 / janfrog" |
|
464 |
! |
|
465 |
||
466 |
messageNodeImplementorsMenu:messageNode |
|
467 |
|implementors selector menu| |
|
468 |
||
469 |
menu := Menu new. |
|
470 |
implementors := self implementorsOf:(selector := messageNode selector). |
|
10463 | 471 |
implementors isEmptyOrNil ifTrue:[ |
8775 | 472 |
menu addItem:(MenuItem label:'No implementors found') disable |
473 |
] ifFalse:[ |
|
474 |
menu addItem:(MenuItem |
|
475 |
label:(selector storeString , (' (all implementors) ') asText allItalic) |
|
476 |
value:[ |
|
477 |
self browseMethods:implementors |
|
478 |
label:'Implementors of ' , selector storeString |
|
479 |
]). |
|
480 |
menu addSeparator. |
|
481 |
implementors do:[:mth | |
|
482 |
menu |
|
483 |
addItem:(MenuItem label:(selector storeString |
|
484 |
, (' in ' , mth containingClass name asText allBold)) |
|
485 |
value:[ self browseMethod:mth label: 'Implementor of ' , selector storeString ]) |
|
486 |
] |
|
487 |
]. |
|
488 |
^ menu |
|
489 |
||
490 |
"Created: / 18-02-2008 / 21:05:47 / janfrog" |
|
491 |
"Modified: / 19-10-2008 / 08:16:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
10463 | 492 |
"Modified: / 04-08-2011 / 19:05:37 / cg" |
8775 | 493 |
! |
494 |
||
495 |
messageNodeSendersMenu:messageNode |
|
496 |
|implementors selector menu| |
|
497 |
||
498 |
menu := Menu new. |
|
499 |
implementors := self sendersOf:(selector := messageNode selector). |
|
10463 | 500 |
implementors isEmptyOrNil ifTrue:[ |
8775 | 501 |
menu addItem:(MenuItem label:'No senders found') disable |
502 |
] ifFalse:[ |
|
503 |
menu addItem:(MenuItem |
|
504 |
label:(selector storeString , (' (all senders)') asText allItalic) |
|
505 |
value:[ |
|
506 |
self browseMethods:implementors |
|
507 |
label:'Senders of ' , selector storeString |
|
508 |
]). |
|
509 |
menu addSeparator. |
|
510 |
implementors do:[:mth | |
|
511 |
menu |
|
512 |
addItem:(MenuItem label:(mth selector storeString |
|
513 |
, (' in ' , mth containingClass name asText allBold)) |
|
514 |
value:[ self browseMethod:mth label: 'Sender of ' , selector storeString ]) |
|
515 |
] |
|
516 |
]. |
|
517 |
^ menu |
|
518 |
||
519 |
"Created: / 18-02-2008 / 21:05:56 / janfrog" |
|
520 |
"Modified: / 19-10-2008 / 08:17:00 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
10463 | 521 |
"Modified: / 04-08-2011 / 19:05:40 / cg" |
8775 | 522 |
! |
523 |
||
524 |
openMenu: aMenuOrNil |
|
525 |
||
526 |
aMenuOrNil ifNotNil: |
|
527 |
[self highlightClear; redraw. |
|
528 |
aMenuOrNil startUp]. |
|
529 |
||
530 |
"Created: / 18-02-2008 / 19:03:08 / janfrog" |
|
531 |
! |
|
532 |
||
533 |
variableNodeMenuContext:variableNode |
|
534 |
||
535 |
| menu | |
|
536 |
menu := Menu new. |
|
537 |
menu |
|
538 |
addItem: |
|
539 |
(MenuItem new |
|
540 |
label: 'Rename Local Variable'; |
|
11790 | 541 |
itemValue:[self refactorMenuRenameLocalVariable]; |
8775 | 542 |
enabled:(self isLocalVariableNode: variableNode)); |
543 |
addItem: |
|
544 |
(MenuItem new |
|
545 |
label: 'Rename Instance Variable'; |
|
11790 | 546 |
itemValue:[self refactorMenuRenameInstanceVariable]; |
8775 | 547 |
enabled:(self isInstanceVariableNode: variableNode)). |
548 |
||
549 |
^menu |
|
550 |
||
551 |
"Created: / 18-02-2008 / 21:10:46 / janfrog" |
|
552 |
"Modified: / 21-02-2008 / 09:40:09 / janfrog" |
|
11790 | 553 |
"Modified: / 09-09-2012 / 13:24:19 / cg" |
8775 | 554 |
! ! |
555 |
||
12405
76f9a872362b
Merged 3efd83b86c07 and 1206aff1f11 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
556 |
|
8775 | 557 |
!NewSystemBrowserCodeView methodsFor:'menu - actions'! |
558 |
||
559 |
accept |
|
560 |
||
561 |
super accept. |
|
562 |
self startParsingProcess |
|
563 |
||
564 |
"Created: / 26-12-2007 / 12:33:19 / janfrog" |
|
565 |
! |
|
566 |
||
10023 | 567 |
browseClass: class |
568 |
||
569 |
self browser ifNil: [^NewSystemBrowser browseClass:class]. |
|
570 |
(UserPreferences current alwaysOpenNewTabWhenCtrlClick or:[self browser navigationState modified]) |
|
571 |
ifTrue: |
|
572 |
[self browser |
|
573 |
spawnClassBrowserFor:(Array with: class) |
|
574 |
in:#newBuffer] |
|
575 |
ifFalse: |
|
576 |
[self browser |
|
577 |
switchToClass: class]. |
|
578 |
||
579 |
"Modified: / 19-02-2008 / 10:15:17 / janfrog" |
|
580 |
"Created: / 01-09-2009 / 08:52:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
581 |
! |
|
582 |
||
8775 | 583 |
browseImplementorsOfIt |
584 |
||
585 |
| selector implementors | |
|
586 |
selector := self selectedSelector. |
|
587 |
implementors := self implementorsOf: selector. |
|
588 |
self browseMethods: implementors label: 'Implementors of: ', selector storeString |
|
589 |
||
590 |
"Created: / 26-12-2007 / 11:02:41 / janfrog" |
|
591 |
! |
|
592 |
||
593 |
browseMethod: method label: label |
|
594 |
||
595 |
self browser ifNil: [^NewSystemBrowser openInMethod:method]. |
|
596 |
(UserPreferences current alwaysOpenNewTabWhenCtrlClick or:[self browser navigationState modified]) |
|
597 |
ifTrue: |
|
598 |
[self browser |
|
599 |
spawnMethodBrowserFor:(Array with: method) |
|
600 |
in:#newBuffer |
|
601 |
label:label] |
|
602 |
ifFalse: |
|
603 |
[self browser |
|
604 |
switchToClass: method containingClass |
|
605 |
selector: method selector]. |
|
606 |
||
607 |
"Modified: / 19-02-2008 / 10:15:17 / janfrog" |
|
608 |
"Created: / 19-10-2008 / 08:16:17 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
609 |
! |
|
610 |
||
611 |
browseMethods: methods label: label |
|
612 |
||
613 |
methods size = 1 ifTrue: |
|
614 |
[^self browseMethod: methods anyOne label: label]. |
|
615 |
||
616 |
self browser |
|
617 |
ifNil: [NewSystemBrowser browseMethods: methods title: label] |
|
618 |
ifNotNil:[self browser spawnMethodBrowserFor:methods in:#newBuffer label:label] |
|
619 |
||
620 |
"Created: / 26-12-2007 / 11:32:04 / janfrog" |
|
621 |
"Modified: / 19-10-2008 / 08:17:28 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
622 |
! |
|
623 |
||
624 |
browseSendersOfIt |
|
625 |
||
626 |
| selector implementors | |
|
627 |
selector := self selectedSelector. |
|
628 |
implementors := self sendersOf: selector. |
|
629 |
self browseMethods: implementors label: 'Senders of: ', selector storeString |
|
630 |
||
631 |
"Created: / 26-12-2007 / 11:35:43 / janfrog" |
|
632 |
! |
|
633 |
||
634 |
goBack |
|
635 |
||
636 |
(self browser respondsTo: #goBack) |
|
637 |
ifTrue:[self browser goBack] |
|
638 |
||
639 |
"Created: / 27-02-2008 / 12:18:02 / janfrog" |
|
640 |
! |
|
641 |
||
642 |
inspectParseTree |
|
643 |
^ self parseTree inspect |
|
644 |
||
645 |
"Created: / 25-12-2007 / 21:36:09 / janfrog" |
|
646 |
"Modified: / 19-02-2008 / 09:20:03 / janfrog" |
|
647 |
! |
|
648 |
||
649 |
inspectSelectedSelector |
|
650 |
||
651 |
^self selectedSelector inspect |
|
652 |
||
653 |
"Created: / 26-12-2007 / 11:16:48 / janfrog" |
|
654 |
! |
|
655 |
||
656 |
refactorMenuRenameInstanceVariable |
|
657 |
||
658 |
self topView application codeMenuRenameTemporary |
|
659 |
||
660 |
"Created: / 21-02-2008 / 09:15:08 / janfrog" |
|
661 |
! |
|
662 |
||
663 |
refactorMenuRenameLocalVariable |
|
664 |
||
665 |
self browser codeMenuRenameTemporary |
|
666 |
||
667 |
"Created: / 18-02-2008 / 21:21:26 / janfrog" |
|
668 |
"Modified: / 19-02-2008 / 09:59:11 / janfrog" |
|
669 |
! ! |
|
670 |
||
12405
76f9a872362b
Merged 3efd83b86c07 and 1206aff1f11 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
671 |
|
8775 | 672 |
!NewSystemBrowserCodeView methodsFor:'menu - double dispatch'! |
673 |
||
674 |
blueButtonMenuForMessageNode:messageNode |
|
675 |
^ self messageNodeContextMenu:messageNode |
|
676 |
||
677 |
"Created: / 18-02-2008 / 19:12:56 / janfrog" |
|
678 |
"Modified: / 18-02-2008 / 21:05:36 / janfrog" |
|
679 |
! |
|
680 |
||
681 |
blueButtonMenuForVariableNode: messageNode |
|
682 |
||
683 |
^self variableNodeMenuContext:messageNode |
|
684 |
||
685 |
"Created: / 18-02-2008 / 21:04:32 / janfrog" |
|
686 |
! |
|
687 |
||
10023 | 688 |
leftClickMenuForMessageNode: messageNode |
689 |
^ self messageNodeImplementorsMenu: messageNode |
|
690 |
||
691 |
"Modified: / 18-02-2008 / 21:05:47 / janfrog" |
|
692 |
! |
|
693 |
||
694 |
leftClickMenuForVariableNode: varNode |
|
10172
6e6165958f2c
changed: #leftClickMenuForVariableNode:
Claus Gittinger <cg@exept.de>
parents:
10042
diff
changeset
|
695 |
| environment classes | |
10023 | 696 |
|
697 |
self browser ifNil:[^nil]. |
|
698 |
environment := self browser theSingleSelectedMethod mclass environment. |
|
699 |
classes := OrderedCollection new. |
|
10172
6e6165958f2c
changed: #leftClickMenuForVariableNode:
Claus Gittinger <cg@exept.de>
parents:
10042
diff
changeset
|
700 |
[ environment notNil ] whileTrue:[ |
6e6165958f2c
changed: #leftClickMenuForVariableNode:
Claus Gittinger <cg@exept.de>
parents:
10042
diff
changeset
|
701 |
| cls | |
6e6165958f2c
changed: #leftClickMenuForVariableNode:
Claus Gittinger <cg@exept.de>
parents:
10042
diff
changeset
|
702 |
|
10023 | 703 |
cls := environment at: varNode name asSymbol. |
704 |
cls ifNotNil:[classes add: cls]. |
|
705 |
environment := |
|
10172
6e6165958f2c
changed: #leftClickMenuForVariableNode:
Claus Gittinger <cg@exept.de>
parents:
10042
diff
changeset
|
706 |
(environment == Smalltalk) |
10023 | 707 |
ifTrue:[environment := nil] |
10172
6e6165958f2c
changed: #leftClickMenuForVariableNode:
Claus Gittinger <cg@exept.de>
parents:
10042
diff
changeset
|
708 |
ifFalse:[environment environment] |
6e6165958f2c
changed: #leftClickMenuForVariableNode:
Claus Gittinger <cg@exept.de>
parents:
10042
diff
changeset
|
709 |
]. |
10023 | 710 |
^classes isEmpty |
711 |
ifTrue:[self browseClassesMenu: classes ] |
|
712 |
ifFalse:[self variableNodeMenuContext: varNode] |
|
713 |
||
714 |
"Modified: / 18-02-2008 / 21:05:47 / janfrog" |
|
715 |
"Created: / 01-09-2009 / 08:41:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
716 |
"Modified: / 01-09-2009 / 09:46:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10172
6e6165958f2c
changed: #leftClickMenuForVariableNode:
Claus Gittinger <cg@exept.de>
parents:
10042
diff
changeset
|
717 |
"Modified (format): / 05-07-2011 / 16:04:47 / cg" |
10023 | 718 |
! |
719 |
||
720 |
middleClickMenuForMessageNode: messageNode |
|
721 |
^ self messageNodeSendersMenu: messageNode |
|
722 |
||
723 |
"Created: / 18-02-2008 / 19:08:50 / janfrog" |
|
724 |
"Modified: / 18-02-2008 / 21:05:56 / janfrog" |
|
725 |
! |
|
726 |
||
8775 | 727 |
redButtonMenuForMessageNode:messageNode |
728 |
^ self messageNodeImplementorsMenu:messageNode |
|
729 |
||
730 |
"Modified: / 18-02-2008 / 21:05:47 / janfrog" |
|
731 |
! |
|
732 |
||
10023 | 733 |
rightClickMenuForMessageNode: messageNode |
734 |
^ self messageNodeContextMenu: messageNode |
|
735 |
||
736 |
"Created: / 18-02-2008 / 19:12:56 / janfrog" |
|
737 |
"Modified: / 18-02-2008 / 21:05:36 / janfrog" |
|
738 |
! |
|
739 |
||
740 |
rightClickMenuForVariableNode: variableNode |
|
741 |
^ self variableNodeMenuContext: variableNode |
|
742 |
||
743 |
"Created: / 18-02-2008 / 21:04:32 / janfrog" |
|
744 |
! |
|
745 |
||
8775 | 746 |
yellowButtonMenuForMessageNode:messageNode |
747 |
^ self messageNodeSendersMenu:messageNode |
|
748 |
||
749 |
"Created: / 18-02-2008 / 19:08:50 / janfrog" |
|
750 |
"Modified: / 18-02-2008 / 21:05:56 / janfrog" |
|
751 |
! ! |
|
752 |
||
12405
76f9a872362b
Merged 3efd83b86c07 and 1206aff1f11 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
753 |
|
8775 | 754 |
!NewSystemBrowserCodeView methodsFor:'private'! |
755 |
||
756 |
implementorsOf: selector |
|
757 |
||
758 |
selector ifNil:[^#()]. |
|
759 |
^SystemBrowser |
|
760 |
findImplementorsOf: selector |
|
761 |
in: Smalltalk allClasses |
|
762 |
ignoreCase: false |
|
763 |
||
764 |
"Created: / 26-12-2007 / 11:37:11 / janfrog" |
|
765 |
! |
|
766 |
||
767 |
sendersOf: selector |
|
768 |
||
769 |
^SystemBrowser |
|
770 |
findSendersOf: selector |
|
771 |
in: Smalltalk allClasses |
|
772 |
ignoreCase: false |
|
773 |
||
774 |
"Created: / 26-12-2007 / 11:37:22 / janfrog" |
|
775 |
! ! |
|
776 |
||
12405
76f9a872362b
Merged 3efd83b86c07 and 1206aff1f11 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
777 |
|
8775 | 778 |
!NewSystemBrowserCodeView methodsFor:'private - highlighting'! |
779 |
||
780 |
highlightClear |
|
10023 | 781 |
self list ifNil:[ ^ self ]. |
782 |
self list do:[:line | |
|
783 |
line isText ifTrue:[ |
|
784 |
line emphasisAllRemove:self selectorEmphasis |
|
785 |
] |
|
786 |
] |
|
8775 | 787 |
|
788 |
"Created: / 25-12-2007 / 23:26:27 / janfrog" |
|
789 |
"Modified: / 26-12-2007 / 12:28:05 / janfrog" |
|
790 |
! |
|
791 |
||
792 |
highlightFrom: start to: end |
|
793 |
"Remove underlined emphasis" |
|
794 |
||
795 |
|startLine startCol endLine endCol| |
|
796 |
||
797 |
startLine := self lineOfCharacterPosition:start. |
|
798 |
startCol := start - (self characterPositionOfLine:startLine col:1) + 1. |
|
799 |
endLine := self lineOfCharacterPosition:end. |
|
800 |
endCol := end - (self characterPositionOfLine:endLine col:1) + 1. |
|
801 |
self highlightFromLine: startLine col: startCol toLine: endLine col: endCol |
|
802 |
||
803 |
"Created: / 25-12-2007 / 22:56:28 / janfrog" |
|
804 |
! |
|
805 |
||
10023 | 806 |
highlightLine:lineNo fromLine:startLine col:endLine toLine:startCol col:endCol emphasis: em |
807 |
|line start end| |
|
8775 | 808 |
|
10023 | 809 |
(lineNo between:startLine and:endLine) ifFalse:[ |
810 |
^ self |
|
811 |
]. |
|
812 |
line := self listAt:lineNo. |
|
813 |
start := lineNo = startLine ifTrue:[ |
|
814 |
startCol |
|
815 |
] ifFalse:[ |
|
816 |
line indexOfFirstNonBlankCharacter |
|
817 |
]. |
|
818 |
end := lineNo = endLine ifTrue:[ |
|
819 |
endCol |
|
820 |
] ifFalse:[ line size ]. |
|
821 |
line |
|
822 |
emphasisFrom:start |
|
823 |
to:end |
|
824 |
add: em |
|
8775 | 825 |
|
10023 | 826 |
"Created: / 25-06-2010 / 13:59:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
8775 | 827 |
! |
828 |
||
829 |
highlightNode:node |
|
830 |
selectedNode == node ifTrue:[^ self]. |
|
831 |
selectedNode := node. |
|
832 |
selectedNode ifNil:[ ^ self highlightClear ]. |
|
833 |
selectedNode highlightInCodeView:self. |
|
834 |
||
835 |
"Created: / 19-02-2008 / 09:14:38 / janfrog" |
|
836 |
! |
|
837 |
||
838 |
highlightNodeAtCursor |
|
839 |
self highlightNodeAtLine:self cursorLine col:self cursorCol |
|
840 |
||
841 |
"Created: / 19-02-2008 / 09:14:46 / janfrog" |
|
842 |
! |
|
843 |
||
844 |
highlightNodeAtLine:line col:col |
|
845 |
|characterPosition node| |
|
846 |
||
847 |
(self parseTree isNil or:[ self parseTree = #error ]) ifTrue:[ |
|
848 |
^ self |
|
849 |
]. |
|
850 |
characterPosition := self characterPositionOfLine:line col:col. |
|
851 |
node := self findNodeForInterval: (characterPosition to:characterPosition). |
|
852 |
self highlightNode:node |
|
853 |
||
854 |
"Created: / 19-02-2008 / 09:14:58 / janfrog" |
|
855 |
! |
|
856 |
||
857 |
highlightNodeAtX:x y:y |
|
858 |
|visibleLine line col| |
|
859 |
||
860 |
(self parseTree isNil or:[ self parseTree = #error ]) ifTrue:[ |
|
861 |
^ self |
|
862 |
]. |
|
863 |
visibleLine := self visibleLineOfY:y. |
|
864 |
col := self colOfX:x inVisibleLine:visibleLine. |
|
865 |
line := self visibleLineToAbsoluteLine:visibleLine. |
|
866 |
self highlightNodeAtLine:line col:col |
|
867 |
||
868 |
"Created: / 19-02-2008 / 09:15:09 / janfrog" |
|
869 |
! |
|
870 |
||
871 |
highlightWithoutClearFrom: start to: end |
|
872 |
"Remove underlined emphasis" |
|
873 |
||
874 |
|startLine startCol endLine endCol| |
|
875 |
||
876 |
startLine := self lineOfCharacterPosition:start. |
|
877 |
startCol := start - (self characterPositionOfLine:startLine col:1) + 1. |
|
878 |
endLine := self lineOfCharacterPosition:end. |
|
879 |
endCol := end - (self characterPositionOfLine:endLine col:1) + 1. |
|
880 |
self highlightWithoutClearFromLine: startLine col: startCol toLine: endLine col: endCol |
|
881 |
||
882 |
"Created: / 25-12-2007 / 23:27:14 / janfrog" |
|
883 |
! |
|
884 |
||
885 |
highlightWithoutClearFromLine: startLine col: startCol toLine: endLine col: endCol |
|
886 |
||
887 |
self list keysAndValuesDo: |
|
888 |
[:lineNo :line| |
|
889 |
|start end| |
|
890 |
line isText ifTrue: |
|
891 |
[self highlightLine: lineNo fromLine: startLine col: endLine toLine: startCol col: endCol]]. |
|
892 |
||
893 |
"Created: / 25-12-2007 / 23:35:07 / janfrog" |
|
10023 | 894 |
! |
895 |
||
896 |
highlightWithoutClearFromLine: startLine col: startCol toLine: endLine col: endCol emphasis: em |
|
897 |
||
898 |
self list keysAndValuesDo: |
|
899 |
[:lineNo :line| |
|
900 |
|start end| |
|
901 |
line isText ifTrue: |
|
902 |
[self highlightLine: lineNo fromLine: startLine col: endLine toLine: startCol col: endCol emphasis: em]]. |
|
903 |
||
904 |
"Created: / 25-06-2010 / 13:58:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
905 |
! |
|
906 |
||
907 |
selectorEmphasis |
|
908 |
^ highlightEmphasis |
|
909 |
ifNil:[ highlightEmphasis := Array with:#underline with:#bold ] |
|
910 |
||
911 |
"Created: / 25-12-2007 / 22:57:23 / janfrog" |
|
912 |
"Modified: / 26-12-2007 / 11:16:14 / janfrog" |
|
913 |
"Modified: / 01-09-2009 / 22:29:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
8775 | 914 |
! ! |
915 |
||
12405
76f9a872362b
Merged 3efd83b86c07 and 1206aff1f11 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
916 |
|
8775 | 917 |
!NewSystemBrowserCodeView methodsFor:'private - highlighting - nodes'! |
918 |
||
919 |
highlightLiteralNode: node |
|
920 |
||
921 |
node value isSymbol ifTrue: |
|
922 |
[self highlightFrom: node start to: node stop] |
|
923 |
||
924 |
"Created: / 26-12-2007 / 10:19:08 / janfrog" |
|
925 |
! |
|
926 |
||
927 |
highlightMessageNode: node |
|
928 |
||
929 |
self highlightClear. |
|
930 |
node selectorParts do: |
|
931 |
[:part|self highlightWithoutClearFrom: part start to: part stop] |
|
932 |
||
933 |
"Created: / 25-12-2007 / 23:41:36 / janfrog" |
|
934 |
! |
|
935 |
||
936 |
highlightVariableNode: node |
|
937 |
(#('self' 'super' 'here' 'thisContext') includes:node name) ifTrue:[^self]. |
|
938 |
^ self highlightFrom: node start to: node stop |
|
939 |
||
940 |
"Created: / 25-12-2007 / 23:45:42 / janfrog" |
|
941 |
"Modified: / 18-02-2008 / 20:51:51 / janfrog" |
|
942 |
! ! |
|
943 |
||
12405
76f9a872362b
Merged 3efd83b86c07 and 1206aff1f11 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
944 |
|
8775 | 945 |
!NewSystemBrowserCodeView methodsFor:'private - parsing'! |
946 |
||
947 |
parseTree |
|
948 |
||
949 |
^ parseTree |
|
950 |
||
951 |
"Created: / 19-02-2008 / 09:20:03 / janfrog" |
|
952 |
"Modified: / 19-10-2008 / 07:36:36 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
953 |
! |
|
954 |
||
955 |
parseTree:something |
|
956 |
parseTree := something. |
|
957 |
||
958 |
"Created: / 19-10-2008 / 07:39:15 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
959 |
! |
|
960 |
||
961 |
parseTree:something sequenceNumber: givenSeqNum |
|
962 |
||
963 |
givenSeqNum < seqNum ifFalse: |
|
964 |
[parseTree := something]. |
|
965 |
||
966 |
"Created: / 12-03-2009 / 16:29:11 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
967 |
! |
|
968 |
||
969 |
startParsingProcess |
|
970 |
|prio contents| |
|
971 |
||
972 |
seqNum := ((seqNum ? 0) + 1). |
|
973 |
parsingProcess |
|
974 |
ifNotNil:[ |
|
975 |
parsingProcessRunning ~~ true ifTrue:[ |
|
976 |
^ self |
|
977 |
]. |
|
978 |
self stopParsingProcess |
|
979 |
]. |
|
980 |
prio := Processor userBackgroundPriority - 1. |
|
981 |
self shown ifFalse:[ |
|
982 |
prio := prio - 1 max:1 |
|
983 |
]. |
|
984 |
contents := self contents. |
|
985 |
parsingProcess := [ |
|
986 |
[ |
|
987 |
| tree | |
|
10463 | 988 |
tree := ((contents isEmptyOrNil) |
8775 | 989 |
ifTrue:[ nil ] |
990 |
ifFalse:[ RBParser parseMethod:contents onError:[:err :pos | #error ] ]). |
|
991 |
self sensor |
|
992 |
pushUserEvent:#parseTree:sequenceNumber: |
|
993 |
for: self |
|
994 |
withArguments: |
|
995 |
(Array with: tree with: seqNum) |
|
996 |
] ensure:[ |
|
997 |
parsingProcessRunning := false. |
|
998 |
parsingProcess := nil. |
|
999 |
] |
|
1000 |
] forkAt:prio |
|
1001 |
||
1002 |
"Modified: / 19-02-2008 / 09:22:57 / janfrog" |
|
1003 |
"Created: / 21-08-2009 / 15:40:06 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
1004 |
"Modified: / 22-08-2009 / 11:51:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10463 | 1005 |
"Modified: / 04-08-2011 / 19:05:45 / cg" |
8775 | 1006 |
! |
1007 |
||
1008 |
stopParsingProcess |
|
1009 |
|p| |
|
1010 |
||
1011 |
(p := parsingProcess) notNil ifTrue:[ |
|
1012 |
parsingProcess := nil. |
|
1013 |
p terminate. |
|
1014 |
"/ raise its prio to make it terminate quickly |
|
1015 |
p priority:(Processor userSchedulingPriority + 1) |
|
1016 |
] |
|
1017 |
||
1018 |
"Created: / 25-12-2007 / 21:16:03 / janfrog" |
|
1019 |
! ! |
|
1020 |
||
12405
76f9a872362b
Merged 3efd83b86c07 and 1206aff1f11 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1021 |
|
8775 | 1022 |
!NewSystemBrowserCodeView methodsFor:'private - testing'! |
1023 |
||
1024 |
isInstanceVariableNode: node |
|
1025 |
||
1026 |
||
1027 |
node isVariable ifFalse:[^false]. |
|
1028 |
^(self selectedClass allInstVarNames includes:(node name)) |
|
1029 |
||
1030 |
"Created: / 21-02-2008 / 09:39:10 / janfrog" |
|
1031 |
! |
|
1032 |
||
1033 |
isLocalVariableNode: node |
|
1034 |
||
1035 |
||
1036 |
(self parseTree arguments includes: node) ifTrue:[^true]. |
|
1037 |
(self parseTree body temporaries includes: node) ifTrue:[^true]. |
|
1038 |
^false |
|
1039 |
||
1040 |
"Created: / 21-02-2008 / 09:32:33 / janfrog" |
|
1041 |
! ! |
|
1042 |
||
12405
76f9a872362b
Merged 3efd83b86c07 and 1206aff1f11 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1043 |
|
8775 | 1044 |
!NewSystemBrowserCodeView class methodsFor:'documentation'! |
1045 |
||
8806 | 1046 |
version_CVS |
12355
fbe8bf441be4
class: Tools::NewSystemBrowserCodeView
Claus Gittinger <cg@exept.de>
parents:
12104
diff
changeset
|
1047 |
^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowserCodeView.st,v 1.13 2013-01-30 17:56:09 cg Exp $' |
10023 | 1048 |
! |
1049 |
||
1050 |
version_SVN |
|
1051 |
^ '§Id: Tools__NewSystemBrowserCodeView.st 7486 2009-10-26 22:06:24Z vranyj1 §' |
|
8775 | 1052 |
! ! |
1053 |
||
12104
ef5283010b5f
class: Tools::NewSystemBrowserCodeView
Claus Gittinger <cg@exept.de>
parents:
11790
diff
changeset
|
1054 |
|
8775 | 1055 |
NewSystemBrowserCodeView initialize! |