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