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