author | Claus Gittinger <cg@exept.de> |
Fri, 17 Apr 1998 21:00:31 +0200 | |
changeset 1555 | 756ab2711237 |
parent 1496 | 978b3c3565c9 |
child 1566 | 7a4ef80fb49b |
permissions | -rw-r--r-- |
0 | 1 |
" |
4 | 2 |
COPYRIGHT (c) 1990 by Claus Gittinger |
45 | 3 |
All Rights Reserved |
0 | 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 |
||
13 |
StandardSystemView subclass:#ChangesBrowser |
|
275
604a906c0eb7
better handling of changes for autoloaded classes
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
14 |
instanceVariableNames:'changeListView codeView changeFileName changeChunks |
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
15 |
changePositions changeClassNames changeHeaderLines |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
16 |
changeIsFollowupMethodChange anyChanges changeNrShown |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
17 |
changeNrProcessed skipSignal compareChanges compareCheckBox |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
18 |
changeFileSize changeFileTimestamp checkBlock changeTimeStamps |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
19 |
tabSpec autoUpdate editingClassSource' |
275
604a906c0eb7
better handling of changes for autoloaded classes
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
20 |
classVariableNames:'CompressSnapshotInfo' |
604a906c0eb7
better handling of changes for autoloaded classes
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
21 |
poolDictionaries:'' |
604a906c0eb7
better handling of changes for autoloaded classes
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
22 |
category:'Interface-Browsers' |
0 | 23 |
! |
24 |
||
761 | 25 |
!ChangesBrowser class methodsFor:'documentation'! |
29 | 26 |
|
27 |
copyright |
|
28 |
" |
|
29 |
COPYRIGHT (c) 1990 by Claus Gittinger |
|
45 | 30 |
All Rights Reserved |
0 | 31 |
|
29 | 32 |
This software is furnished under a license and may be used |
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
! |
|
40 |
||
41 |
documentation |
|
42 |
" |
|
43 |
this implements a browser for the changes-file. |
|
44 |
See the extra document 'doc/misc/cbrowser.doc' for how to use this browser. |
|
45 |
||
46 |
written jan 90 by claus |
|
51 | 47 |
|
508 | 48 |
[Class variables:] |
1378 | 49 |
CompressSnapshotInfo if true (the default), snapshot entries |
50 |
are also compressed in the compress function. |
|
51 |
Some users prefer them to be not compressed. |
|
52 |
Set it to false for this. |
|
58 | 53 |
|
51 | 54 |
Notice: |
1378 | 55 |
this needs a total rewrite, to build up a changeSet from the file |
56 |
(which did not exist when the ChangesBrowser was originally written) |
|
57 |
and manipulate that changeSet. |
|
58 |
||
59 |
This way, we get a browser for any upcoming incore changeSets for |
|
60 |
free. Also, this will put the chunk analyzation code into Change and |
|
61 |
subclasses (where it belongs) and give a better encapsulation and |
|
62 |
overall structure. Do not take this as an example for good style ;-) |
|
508 | 63 |
|
64 |
[author:] |
|
1378 | 65 |
Claus Gittinger |
508 | 66 |
|
67 |
[start with:] |
|
1378 | 68 |
ChangesBrowser open |
1359 | 69 |
|
70 |
[see also:] |
|
1378 | 71 |
( Using the ChangesBrowser :html: tools/cbrowser/TOP.html ) |
1359 | 72 |
|
29 | 73 |
" |
74 |
! ! |
|
0 | 75 |
|
761 | 76 |
!ChangesBrowser class methodsFor:'instance creation'! |
45 | 77 |
|
78 |
new |
|
79 |
"create a new changes browser" |
|
80 |
||
1470 | 81 |
^ super |
82 |
label:(self defaultLabel) |
|
83 |
icon:(self defaultIcon) |
|
84 |
||
85 |
"Modified: / 6.2.1998 / 13:25:18 / cg" |
|
45 | 86 |
! |
87 |
||
88 |
openOn:aFileName |
|
89 |
"create c changes browser on a change file" |
|
90 |
||
1470 | 91 |
^ ((self new label:(self defaultLabel , ': ', aFileName)) |
92 |
changeFileName:aFileName) open |
|
93 |
||
94 |
"Modified: / 6.2.1998 / 13:27:19 / cg" |
|
45 | 95 |
! ! |
96 |
||
761 | 97 |
!ChangesBrowser class methodsFor:'behavior'! |
0 | 98 |
|
99 |
autoSelectNext |
|
100 |
"returning true here, makes a Delete operation automatically |
|
101 |
select the next change" |
|
102 |
||
103 |
^ true |
|
104 |
! ! |
|
105 |
||
761 | 106 |
!ChangesBrowser class methodsFor:'defaults'! |
0 | 107 |
|
489 | 108 |
defaultIcon |
1153 | 109 |
"return the browsers default window icon" |
110 |
||
111 |
<resource: #style (#ICON #ICON_FILE)> |
|
112 |
||
113 |
|nm i| |
|
114 |
||
115 |
(i := DefaultIcon) isNil ifTrue:[ |
|
1378 | 116 |
i := self classResources at:'ICON' default:nil. |
117 |
i isNil ifTrue:[ |
|
118 |
nm := ClassResources at:'ICON_FILE' default:'CBrowser.xbm'. |
|
119 |
i := Image fromFile:nm resolution:100. |
|
120 |
i isNil ifTrue:[ |
|
121 |
i := Image fromFile:('bitmaps/' , nm) resolution:100. |
|
122 |
i isNil ifTrue:[ |
|
123 |
i := StandardSystemView defaultIcon |
|
124 |
] |
|
125 |
] |
|
126 |
]. |
|
127 |
i notNil ifTrue:[ |
|
128 |
DefaultIcon := i := i on:Display |
|
129 |
] |
|
1084 | 130 |
]. |
131 |
^ i |
|
132 |
||
1153 | 133 |
"Modified: 19.3.1997 / 20:48:34 / ca" |
134 |
"Modified: 18.4.1997 / 15:16:24 / cg" |
|
489 | 135 |
! |
136 |
||
73 | 137 |
defaultLabel |
138 |
^ 'Changes Browser' |
|
28 | 139 |
! ! |
140 |
||
202 | 141 |
!ChangesBrowser methodsFor:'compiler interface'! |
142 |
||
143 |
wantChangeLog |
|
144 |
"sent by the compiler to ask if a changeLog entry should |
|
145 |
be written. Return false here." |
|
146 |
||
147 |
^ false |
|
148 |
! ! |
|
149 |
||
150 |
!ChangesBrowser methodsFor:'error handling'! |
|
151 |
||
152 |
correctableError:aString position:relPos to:relEndPos from:aCompiler |
|
153 |
"compiler notifys us of an error - this should really not happen since |
|
154 |
changes ought to be correct (did someone edit the changes file ??). |
|
155 |
Show the bad change in the codeView and let codeView hilight the error; |
|
156 |
no corrections allowed here therefore return false" |
|
157 |
||
158 |
self error:aString position:relPos to:relEndPos from:aCompiler. |
|
159 |
^ false |
|
160 |
! |
|
161 |
||
162 |
error:aString position:relPos to:relEndPos from:aCompiler |
|
163 |
"compiler notifys us of an error - this should really not happen since |
|
164 |
changes ought to be correct (did someone edit the changes file ??). |
|
165 |
Show the bad change in the codeView and let codeView hilight the error" |
|
166 |
||
167 |
|action| |
|
168 |
||
169 |
(changeNrProcessed ~~ changeNrShown) ifTrue:[ |
|
1378 | 170 |
self changeSelection:changeNrProcessed |
202 | 171 |
]. |
172 |
(skipSignal notNil) ifTrue:[ |
|
173 |
||
1378 | 174 |
codeView highlightingErrorPosition:relPos to:relEndPos do:[ |
175 |
|box| |
|
176 |
||
177 |
" |
|
178 |
start dialog - make certain cleanup is done |
|
179 |
" |
|
180 |
action := OptionBox |
|
181 |
request:aString |
|
182 |
label:'Error' |
|
183 |
form:(WarningBox iconBitmap) |
|
184 |
buttonLabels:#('cancel' 'skip' 'continue') |
|
185 |
values:#(#abort #skip #continue) |
|
186 |
default:#continue. |
|
187 |
]. |
|
188 |
||
189 |
action == #abort ifTrue:[ |
|
190 |
Object abortSignal raise. |
|
191 |
^ false |
|
192 |
]. |
|
193 |
action == #skip ifTrue:[ |
|
194 |
skipSignal raise. |
|
195 |
^ false |
|
196 |
]. |
|
197 |
^ false |
|
202 | 198 |
]. |
199 |
^ codeView error:aString position:relPos to:relEndPos from:aCompiler |
|
373 | 200 |
|
201 |
"Modified: 20.2.1996 / 20:47:59 / cg" |
|
202 | 202 |
! |
203 |
||
204 |
warning:aString position:relPos to:relEndPos from:aCompiler |
|
205 |
"compiler notifys us of a warning - ignore it" |
|
206 |
||
207 |
^ self |
|
208 |
! ! |
|
209 |
||
210 |
!ChangesBrowser methodsFor:'event handling '! |
|
211 |
||
212 |
handlesKeyPress:key inView:view |
|
213 |
"this method is reached via delegation: are we prepared to handle |
|
214 |
a keyPress in some other view ?" |
|
215 |
||
1127 | 216 |
<resource: #keyboard (#Delete #BackSpace #Accept #Find #FindPrev #FindNext)> |
417
c80a8acf429c
show shortkeys in changeList view
Claus Gittinger <cg@exept.de>
parents:
394
diff
changeset
|
217 |
|
202 | 218 |
view == changeListView ifTrue:[ |
1378 | 219 |
(key == #Delete |
220 |
or:[key == #BackSpace |
|
221 |
or:[key == #Accept |
|
222 |
or:[key == #Find |
|
223 |
or:[key == #FindPrev |
|
224 |
or:[key == #FindNext]]]]]) ifTrue:[^ true]. |
|
202 | 225 |
]. |
226 |
^ false |
|
417
c80a8acf429c
show shortkeys in changeList view
Claus Gittinger <cg@exept.de>
parents:
394
diff
changeset
|
227 |
|
1127 | 228 |
"Modified: 8.4.1997 / 11:01:42 / cg" |
0 | 229 |
! |
230 |
||
202 | 231 |
keyPress:key x:x y:y view:view |
232 |
"this method is reached via delegation from the changeListView" |
|
233 |
||
1127 | 234 |
<resource: #keyboard (#Delete #BackSpace #Accept #Find #FindPrev #FindNext)> |
417
c80a8acf429c
show shortkeys in changeList view
Claus Gittinger <cg@exept.de>
parents:
394
diff
changeset
|
235 |
|
202 | 236 |
(key == #Delete or:[key == #BackSpace]) ifTrue:[ |
1378 | 237 |
self doDelete. |
238 |
^ self |
|
417
c80a8acf429c
show shortkeys in changeList view
Claus Gittinger <cg@exept.de>
parents:
394
diff
changeset
|
239 |
]. |
c80a8acf429c
show shortkeys in changeList view
Claus Gittinger <cg@exept.de>
parents:
394
diff
changeset
|
240 |
(key == #Accept) ifTrue:[ |
1378 | 241 |
self doApply. |
242 |
^ self |
|
202 | 243 |
]. |
1127 | 244 |
(key == #Find) ifTrue:[ |
1378 | 245 |
self findClass. |
246 |
^ self |
|
1127 | 247 |
]. |
975
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
248 |
(key == #FindPrev) ifTrue:[ |
1378 | 249 |
self findPreviousForClass. |
250 |
^ self |
|
975
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
251 |
]. |
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
252 |
(key == #FindNext) ifTrue:[ |
1378 | 253 |
self findNextForClass. |
254 |
^ self |
|
975
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
255 |
]. |
202 | 256 |
changeListView keyPress:key x:x y:y |
417
c80a8acf429c
show shortkeys in changeList view
Claus Gittinger <cg@exept.de>
parents:
394
diff
changeset
|
257 |
|
1127 | 258 |
"Modified: 8.4.1997 / 11:01:38 / cg" |
202 | 259 |
! ! |
260 |
||
261 |
!ChangesBrowser methodsFor:'help '! |
|
262 |
||
263 |
helpTextFor:aComponent |
|
264 |
|s| |
|
265 |
||
266 |
aComponent == codeView ifTrue:[ |
|
267 |
s := 'HELP_CODEVIEW' |
|
268 |
]. |
|
269 |
aComponent == changeListView ifTrue:[ |
|
270 |
s := 'HELP_CHANGELIST' |
|
271 |
]. |
|
272 |
((aComponent == compareCheckBox) |
|
273 |
or:[aComponent superView == compareCheckBox]) ifTrue:[ |
|
274 |
s := 'HELP_CHECK_COMPARE' |
|
275 |
]. |
|
276 |
s notNil ifTrue:[ |
|
277 |
^ resources string:s |
|
278 |
]. |
|
279 |
^ nil |
|
394 | 280 |
! |
281 |
||
282 |
showActivity:someMessage |
|
502 | 283 |
"some activityNotification to be forwarded to the user; |
284 |
show it in the windows title area here." |
|
285 |
||
394 | 286 |
self label:someMessage |
287 |
||
288 |
"Created: 24.2.1996 / 19:35:42 / cg" |
|
502 | 289 |
"Modified: 23.4.1996 / 21:39:36 / cg" |
202 | 290 |
! ! |
291 |
||
292 |
!ChangesBrowser methodsFor:'initialize / release'! |
|
293 |
||
294 |
changeListMenu |
|
586 | 295 |
<resource: #keyboard ( #Accept #Delete ) > |
1359 | 296 |
<resource: #programMenu > |
586 | 297 |
|
417
c80a8acf429c
show shortkeys in changeList view
Claus Gittinger <cg@exept.de>
parents:
394
diff
changeset
|
298 |
|labels selectors shorties m| |
202 | 299 |
|
255 | 300 |
labels := #( |
1378 | 301 |
'apply' |
302 |
'apply to end' |
|
303 |
'apply for class to end' |
|
304 |
'apply all' |
|
305 |
'-' |
|
306 |
'delete' |
|
307 |
'delete to end' |
|
308 |
'delete for class to end' |
|
309 |
'delete for class from begin' |
|
310 |
'delete all for class' |
|
311 |
'-' |
|
312 |
'update view' |
|
313 |
'compress' |
|
314 |
'compress for class' |
|
315 |
'compare with current version' |
|
316 |
'browse' |
|
317 |
'-' |
|
318 |
'make change a patch'). |
|
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
319 |
|
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
320 |
editingClassSource ifFalse:[ |
1378 | 321 |
labels := labels , #('fileout & delete all for class') |
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
322 |
]. |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
323 |
|
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
324 |
labels := labels , #( |
1378 | 325 |
'-' |
326 |
'save in ...' |
|
327 |
'save to end in ...' |
|
328 |
'save for class to end in ...' |
|
329 |
'save all for class in ...' |
|
330 |
'-'). |
|
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
331 |
|
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
332 |
editingClassSource ifTrue:[ |
1378 | 333 |
labels := labels , #('writeback classFile') |
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
334 |
] ifFalse:[ |
1378 | 335 |
labels := labels , #('writeback changeFile') |
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
336 |
]. |
221 | 337 |
|
255 | 338 |
selectors := #( |
1378 | 339 |
doApply |
340 |
doApplyRest |
|
341 |
doApplyClassRest |
|
342 |
doApplyAll |
|
343 |
nil |
|
344 |
doDelete |
|
345 |
doDeleteRest |
|
346 |
doDeleteClassRest |
|
347 |
doDeleteClassFromBeginning |
|
348 |
doDeleteClassAll |
|
349 |
nil |
|
350 |
doUpdate |
|
351 |
doCompress |
|
352 |
doCompressClass |
|
353 |
doCompare |
|
354 |
doBrowse |
|
355 |
nil |
|
356 |
doMakePatch). |
|
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
357 |
|
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
358 |
editingClassSource ifFalse:[ |
1378 | 359 |
selectors := selectors , #(doFileoutAndDeleteClassAll) |
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
360 |
]. |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
361 |
|
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
362 |
selectors := selectors , #( |
1378 | 363 |
nil |
364 |
doSave |
|
365 |
doSaveRest |
|
366 |
doSaveClassRest |
|
367 |
doSaveClassAll |
|
368 |
nil |
|
369 |
doWriteBack |
|
370 |
). |
|
202 | 371 |
|
417
c80a8acf429c
show shortkeys in changeList view
Claus Gittinger <cg@exept.de>
parents:
394
diff
changeset
|
372 |
shorties := #( |
1378 | 373 |
Accept |
374 |
nil |
|
375 |
nil |
|
376 |
nil |
|
377 |
nil |
|
378 |
Delete |
|
379 |
nil |
|
380 |
nil |
|
381 |
nil |
|
382 |
nil |
|
383 |
nil |
|
384 |
nil |
|
385 |
nil |
|
386 |
nil |
|
387 |
nil |
|
388 |
nil |
|
389 |
nil |
|
390 |
nil |
|
391 |
nil |
|
392 |
nil |
|
393 |
nil |
|
394 |
nil |
|
395 |
nil |
|
396 |
nil |
|
397 |
nil |
|
398 |
nil |
|
399 |
). |
|
417
c80a8acf429c
show shortkeys in changeList view
Claus Gittinger <cg@exept.de>
parents:
394
diff
changeset
|
400 |
|
202 | 401 |
m := PopUpMenu |
1378 | 402 |
labels:(resources array:labels) |
403 |
selectors:selectors |
|
404 |
accelerators:shorties. |
|
202 | 405 |
|
255 | 406 |
"/ |
407 |
"/ disable those that require a selected entry |
|
408 |
"/ |
|
202 | 409 |
changeListView hasSelection ifFalse:[ |
1378 | 410 |
m disableAll:#(doApply doApplyClassRest doApplyRest doDelete doDeleteRest doDeleteClassRest |
411 |
doDeleteClassFromBeginning doDeleteClassAll |
|
412 |
doCompare doCompressClass doMakePatch doSaveChangeInFile doMakePermanent |
|
413 |
doSave doSaveRest doSaveClassAll doSaveClassRest doBrowse doFileoutAndDeleteClassAll) |
|
1368 | 414 |
] ifTrue:[ |
1378 | 415 |
(self classNameOfChange:(changeListView selection)) isNil ifTrue:[ |
416 |
m disableAll:#(doApplyClassRest doDeleteClassRest |
|
417 |
doDeleteClassFromBeginning doDeleteClassAll |
|
418 |
doCompressClass |
|
419 |
doSaveClassAll doSaveClassRest doBrowse doFileoutAndDeleteClassAll) |
|
420 |
] |
|
255 | 421 |
]. |
422 |
||
423 |
"/ |
|
424 |
"/ disable those that do not make sense with autoUpdate |
|
425 |
"/ ('cause this would be overwritten by next update operation) |
|
426 |
"/ |
|
427 |
||
428 |
autoUpdate ifTrue:[ |
|
1378 | 429 |
m disableAll:#(doDelete doDeleteRest doDeleteClassRest doDeleteClassAll doCompress |
430 |
doFileoutAndDeleteClassAll doWriteBack) |
|
202 | 431 |
]. |
432 |
^ m |
|
433 |
||
1359 | 434 |
"Modified: / 6.9.1995 / 17:14:22 / claus" |
1368 | 435 |
"Modified: / 30.10.1997 / 22:25:00 / cg" |
202 | 436 |
! |
437 |
||
438 |
compare:aBoolean |
|
439 |
"sent from the compare-toggle" |
|
73 | 440 |
|
202 | 441 |
aBoolean ~~ compareChanges ifTrue:[ |
1378 | 442 |
compareChanges := aBoolean. |
443 |
compareChanges ifTrue:[ |
|
444 |
tabSpec positions:#(0 0.15 5 8.5 ). |
|
445 |
self doUpdate |
|
446 |
] ifFalse:[ |
|
447 |
"/ |
|
448 |
"/ set tabs to hide compare-column |
|
449 |
"/ |
|
450 |
tabSpec positions:#(-1 0 5 8.5 ). |
|
451 |
changeListView invalidate. "/ clear; redraw. |
|
452 |
] |
|
202 | 453 |
] |
454 |
||
584
3f49ec1318ef
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
577
diff
changeset
|
455 |
"Modified: 29.5.1996 / 16:12:19 / cg" |
202 | 456 |
! |
457 |
||
458 |
focusSequence |
|
459 |
^ Array with:changeListView with:codeView |
|
460 |
! |
|
461 |
||
462 |
initialize |
|
221 | 463 |
|panel v upperFrame buttonPanel autoUpdateCheckBox| |
202 | 464 |
|
465 |
super initialize. |
|
466 |
||
467 |
changeFileName := ObjectMemory nameForChanges. "/ 'changes'. |
|
468 |
compareChanges := false. |
|
221 | 469 |
autoUpdate := false. |
470 |
||
1099
b0a4e8ccc5cc
Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents:
1090
diff
changeset
|
471 |
" |
b0a4e8ccc5cc
Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents:
1090
diff
changeset
|
472 |
checkBlock is executed by the Processor. |
b0a4e8ccc5cc
Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents:
1090
diff
changeset
|
473 |
We use #pushEvent: to perform the update |
b0a4e8ccc5cc
Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents:
1090
diff
changeset
|
474 |
in our windowgroups process. |
b0a4e8ccc5cc
Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents:
1090
diff
changeset
|
475 |
" |
b0a4e8ccc5cc
Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents:
1090
diff
changeset
|
476 |
checkBlock := [self pushEvent:#checkIfFileHasChanged]. |
202 | 477 |
|
478 |
panel := VariableVerticalPanel origin:(0.0 @ 0.0) |
|
1471 | 479 |
corner:(1.0 @ 1.0) |
480 |
borderWidth:0 |
|
481 |
in:self. |
|
202 | 482 |
|
483 |
upperFrame := View origin:(0.0 @ 0.0) corner:(1.0 @ 0.3) in:panel. |
|
484 |
||
485 |
v := HVScrollableView for:SelectionInListView miniScrollerH:true in:upperFrame. |
|
486 |
v origin:(0.0 @ 0.0) corner:(0.8 @ 1.0). |
|
487 |
changeListView := v scrolledView. |
|
488 |
changeListView delegate:self. |
|
489 |
changeListView menuHolder:self; menuPerformer:self; menuMessage:#changeListMenu. |
|
1471 | 490 |
changeListView doubleClickAction:[:line | self doubleClickOnChange:line]. |
202 | 491 |
|
492 |
buttonPanel := VerticalPanelView in:upperFrame. |
|
493 |
buttonPanel origin:(0.8 @ 0.0) corner:(1.0 @ 1.0). |
|
221 | 494 |
buttonPanel verticalLayout:#topSpace; horizontalLayout:#leftSpace. |
202 | 495 |
|
496 |
compareCheckBox := CheckBox new. |
|
497 |
compareCheckBox label:(resources string:'compare'). |
|
498 |
compareCheckBox action:[:val | self compare:val]. |
|
499 |
buttonPanel addSubView:compareCheckBox. |
|
500 |
||
221 | 501 |
autoUpdateCheckBox := CheckBox new. |
502 |
autoUpdateCheckBox label:(resources string:'auto update'). |
|
503 |
autoUpdateCheckBox action:[:val | self autoUpdate:val]. |
|
504 |
buttonPanel addSubView:autoUpdateCheckBox. |
|
505 |
||
202 | 506 |
v := HVScrollableView for:CodeView miniScrollerH:true miniScrollerV:false in:panel. |
507 |
v origin:(0.0 @ 0.3) corner:(1.0 @ 1.0). |
|
508 |
codeView := v scrolledView. |
|
509 |
codeView readOnly. |
|
510 |
||
511 |
anyChanges := false. |
|
512 |
ObjectMemory addDependent:self. "to get shutdown-update" |
|
513 |
||
514 |
tabSpec := TabulatorSpecification new. |
|
515 |
tabSpec unit:#inch. |
|
516 |
tabSpec positions:#(-1 0 5 8.5 ). |
|
517 |
" +/- cls>>sel type info" |
|
518 |
tabSpec align: #(#left #left #left #left). |
|
519 |
||
1471 | 520 |
"Modified: / 27.3.1997 / 11:07:07 / stefan" |
521 |
"Modified: / 6.2.1998 / 13:08:16 / cg" |
|
202 | 522 |
! |
523 |
||
1246
9ed3722bd2f2
setup in #postRealize instead of #realize
Claus Gittinger <cg@exept.de>
parents:
1200
diff
changeset
|
524 |
postRealize |
202 | 525 |
self readChangesFileInBackground:true. |
526 |
self setChangeList. |
|
527 |
changeListView action:[:lineNr | self changeSelection:lineNr]. |
|
528 |
Processor addTimedBlock:checkBlock afterSeconds:5. |
|
1246
9ed3722bd2f2
setup in #postRealize instead of #realize
Claus Gittinger <cg@exept.de>
parents:
1200
diff
changeset
|
529 |
|
9ed3722bd2f2
setup in #postRealize instead of #realize
Claus Gittinger <cg@exept.de>
parents:
1200
diff
changeset
|
530 |
"Created: 24.7.1997 / 18:06:12 / cg" |
202 | 531 |
! |
532 |
||
627 | 533 |
update:what with:aParameter from:changedObject |
202 | 534 |
|box| |
535 |
||
536 |
(what == #aboutToExit) ifTrue:[ |
|
1378 | 537 |
" |
538 |
smalltalk is about to shut down - |
|
539 |
- if change list was modified, ask user and save if requested. |
|
540 |
" |
|
541 |
anyChanges ifTrue:[ |
|
542 |
self raiseDeiconified. |
|
543 |
||
544 |
box := YesNoBox new. |
|
545 |
box title:(resources at:'changefile has not been updated from the modified changelist.\\Update before exiting ?') withCRs. |
|
546 |
box okText:(resources at:'update') noText:(resources at:'don''t update'). |
|
547 |
box yesAction:[self writeBackChanges] |
|
548 |
noAction:[]. |
|
549 |
box showAtPointer. |
|
550 |
box destroy |
|
551 |
]. |
|
552 |
^ self |
|
202 | 553 |
]. |
554 |
super update:what |
|
627 | 555 |
|
556 |
"Created: 15.6.1996 / 15:26:30 / cg" |
|
917 | 557 |
"Modified: 7.1.1997 / 23:03:47 / cg" |
202 | 558 |
! ! |
559 |
||
560 |
!ChangesBrowser methodsFor:'private'! |
|
561 |
||
562 |
appendChange:changeNr toFile:fileName |
|
563 |
"append change to a file. return true if ok." |
|
564 |
||
565 |
|aStream outStream chunk sawExcla separator| |
|
566 |
||
567 |
outStream := FileStream oldFileNamed:fileName. |
|
568 |
outStream isNil ifTrue:[ |
|
1472 | 569 |
outStream isNil ifTrue:[ |
570 |
outStream := FileStream newFileNamed:fileName. |
|
571 |
outStream isNil ifTrue:[ |
|
572 |
self warn:'cannot update file ''%1''' with:fileName. |
|
573 |
^ false |
|
574 |
] |
|
575 |
] |
|
73 | 576 |
]. |
202 | 577 |
|
578 |
outStream setToEnd. |
|
579 |
||
580 |
aStream := self streamForChange:changeNr. |
|
581 |
aStream isNil ifTrue:[ |
|
1472 | 582 |
self warn:'oops cannot read change'. |
583 |
^ false |
|
202 | 584 |
]. |
73 | 585 |
|
202 | 586 |
separator := aStream class chunkSeparator. |
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
587 |
|
1472 | 588 |
(self changeIsFollowupMethodChange:changeNr) ifTrue:[ |
589 |
sawExcla := true. |
|
590 |
chunk := changeChunks at:changeNr |
|
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
591 |
] ifFalse:[ |
1472 | 592 |
sawExcla := aStream peekFor:separator. |
593 |
chunk := aStream nextChunk. |
|
202 | 594 |
]. |
595 |
sawExcla ifTrue:[ |
|
1472 | 596 |
outStream nextPut:separator |
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
597 |
]. |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
598 |
outStream nextChunkPut:chunk; cr. |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
599 |
sawExcla ifTrue:[ |
1472 | 600 |
chunk := aStream nextChunk. |
601 |
outStream nextChunkPut:chunk; space |
|
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
602 |
]. |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
603 |
sawExcla ifTrue:[ |
1472 | 604 |
outStream nextPut:separator |
202 | 605 |
]. |
606 |
outStream cr. |
|
607 |
aStream close. |
|
608 |
outStream close. |
|
609 |
^ true |
|
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
610 |
|
1472 | 611 |
"Modified: / 6.2.1998 / 13:03:54 / cg" |
73 | 612 |
! |
613 |
||
51 | 614 |
applyChange:changeNr |
615 |
"fileIn a change" |
|
616 |
||
358
a7546792f073
update changeFile if applying changes from another changeFile
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
617 |
|aStream nm applyAction| |
45 | 618 |
|
51 | 619 |
aStream := self streamForChange:changeNr. |
620 |
aStream isNil ifTrue:[^ self]. |
|
621 |
||
622 |
nm := self classNameOfChange:changeNr. |
|
623 |
nm notNil ifTrue:[ |
|
1427
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
624 |
|cls| |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
625 |
|
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
626 |
cls := Smalltalk at:(nm asSymbol) ifAbsent:[]. |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
627 |
cls notNil ifTrue:[ |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
628 |
cls isLoaded ifFalse:[ |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
629 |
cls autoload |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
630 |
] |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
631 |
] |
51 | 632 |
]. |
45 | 633 |
|
51 | 634 |
changeNrProcessed := changeNr. |
45 | 635 |
|
358
a7546792f073
update changeFile if applying changes from another changeFile
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
636 |
applyAction := [ |
1427
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
637 |
|sig| |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
638 |
|
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
639 |
(skipSignal notNil) ifTrue:[ |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
640 |
sig := skipSignal |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
641 |
] ifFalse:[ |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
642 |
sig := Object abortSignal |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
643 |
]. |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
644 |
sig catch:[ |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
645 |
|reader doItChunk methodsForChunk| |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
646 |
|
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
647 |
"/ a followup methodsFor: chunk ... |
1472 | 648 |
(self changeIsFollowupMethodChange:changeNr) ifTrue:[ |
1427
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
649 |
methodsForChunk := (changeChunks at:changeNr). |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
650 |
] ifFalse:[ |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
651 |
doItChunk := aStream nextChunk. "/ an empty chunk sometimes ... |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
652 |
doItChunk notEmpty ifTrue:[ |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
653 |
Compiler evaluate:doItChunk notifying:self. |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
654 |
] ifFalse:[ |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
655 |
methodsForChunk := aStream nextChunk. "/ the real one |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
656 |
] |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
657 |
]. |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
658 |
methodsForChunk notNil ifTrue:[ |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
659 |
Class methodRedefinitionSignal handle:[:ex | |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
660 |
ex proceedWith:#keep |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
661 |
] do:[ |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
662 |
reader := Compiler evaluate:methodsForChunk notifying:self. |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
663 |
reader fileInFrom:aStream notifying:self passChunk:false single:true. |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
664 |
] |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
665 |
] |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
666 |
]. |
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
667 |
changeNrProcessed := nil. |
358
a7546792f073
update changeFile if applying changes from another changeFile
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
668 |
]. |
a7546792f073
update changeFile if applying changes from another changeFile
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
669 |
|
a7546792f073
update changeFile if applying changes from another changeFile
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
670 |
"/ |
a7546792f073
update changeFile if applying changes from another changeFile
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
671 |
"/ if I am showing the changes file, dont update it |
a7546792f073
update changeFile if applying changes from another changeFile
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
672 |
"/ |
a7546792f073
update changeFile if applying changes from another changeFile
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
673 |
changeFileName = ObjectMemory nameForChanges ifTrue:[ |
1427
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
674 |
Class withoutUpdatingChangesDo:applyAction |
358
a7546792f073
update changeFile if applying changes from another changeFile
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
675 |
] ifFalse:[ |
1427
0b2794583306
care for methodRedefinitionSignal when accepting
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
676 |
applyAction value |
45 | 677 |
]. |
132 | 678 |
aStream close |
358
a7546792f073
update changeFile if applying changes from another changeFile
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
679 |
|
1473 | 680 |
"Modified: / 7.2.1998 / 19:56:34 / cg" |
45 | 681 |
! |
682 |
||
202 | 683 |
autoSelect:changeNr |
684 |
"select a change" |
|
73 | 685 |
|
202 | 686 |
self class autoSelectNext ifTrue:[ |
1378 | 687 |
(changeNr <= self numberOfChanges) ifTrue:[ |
688 |
changeListView setSelection:changeNr. |
|
689 |
self changeSelection:changeNr. |
|
690 |
^ self |
|
691 |
] |
|
202 | 692 |
]. |
693 |
self clearCodeView. |
|
562
8f772068fd1a
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
694 |
changeListView setSelection:nil. |
8f772068fd1a
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
695 |
|
8f772068fd1a
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
696 |
"Modified: 25.5.1996 / 12:28:21 / cg" |
73 | 697 |
! |
698 |
||
202 | 699 |
autoSelectLast |
700 |
"select the last change" |
|
0 | 701 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
702 |
self autoSelect:(self numberOfChanges) |
202 | 703 |
! |
107 | 704 |
|
202 | 705 |
autoSelectOrEnd:changeNr |
706 |
"select the next change or the last" |
|
707 |
||
708 |
|last| |
|
50 | 709 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
710 |
last := self numberOfChanges. |
202 | 711 |
changeNr < last ifTrue:[ |
1378 | 712 |
self autoSelect:changeNr |
133 | 713 |
] ifFalse:[ |
1378 | 714 |
changeListView setSelection:last . |
715 |
self changeSelection:last. |
|
202 | 716 |
] |
562
8f772068fd1a
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
717 |
|
8f772068fd1a
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
718 |
"Modified: 25.5.1996 / 12:26:17 / cg" |
202 | 719 |
! |
133 | 720 |
|
202 | 721 |
changeFileName:aFileName |
722 |
changeFileName := aFileName |
|
133 | 723 |
! |
724 |
||
1470 | 725 |
changeIsFollowupMethodChange:changeNr |
726 |
^ changeIsFollowupMethodChange at:changeNr |
|
727 |
||
728 |
"Created: / 6.2.1998 / 13:03:39 / cg" |
|
729 |
! |
|
730 |
||
275
604a906c0eb7
better handling of changes for autoloaded classes
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
731 |
checkClassIsLoaded:aClass |
604a906c0eb7
better handling of changes for autoloaded classes
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
732 |
|cls| |
604a906c0eb7
better handling of changes for autoloaded classes
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
733 |
|
604a906c0eb7
better handling of changes for autoloaded classes
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
734 |
aClass isMeta ifTrue:[ |
1378 | 735 |
cls := aClass soleInstance |
275
604a906c0eb7
better handling of changes for autoloaded classes
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
736 |
] ifFalse:[ |
1378 | 737 |
cls := aClass |
275
604a906c0eb7
better handling of changes for autoloaded classes
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
738 |
]. |
604a906c0eb7
better handling of changes for autoloaded classes
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
739 |
cls isLoaded ifFalse:[ |
1378 | 740 |
(self confirm:(cls name , ' is an autoloaded class.\I can only compare the methods texts if its loaded first.\\Load the class first ?') withCRs) |
741 |
ifTrue:[ |
|
742 |
cls autoload |
|
743 |
] |
|
275
604a906c0eb7
better handling of changes for autoloaded classes
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
744 |
]. |
604a906c0eb7
better handling of changes for autoloaded classes
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
745 |
^ cls isLoaded |
604a906c0eb7
better handling of changes for autoloaded classes
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
746 |
|
604a906c0eb7
better handling of changes for autoloaded classes
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
747 |
"Created: 12.12.1995 / 14:04:39 / cg" |
604a906c0eb7
better handling of changes for autoloaded classes
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
748 |
"Modified: 12.12.1995 / 14:11:05 / cg" |
604a906c0eb7
better handling of changes for autoloaded classes
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
749 |
! |
604a906c0eb7
better handling of changes for autoloaded classes
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
750 |
|
133 | 751 |
checkIfFileHasChanged |
752 |
|f info | |
|
753 |
||
754 |
Processor removeTimedBlock:checkBlock. |
|
755 |
f := changeFileName asFilename. |
|
756 |
(info := f info) isNil ifTrue:[ |
|
1378 | 757 |
self newLabel:'(unaccessable)' |
133 | 758 |
] ifFalse:[ |
1378 | 759 |
(info modified) > changeFileTimestamp ifTrue:[ |
760 |
self newLabel:'(outdated)'. |
|
761 |
autoUpdate ifTrue:[ |
|
762 |
self doUpdate |
|
763 |
] |
|
764 |
] ifFalse:[ |
|
765 |
self newLabel:'' |
|
766 |
] |
|
133 | 767 |
]. |
768 |
Processor addTimedBlock:checkBlock afterSeconds:5. |
|
769 |
||
770 |
"Created: 8.9.1995 / 19:30:19 / claus" |
|
771 |
"Modified: 8.9.1995 / 19:38:18 / claus" |
|
829
b6b0be2e14af
changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
772 |
"Modified: 1.11.1996 / 20:22:56 / cg" |
133 | 773 |
! |
774 |
||
255 | 775 |
classNameOfChange:changeNr |
776 |
"return the classname of a change |
|
777 |
(for classChanges (i.e. xxx class), the non-metaClassName (i.e. xxx) is returned)" |
|
778 |
||
779 |
|name| |
|
780 |
||
781 |
name := self fullClassNameOfChange:changeNr. |
|
782 |
name isNil ifTrue:[^ nil]. |
|
783 |
(name endsWith:' class') ifTrue:[ |
|
784 |
^ name copyWithoutLast:6 |
|
785 |
]. |
|
786 |
^ name |
|
787 |
||
788 |
"Modified: 6.12.1995 / 17:06:31 / cg" |
|
789 |
! |
|
790 |
||
791 |
clearCodeView |
|
792 |
self unselect "changeListView deselect". |
|
793 |
codeView contents:nil. |
|
794 |
changeNrShown := nil |
|
795 |
! |
|
796 |
||
797 |
compareChange:changeNr |
|
798 |
"compare a change with current version" |
|
799 |
||
800 |
|aStream chunk sawExcla parseTree thisClass cat oldSource newSource |
|
742
2ef5e22d8983
code cleanup (unused vars eliminated)
Claus Gittinger <cg@exept.de>
parents:
724
diff
changeset
|
801 |
parser sel oldMethod outcome showDiff d t1 t2 selector isLoaded |
761 | 802 |
method beep| |
255 | 803 |
|
804 |
aStream := self streamForChange:changeNr. |
|
805 |
aStream isNil ifTrue:[^ self]. |
|
806 |
||
275
604a906c0eb7
better handling of changes for autoloaded classes
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
807 |
showDiff := false. |
604a906c0eb7
better handling of changes for autoloaded classes
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
808 |
|
1472 | 809 |
(self changeIsFollowupMethodChange:changeNr) ifFalse:[ |
810 |
sawExcla := aStream peekFor:(aStream class chunkSeparator). |
|
811 |
chunk := aStream nextChunk. |
|
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
812 |
] ifTrue:[ |
1472 | 813 |
chunk := (changeChunks at:changeNr). |
814 |
sawExcla := true. |
|
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
815 |
]. |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
816 |
|
761 | 817 |
beep := false. |
255 | 818 |
sawExcla ifFalse:[ |
1472 | 819 |
outcome := 'cannot compare this change\\(i.e. this is not a method change).'. |
820 |
||
821 |
parseTree := Parser parseExpression:chunk. |
|
822 |
(parseTree notNil and:[parseTree isMessage]) ifTrue:[ |
|
823 |
((selector := parseTree selector) == #removeSelector:) ifTrue:[ |
|
824 |
thisClass := (parseTree receiver evaluate). |
|
825 |
thisClass isBehavior ifTrue:[ |
|
826 |
(self checkClassIsLoaded:thisClass) ifTrue:[ |
|
827 |
selector := (parseTree arg1 evaluate). |
|
828 |
(thisClass includesSelector:selector) ifTrue:[ |
|
829 |
outcome := 'change removes the #' , selector , ' method from ' , thisClass name. |
|
830 |
] ifFalse:[ |
|
831 |
outcome := 'change has no effect\\(there is no method for #' , selector , ' in ' , thisClass name , ')' |
|
832 |
] |
|
833 |
] ifFalse:[ |
|
834 |
beep := true. |
|
835 |
outcome := 'cannot compare this change (compare requires class to be loaded).'. |
|
836 |
] |
|
837 |
] |
|
838 |
]. |
|
839 |
selector == #category: ifTrue:[ |
|
840 |
parseTree receiver isMessage ifTrue:[ |
|
841 |
parseTree receiver selector == #compiledMethodAt: ifTrue:[ |
|
842 |
(method := parseTree receiver evaluate) isMethod ifTrue:[ |
|
843 |
method category = parseTree arg1 evaluate ifTrue:[ |
|
844 |
outcome := 'change has no effect\\(same category)'. |
|
845 |
] ifFalse:[ |
|
846 |
outcome := 'category is different (''' , method category , ''' vs. ''' , parseTree arg1 evaluate , ''')' |
|
847 |
] |
|
848 |
] ifFalse:[ |
|
849 |
beep := true. |
|
850 |
outcome := 'there is no such method' |
|
851 |
] |
|
852 |
] |
|
853 |
] |
|
854 |
] |
|
855 |
] |
|
255 | 856 |
] ifTrue:[ |
1472 | 857 |
parseTree := Parser parseExpression:chunk. |
858 |
(parseTree notNil |
|
859 |
and:[parseTree ~~ #Error |
|
860 |
and:[parseTree isMessage]]) ifTrue:[ |
|
861 |
(parseTree selector == #methodsFor:) ifTrue:[ |
|
862 |
thisClass := (parseTree receiver evaluate). |
|
863 |
thisClass isBehavior ifTrue:[ |
|
864 |
(isLoaded := self checkClassIsLoaded:thisClass) ifFalse:[ |
|
865 |
outcome := 'cannot compare this change\\(compare requires class to be loaded).'. |
|
866 |
]. |
|
867 |
||
868 |
cat := parseTree arg1 evaluate. |
|
869 |
newSource := aStream nextChunk. |
|
870 |
||
871 |
parser := Parser parseMethod:newSource in:thisClass. |
|
872 |
(parser notNil and:[parser ~~ #Error]) ifTrue:[ |
|
873 |
sel := parser selector. |
|
874 |
oldMethod := thisClass compiledMethodAt:sel. |
|
875 |
oldMethod notNil ifTrue:[ |
|
876 |
(oldMethod category = cat) ifFalse:[ |
|
877 |
Transcript showCR:'category changed.'. |
|
878 |
]. |
|
879 |
oldSource := oldMethod source. |
|
880 |
(oldSource = newSource) ifTrue:[ |
|
881 |
outcome := 'same source' |
|
882 |
] ifFalse:[ |
|
883 |
oldSource isNil ifTrue:[ |
|
884 |
beep := true. |
|
885 |
outcome := 'no source for compare.' |
|
886 |
] ifFalse:[ |
|
887 |
"/ |
|
888 |
"/ compare for tabulator <-> space changes |
|
889 |
"/ before showing diff ... |
|
890 |
"/ |
|
891 |
t1 := oldSource asCollectionOfLines collect:[:s | s withTabsExpanded]. |
|
892 |
t2 := newSource asCollectionOfLines collect:[:s | s withTabsExpanded]. |
|
893 |
t1 = t2 ifTrue:[ |
|
894 |
outcome := 'same source' |
|
895 |
] ifFalse:[ |
|
896 |
outcome := 'source changed.'. |
|
897 |
showDiff := true. |
|
898 |
||
899 |
"/ |
|
900 |
"/ check if only historyLine diffs |
|
901 |
"/ |
|
902 |
(HistoryManager notNil |
|
903 |
and:[HistoryManager isActive]) ifTrue:[ |
|
904 |
(HistoryManager withoutHistoryLines:newSource) |
|
905 |
= |
|
906 |
(HistoryManager withoutHistoryLines:oldSource) |
|
907 |
ifTrue:[ |
|
908 |
outcome := 'same source (history only)'. |
|
909 |
showDiff := false. |
|
910 |
] |
|
911 |
]. |
|
912 |
] |
|
913 |
] |
|
914 |
] |
|
915 |
] ifFalse:[ |
|
916 |
isLoaded ifTrue:[ |
|
917 |
beep := true. |
|
918 |
outcome := 'method does not exist.' |
|
919 |
] |
|
920 |
] |
|
921 |
] ifFalse:[ |
|
922 |
outcome := 'change unparsable.' |
|
923 |
]. |
|
924 |
(showDiff and:[oldSource notNil and:[newSource notNil]]) ifTrue:[ |
|
925 |
d := DiffTextView |
|
1473 | 926 |
openOn:oldSource label:'current version (in image)' |
927 |
and:newSource label:'change version'. |
|
1472 | 928 |
d label:'method differences'. |
929 |
] |
|
930 |
] ifFalse:[ |
|
931 |
beep := true. |
|
932 |
outcome := 'class does not exist.' |
|
933 |
] |
|
934 |
] ifFalse:[ |
|
935 |
beep := true. |
|
936 |
outcome := 'not comparable.' |
|
937 |
] |
|
938 |
] ifFalse:[ |
|
939 |
beep := true. |
|
940 |
outcome := 'not comparable.' |
|
941 |
] |
|
255 | 942 |
]. |
943 |
aStream close. |
|
944 |
showDiff ifFalse:[ |
|
1472 | 945 |
beep ifTrue:[ |
946 |
self warn:outcome withCRs. |
|
947 |
] ifFalse:[ |
|
948 |
self information:outcome withCRs. |
|
949 |
] |
|
553 | 950 |
"/ Transcript showCR:outcome. |
255 | 951 |
]. |
952 |
||
1472 | 953 |
"Created: / 24.11.1995 / 14:30:46 / cg" |
1473 | 954 |
"Modified: / 7.2.1998 / 19:54:11 / cg" |
955 |
||
255 | 956 |
! |
957 |
||
1359 | 958 |
compressForClass:aClassNameOrNil |
959 |
"compress the change-set; |
|
960 |
this replaces multiple method-changes by the last (i.e. the most recent) change. |
|
961 |
If the class argument is nil, compress for all classes. |
|
962 |
otherwise, only changes for that class are compressed." |
|
963 |
||
964 |
|aStream searchIndex anyMore deleteSet index |
|
965 |
str snapshotProto snapshotPrefix snapshotNameIndex fileName| |
|
966 |
||
967 |
aStream := FileStream readonlyFileNamed:changeFileName. |
|
968 |
aStream isNil ifTrue:[^ self]. |
|
969 |
||
970 |
aClassNameOrNil isNil ifTrue:[ |
|
1378 | 971 |
self newLabel:'compressing ...'. |
1359 | 972 |
] ifFalse:[ |
1378 | 973 |
self newLabel:'compressing for ' , aClassNameOrNil. |
1359 | 974 |
]. |
975 |
||
976 |
CompressSnapshotInfo == true ifTrue:[ |
|
1378 | 977 |
" |
978 |
get a prototype snapshot record (to be independent of |
|
979 |
the actual format .. |
|
980 |
" |
|
981 |
str := WriteStream on:String new. |
|
982 |
Class addChangeRecordForSnapshot:'foo' to:str. |
|
983 |
snapshotProto := str contents. |
|
984 |
snapshotPrefix := snapshotProto copyTo:10. |
|
985 |
snapshotNameIndex := snapshotProto findString:'foo'. |
|
1359 | 986 |
]. |
987 |
||
988 |
self withExecuteCursorDo:[ |
|
1378 | 989 |
|numChanges classes selectors types excla sawExcla |
990 |
changeNr chunk aParseTree parseTreeChunk |
|
991 |
thisClass thisSelector codeChunk codeParser |
|
992 |
compressThis| |
|
993 |
||
994 |
numChanges := self numberOfChanges. |
|
995 |
classes := Array new:numChanges. |
|
996 |
selectors := Array new:numChanges. |
|
997 |
types := Array new:numChanges. |
|
998 |
||
999 |
"starting at the end, get the change class and change selector; |
|
1000 |
collect all in classes / selectors" |
|
1001 |
||
1002 |
changeNr := numChanges. |
|
1003 |
excla := aStream class chunkSeparator. |
|
1004 |
||
1005 |
[changeNr >= 1] whileTrue:[ |
|
1006 |
aStream position:(changePositions at:changeNr). |
|
1007 |
sawExcla := aStream peekFor:excla. |
|
1008 |
chunk := aStream nextChunk. |
|
1009 |
sawExcla ifTrue:[ |
|
1010 |
"optimize a bit if multiple methods for same category arrive" |
|
1011 |
(chunk = parseTreeChunk) ifFalse:[ |
|
1012 |
aParseTree := Parser parseExpression:chunk. |
|
1013 |
parseTreeChunk := chunk |
|
1014 |
]. |
|
1015 |
(aParseTree notNil |
|
1016 |
and:[(aParseTree ~~ #Error) |
|
1017 |
and:[aParseTree isMessage]]) ifTrue:[ |
|
1018 |
(aParseTree selector == #methodsFor:) ifTrue:[ |
|
1019 |
thisClass := (aParseTree receiver evaluate). |
|
1020 |
codeChunk := aStream nextChunk. |
|
1021 |
codeParser := Parser |
|
1022 |
parseMethodSpecification:codeChunk |
|
1023 |
in:thisClass |
|
1024 |
ignoreErrors:true |
|
1025 |
ignoreWarnings:true. |
|
1026 |
(codeParser notNil and:[codeParser ~~ #Error]) ifTrue:[ |
|
1027 |
selectors at:changeNr put:(codeParser selector). |
|
1028 |
classes at:changeNr put:thisClass. |
|
1029 |
types at:changeNr put:#methodsFor |
|
1030 |
] |
|
1031 |
] |
|
1032 |
] |
|
1033 |
] ifFalse:[ |
|
1034 |
aParseTree := Parser parseExpression:chunk. |
|
1035 |
parseTreeChunk := chunk. |
|
1036 |
(aParseTree notNil |
|
1037 |
and:[(aParseTree ~~ #Error) |
|
1038 |
and:[aParseTree isMessage]]) ifTrue:[ |
|
1039 |
(aParseTree selector == #removeSelector:) ifTrue:[ |
|
1040 |
selectors at:changeNr put:(aParseTree arg1 value ). |
|
1041 |
classes at:changeNr put:(aParseTree receiver evaluate). |
|
1042 |
types at:changeNr put:#removeSelector |
|
1043 |
] |
|
1044 |
] ifFalse:[ |
|
1045 |
CompressSnapshotInfo == true ifTrue:[ |
|
1046 |
(chunk startsWith:snapshotPrefix) ifTrue:[ |
|
1047 |
str := chunk readStream position:snapshotNameIndex. |
|
1048 |
fileName := str upTo:(Character space). |
|
1049 |
" |
|
1050 |
kludge to allow use of match-check below |
|
1051 |
" |
|
1052 |
selectors at:changeNr put:snapshotPrefix. |
|
1053 |
classes at:changeNr put:fileName. |
|
1054 |
] |
|
1055 |
] |
|
1056 |
] |
|
1057 |
]. |
|
1058 |
changeNr := changeNr - 1 |
|
1059 |
]. |
|
1060 |
aStream close. |
|
1061 |
||
1062 |
"for all changes, look for another class/selector occurence later |
|
1063 |
in the list and, if there is one, add change number to the delete set" |
|
1064 |
||
1065 |
deleteSet := OrderedCollection new. |
|
1066 |
changeNr := 1. |
|
1067 |
[changeNr < self numberOfChanges] whileTrue:[ |
|
1068 |
thisClass := classes at:changeNr. |
|
1069 |
||
1070 |
compressThis := false. |
|
1071 |
aClassNameOrNil isNil ifTrue:[ |
|
1072 |
compressThis := true |
|
1073 |
] ifFalse:[ |
|
1074 |
"/ skipping unloaded/unknown classes |
|
1075 |
thisClass isBehavior ifTrue:[ |
|
1076 |
thisClass isMeta ifTrue:[ |
|
1077 |
compressThis := aClassNameOrNil = thisClass soleInstance name. |
|
1078 |
] ifFalse:[ |
|
1079 |
compressThis := aClassNameOrNil = thisClass name |
|
1080 |
] |
|
1081 |
] |
|
1082 |
]. |
|
1083 |
||
1084 |
compressThis ifTrue:[ |
|
1085 |
thisSelector := selectors at:changeNr. |
|
1086 |
searchIndex := changeNr. |
|
1087 |
anyMore := true. |
|
1088 |
[anyMore] whileTrue:[ |
|
1089 |
searchIndex := classes indexOf:thisClass |
|
1090 |
startingAt:(searchIndex + 1). |
|
1091 |
(searchIndex ~~ 0) ifTrue:[ |
|
1092 |
((selectors at:searchIndex) == thisSelector) ifTrue:[ |
|
1093 |
thisClass notNil ifTrue:[ |
|
1094 |
deleteSet add:changeNr. |
|
1095 |
anyMore := false |
|
1096 |
] |
|
1097 |
] |
|
1098 |
] ifFalse:[ |
|
1099 |
anyMore := false |
|
1100 |
] |
|
1101 |
]. |
|
1102 |
]. |
|
1103 |
||
1104 |
changeNr := changeNr + 1 |
|
1105 |
]. |
|
1106 |
||
1107 |
"finally delete what has been found" |
|
1108 |
||
1109 |
(deleteSet size > 0) ifTrue:[ |
|
1110 |
changeListView setSelection:nil. |
|
1111 |
index := deleteSet size. |
|
1112 |
[index > 0] whileTrue:[ |
|
1113 |
self silentDeleteChange:(deleteSet at:index). |
|
1114 |
index := index - 1 |
|
1115 |
]. |
|
1116 |
self setChangeList. |
|
1117 |
" |
|
1118 |
scroll back a bit, if we are left way behind the list |
|
1119 |
" |
|
1120 |
changeListView firstLineShown > self numberOfChanges ifTrue:[ |
|
1121 |
changeListView makeLineVisible:self numberOfChanges |
|
1122 |
]. |
|
1123 |
self clearCodeView |
|
1124 |
] |
|
1359 | 1125 |
]. |
1126 |
self newLabel:''. |
|
1127 |
||
1128 |
"Created: / 29.10.1997 / 01:02:44 / cg" |
|
1129 |
"Modified: / 29.10.1997 / 01:26:59 / cg" |
|
1130 |
! |
|
1131 |
||
255 | 1132 |
contractClass:className selector:selector to:maxLen |
1133 |
|s l| |
|
1134 |
||
1135 |
s := className , ' ', selector. |
|
1136 |
s size > maxLen ifTrue:[ |
|
1137 |
l := maxLen - 1 - selector size max:20. |
|
1138 |
s := (className contractTo:l) , ' ' , selector. |
|
1139 |
||
1140 |
s size > maxLen ifTrue:[ |
|
1141 |
l := maxLen - 1 - className size max:20. |
|
1142 |
s := className , ' ', (selector contractTo:l). |
|
1143 |
||
1144 |
s size > maxLen ifTrue:[ |
|
1145 |
s := (className contractTo:(maxLen // 2 - 1)) , ' ' , (selector contractTo:maxLen // 2) |
|
1146 |
] |
|
1147 |
] |
|
1148 |
]. |
|
1149 |
^ s |
|
1150 |
! |
|
1151 |
||
1152 |
deleteChange:changeNr |
|
1153 |
"delete a change" |
|
1154 |
||
1155 |
self deleteChangesFrom:changeNr to:changeNr |
|
1156 |
! |
|
1157 |
||
1158 |
deleteChangesFrom:start to:stop |
|
1159 |
"delete a range of changes" |
|
1160 |
||
562
8f772068fd1a
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
1161 |
changeListView setSelection:nil. |
255 | 1162 |
stop to:start by:-1 do:[:changeNr | |
1378 | 1163 |
self silentDeleteInternalChange:changeNr. |
1164 |
changeListView removeIndex:changeNr. |
|
255 | 1165 |
]. |
744
cb962cb21e8c
faster drawing when deleting items
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
1166 |
|
1070
cdf5cf202f3b
faster redraw, when deleting items.
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
1167 |
"/ changeListView contentsChanged. |
cdf5cf202f3b
faster redraw, when deleting items.
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
1168 |
"/ changeListView redrawFromLine:start. |
255 | 1169 |
|
744
cb962cb21e8c
faster drawing when deleting items
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
1170 |
"/ self setChangeList |
cb962cb21e8c
faster drawing when deleting items
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
1171 |
|
1070
cdf5cf202f3b
faster redraw, when deleting items.
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
1172 |
"Modified: 7.3.1997 / 16:31:20 / cg" |
255 | 1173 |
! |
1174 |
||
241
9366ced0db42
doBrowse was wrong for class-methods
Claus Gittinger <cg@exept.de>
parents:
226
diff
changeset
|
1175 |
fullClassNameOfChange:changeNr |
9366ced0db42
doBrowse was wrong for class-methods
Claus Gittinger <cg@exept.de>
parents:
226
diff
changeset
|
1176 |
"return the full classname of a change |
9366ced0db42
doBrowse was wrong for class-methods
Claus Gittinger <cg@exept.de>
parents:
226
diff
changeset
|
1177 |
(for classChanges (i.e. xxx class), a string ending in ' class' is returned. |
202 | 1178 |
- since parsing ascii methods is slow, keep result cached in |
1179 |
changeClassNames for the next query" |
|
1180 |
||
958
942fbe2a9806
can now extract className from a checkin-chunk
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1181 |
|chunk aParseTree recTree sel name arg1Tree isMeta prevMethodDefNr |
1425
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1182 |
words changeStream fullParseTree ownerTree ownerName oldDollarSetting| |
202 | 1183 |
|
1184 |
changeNr isNil ifTrue:[^ nil]. |
|
1185 |
||
1186 |
" |
|
1187 |
first look, if not already known |
|
1188 |
" |
|
1189 |
name := changeClassNames at:changeNr. |
|
1190 |
name notNil ifTrue:[^ name]. |
|
1191 |
||
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1192 |
prevMethodDefNr := changeNr. |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1193 |
[changeIsFollowupMethodChange at:prevMethodDefNr] whileTrue:[ |
1425
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1194 |
prevMethodDefNr := prevMethodDefNr - 1. |
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1195 |
]. |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1196 |
|
202 | 1197 |
" |
1198 |
get the chunk |
|
1199 |
" |
|
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1200 |
chunk := changeChunks at:prevMethodDefNr. |
202 | 1201 |
chunk isNil ifTrue:[^ nil]. "mhmh - empty" |
1202 |
||
958
942fbe2a9806
can now extract className from a checkin-chunk
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1203 |
(chunk startsWith:'''---') ifTrue:[ |
1425
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1204 |
words := chunk asCollectionOfWords. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1205 |
words size > 2 ifTrue:[ |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1206 |
(words at:2) = 'checkin' ifTrue:[ |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1207 |
name := words at:3. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1208 |
changeClassNames at:changeNr put:name. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1209 |
^ name |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1210 |
] |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1211 |
]. |
958
942fbe2a9806
can now extract className from a checkin-chunk
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1212 |
]. |
942fbe2a9806
can now extract className from a checkin-chunk
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1213 |
|
942fbe2a9806
can now extract className from a checkin-chunk
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1214 |
"/ fix it - otherwise, it cannot be parsed |
226 | 1215 |
(chunk endsWith:'primitiveDefinitions:') ifTrue:[ |
1425
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1216 |
chunk := chunk , '''''' |
226 | 1217 |
]. |
1218 |
(chunk endsWith:'primitiveFunctions:') ifTrue:[ |
|
1425
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1219 |
chunk := chunk , '''''' |
226 | 1220 |
]. |
1221 |
(chunk endsWith:'primitiveVariables:') ifTrue:[ |
|
1425
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1222 |
chunk := chunk , '''''' |
226 | 1223 |
]. |
1224 |
||
202 | 1225 |
" |
1226 |
use parser to construct a parseTree |
|
1227 |
" |
|
1425
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1228 |
oldDollarSetting := Parser allowDollarInIdentifier. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1229 |
[ |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1230 |
Parser allowDollarInIdentifier:true. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1231 |
aParseTree := Parser parseExpression:chunk. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1232 |
] valueNowOrOnUnwindDo:[ |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1233 |
Parser allowDollarInIdentifier:oldDollarSetting |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1234 |
]. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1235 |
|
202 | 1236 |
(aParseTree isNil or:[aParseTree == #Error]) ifTrue:[ |
1425
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1237 |
^ nil "seems strange ... (could be a comment)" |
202 | 1238 |
]. |
1239 |
aParseTree isMessage ifFalse:[ |
|
1425
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1240 |
^ nil "very strange ... (whats that ?)" |
202 | 1241 |
]. |
1242 |
||
1243 |
" |
|
1244 |
ask parser for selector |
|
1245 |
" |
|
1246 |
sel := aParseTree selector. |
|
1247 |
recTree := aParseTree receiver. |
|
1248 |
||
1249 |
" |
|
1250 |
is it a method-change, methodRemove or comment-change ? |
|
1251 |
" |
|
1252 |
(#(#'methodsFor:' |
|
1253 |
#'privateMethodsFor:' |
|
1254 |
#'protectedMethodsFor:' |
|
1255 |
#'publicMethodsFor:' |
|
1256 |
#'removeSelector:' |
|
1257 |
#'comment:' |
|
1258 |
#'primitiveDefinitions:' |
|
1259 |
#'primitiveFunctions:' |
|
1260 |
#'primitiveVariables:' |
|
1261 |
#'renameCategory:to:' |
|
1262 |
#'instanceVariableNames:' |
|
1263 |
) includes:sel) ifTrue:[ |
|
1425
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1264 |
" |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1265 |
yes, the className is the receiver |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1266 |
" |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1267 |
(recTree notNil and:[recTree ~~ #Error]) ifTrue:[ |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1268 |
isMeta := false. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1269 |
recTree isUnaryMessage ifTrue:[ |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1270 |
(recTree selector ~~ #class) ifTrue:[^ nil]. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1271 |
"id class methodsFor:..." |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1272 |
recTree := recTree receiver. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1273 |
isMeta := true. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1274 |
]. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1275 |
recTree isPrimary ifTrue:[ |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1276 |
name := recTree name. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1277 |
isMeta ifTrue:[ |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1278 |
name := name , ' class'. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1279 |
]. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1280 |
changeClassNames at:changeNr put:name. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1281 |
^ name |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1282 |
] |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1283 |
]. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1284 |
"more strange things" |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1285 |
^ nil |
202 | 1286 |
]. |
1287 |
||
1288 |
" |
|
1289 |
is it a change in a class-description ? |
|
1290 |
" |
|
1291 |
(('subclass:*' match:sel) |
|
1292 |
or:[('variable*subclass:*' match:sel)]) ifTrue:[ |
|
1425
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1293 |
"/ must parse the full changes text, to get |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1294 |
"/ privacy information. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1295 |
|
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1296 |
changeStream := self streamForChange:changeNr. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1297 |
changeStream notNil ifTrue:[ |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1298 |
chunk := changeStream nextChunk. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1299 |
changeStream close. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1300 |
fullParseTree := Parser parseExpression:chunk. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1301 |
(fullParseTree isNil or:[fullParseTree == #Error]) ifTrue:[ |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1302 |
fullParseTree := nil |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1303 |
]. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1304 |
fullParseTree isMessage ifFalse:[ |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1305 |
fullParseTree := nil |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1306 |
]. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1307 |
"/ actually, the nil case cannot happen |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1308 |
fullParseTree notNil ifTrue:[ |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1309 |
aParseTree := fullParseTree. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1310 |
sel := aParseTree selector. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1311 |
]. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1312 |
]. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1313 |
|
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1314 |
arg1Tree := aParseTree arg1. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1315 |
(arg1Tree notNil and:[arg1Tree isConstant]) ifTrue:[ |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1316 |
name := arg1Tree value asString. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1317 |
|
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1318 |
"/ is it a private-class ? |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1319 |
('*privateIn:' match:sel) ifTrue:[ |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1320 |
ownerTree := aParseTree args last. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1321 |
ownerName := ownerTree name asString. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1322 |
name := ownerName , '::' , name |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1323 |
]. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1324 |
changeClassNames at:changeNr put:name. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1325 |
^ name |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1326 |
]. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1327 |
"very strange" |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1328 |
^ nil |
202 | 1329 |
]. |
1330 |
||
1331 |
" |
|
1332 |
is it a class remove ? |
|
1333 |
" |
|
1334 |
(sel == #removeClass:) ifTrue:[ |
|
1425
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1335 |
(recTree notNil |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1336 |
and:[recTree ~~ #Error |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1337 |
and:[recTree isPrimary |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1338 |
and:[recTree name = 'Smalltalk']]]) ifTrue:[ |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1339 |
arg1Tree := aParseTree arg1. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1340 |
(arg1Tree notNil and:[arg1Tree isPrimary]) ifTrue:[ |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1341 |
name := arg1Tree name. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1342 |
changeClassNames at:changeNr put:name. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1343 |
^ name |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1344 |
]. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1345 |
] |
202 | 1346 |
]. |
1347 |
||
1348 |
" |
|
1349 |
is it a method category change ? |
|
1350 |
" |
|
928 | 1351 |
((sel == #category:) |
1352 |
or:[sel == #privacy:]) ifTrue:[ |
|
1425
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1353 |
(recTree notNil |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1354 |
and:[recTree ~~ #Error |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1355 |
and:[recTree isMessage |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1356 |
and:[recTree selector == #compiledMethodAt:]]]) ifTrue:[ |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1357 |
isMeta := false. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1358 |
recTree := recTree receiver. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1359 |
recTree isUnaryMessage ifTrue:[ |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1360 |
(recTree selector ~~ #class) ifTrue:[^ nil]. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1361 |
"id class " |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1362 |
recTree := recTree receiver |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1363 |
]. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1364 |
recTree isPrimary ifTrue:[ |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1365 |
isMeta ifTrue:[ |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1366 |
name := name , ' class'. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1367 |
]. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1368 |
name := recTree name. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1369 |
changeClassNames at:changeNr put:name. |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1370 |
^ name |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1371 |
] |
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1372 |
] |
202 | 1373 |
]. |
1374 |
^ nil |
|
241
9366ced0db42
doBrowse was wrong for class-methods
Claus Gittinger <cg@exept.de>
parents:
226
diff
changeset
|
1375 |
|
1425
443eb4286f66
must allow dollars-in-identifiers while parsing a change for its class
Claus Gittinger <cg@exept.de>
parents:
1378
diff
changeset
|
1376 |
"Modified: / 27.1.1998 / 19:02:16 / cg" |
241
9366ced0db42
doBrowse was wrong for class-methods
Claus Gittinger <cg@exept.de>
parents:
226
diff
changeset
|
1377 |
! |
9366ced0db42
doBrowse was wrong for class-methods
Claus Gittinger <cg@exept.de>
parents:
226
diff
changeset
|
1378 |
|
202 | 1379 |
makeChangeAPatch:changeNr |
1380 |
"append change to patchfile" |
|
1381 |
||
1382 |
self appendChange:changeNr toFile:'patches' |
|
1383 |
! |
|
1384 |
||
1385 |
makeChangePermanent:changeNr |
|
1386 |
"rewrite the source file where change changeNr lies" |
|
1387 |
||
1388 |
self notify:'this is not yet implemented' |
|
1389 |
! |
|
1390 |
||
1391 |
newLabel:how |
|
1392 |
|l| |
|
1393 |
||
1394 |
(changeFileName ~= 'changes') ifTrue:[ |
|
1470 | 1395 |
l := self class defaultLabel , ': ', changeFileName |
202 | 1396 |
] ifFalse:[ |
1470 | 1397 |
l := self class defaultLabel |
202 | 1398 |
]. |
1399 |
l := l , ' ' , how. |
|
1400 |
self label:l |
|
1401 |
||
1470 | 1402 |
"Created: / 8.9.1995 / 19:32:04 / claus" |
1403 |
"Modified: / 8.9.1995 / 19:39:29 / claus" |
|
1404 |
"Modified: / 6.2.1998 / 13:27:01 / cg" |
|
202 | 1405 |
! |
1406 |
||
255 | 1407 |
numberOfChanges |
1408 |
^ changePositions size |
|
1409 |
||
1410 |
"Created: 3.12.1995 / 18:15:39 / cg" |
|
1411 |
! |
|
1412 |
||
202 | 1413 |
queryCloseText |
1414 |
"made this a method for easy redefinition in subclasses" |
|
1415 |
||
1416 |
^ 'Quit without updating changeFile ?' |
|
1417 |
! |
|
1418 |
||
1419 |
readChangesFile |
|
1420 |
"read the changes file, create a list of header-lines (changeChunks) |
|
1421 |
and a list of chunk-positions (changePositions)" |
|
1422 |
||
1423 |
^ self readChangesFileInBackground:false |
|
1424 |
! |
|
1425 |
||
37 | 1426 |
readChangesFileInBackground:inBackground |
1427 |
"read the changes file, create a list of header-lines (changeChunks) |
|
51 | 1428 |
and a list of chunk-positions (changePositions). |
1429 |
Starting with 2.10.3, the entries are multi-col entries; |
|
1430 |
the cols are: |
|
1378 | 1431 |
1 delta (only if comparing) |
1432 |
'+' -> new method (w.r.t. current state) |
|
1433 |
'-' -> removed method (w.r.t. current state) |
|
1434 |
'?' -> class does not exist currently |
|
1435 |
'=' -> change is same as current methods source |
|
1436 |
2 class/selector |
|
1437 |
3 type of change |
|
1438 |
doit |
|
1439 |
method |
|
1440 |
category change |
|
1441 |
4 timestamp |
|
89 | 1442 |
|
1443 |
since comparing slows down startup time, it is now disabled by |
|
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1444 |
default and can be enabled via a toggle." |
37 | 1445 |
|
829
b6b0be2e14af
changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
1446 |
|aStream maxLen i f| |
50 | 1447 |
|
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1448 |
editingClassSource := false. |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1449 |
|
50 | 1450 |
maxLen := 60. |
0 | 1451 |
|
133 | 1452 |
f := changeFileName asFilename. |
1453 |
aStream := f readStream. |
|
0 | 1454 |
aStream isNil ifTrue:[^ nil]. |
1455 |
||
326 | 1456 |
self newLabel:'updating ...'. |
1457 |
||
829
b6b0be2e14af
changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
1458 |
i := f info. |
b6b0be2e14af
changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
1459 |
changeFileSize := i size. |
b6b0be2e14af
changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
1460 |
changeFileTimestamp := i modified. |
133 | 1461 |
|
294 | 1462 |
self withReadCursorDo:[ |
1378 | 1463 |
|myProcess myPriority| |
1464 |
||
1465 |
" |
|
1466 |
this is a time consuming operation (especially, if reading an |
|
1467 |
NFS-mounted directory; therefore lower my priority ... |
|
1468 |
" |
|
1469 |
inBackground ifTrue:[ |
|
1470 |
myProcess := Processor activeProcess. |
|
1471 |
myPriority := myProcess priority. |
|
1472 |
myProcess priority:(Processor userBackgroundPriority). |
|
1473 |
]. |
|
1474 |
||
1475 |
[ |
|
1476 |
|excla timeStampInfo| |
|
1477 |
||
1478 |
changeChunks := OrderedCollection new. |
|
1479 |
changeHeaderLines := OrderedCollection new. |
|
1480 |
changePositions := OrderedCollection new. |
|
1481 |
changeTimeStamps := OrderedCollection new. |
|
1482 |
changeIsFollowupMethodChange := OrderedCollection new. |
|
1483 |
||
1484 |
excla := aStream class chunkSeparator. |
|
1485 |
||
1486 |
[aStream atEnd] whileFalse:[ |
|
1487 |
|entry changeDelta changeString changeType |
|
1488 |
line s l changeClass sawExcla category |
|
1489 |
chunkText chunkPos sel| |
|
1490 |
||
1491 |
" |
|
1492 |
get a chunk (separated by excla) |
|
1493 |
" |
|
1494 |
aStream skipSeparators. |
|
1495 |
chunkPos := aStream position. |
|
1496 |
||
1497 |
||
1498 |
sawExcla := aStream peekFor:excla. |
|
1499 |
chunkText := aStream nextChunk. |
|
1500 |
chunkText notNil ifTrue:[ |
|
1501 |
|index headerLine cls| |
|
1502 |
||
1503 |
(chunkText startsWith:'''---- timestamp ') ifTrue:[ |
|
1504 |
timeStampInfo := (chunkText copyFrom:16 to:(chunkText size - 6)) withoutSpaces. |
|
1505 |
] ifFalse:[ |
|
1506 |
||
1507 |
" |
|
1508 |
only first line is saved in changeChunks ... |
|
1509 |
" |
|
1510 |
index := chunkText indexOf:(Character cr). |
|
1511 |
(index ~~ 0) ifTrue:[ |
|
1512 |
chunkText := chunkText copyTo:(index - 1). |
|
1513 |
||
1514 |
"take care for comment changes - must still be a |
|
1515 |
valid expression for classNameOfChange: to work" |
|
1516 |
||
1517 |
(chunkText endsWith:'comment:''') ifTrue:[ |
|
1518 |
chunkText := chunkText , '...''' |
|
1519 |
]. |
|
1520 |
(chunkText endsWith:'primitiveDefinitions:''') ifTrue:[ |
|
1521 |
sel := 'primitiveDefinitions:'. |
|
1522 |
chunkText := chunkText copyWithoutLast:1 |
|
1523 |
]. |
|
1524 |
(chunkText endsWith:'primitiveVariables:''') ifTrue:[ |
|
1525 |
sel := 'primitiveVariables:'. |
|
1526 |
chunkText := chunkText copyWithoutLast:1 |
|
1527 |
]. |
|
1528 |
(chunkText endsWith:'primitiveFunctions:''') ifTrue:[ |
|
1529 |
sel := 'primitiveFunctions:'. |
|
1530 |
chunkText := chunkText copyWithoutLast:1 |
|
1531 |
]. |
|
1532 |
]. |
|
1533 |
||
1534 |
changeChunks add:chunkText. |
|
1535 |
changePositions add:chunkPos. |
|
1536 |
changeTimeStamps add:timeStampInfo. |
|
1537 |
changeIsFollowupMethodChange add:false. |
|
1538 |
||
1539 |
headerLine := nil. |
|
1540 |
changeDelta := ' '. |
|
1541 |
||
1542 |
sawExcla ifFalse:[ |
|
1543 |
(chunkText startsWith:'''---- snap') ifTrue:[ |
|
1544 |
changeType := ''. |
|
1545 |
headerLine := chunkText. |
|
1546 |
changeString := (chunkText contractTo:maxLen). |
|
1547 |
timeStampInfo := nil. |
|
1548 |
] ifFalse:[ |
|
1549 |
||
1550 |
|p cls| |
|
1551 |
||
1552 |
headerLine := chunkText , ' (doIt)'. |
|
1553 |
||
1554 |
" |
|
1555 |
first, assume doIt - then lets have a more detailed look ... |
|
1556 |
" |
|
1557 |
((chunkText startsWith:'''---- file') |
|
1558 |
or:[(chunkText startsWith:'''---- check')]) ifTrue:[ |
|
1559 |
changeType := ''. |
|
1560 |
timeStampInfo := nil. |
|
1561 |
] ifFalse:[ |
|
1562 |
changeType := '(doIt)'. |
|
1563 |
]. |
|
1564 |
changeString := (chunkText contractTo:maxLen). |
|
1565 |
||
1566 |
p := Parser parseExpression:chunkText inNameSpace:Smalltalk. |
|
1567 |
(p notNil |
|
1568 |
and:[p ~~ #Error |
|
1569 |
and:[p isMessage]]) ifTrue:[ |
|
1570 |
sel := p selector. |
|
1571 |
]. |
|
1572 |
(sel == #removeSelector:) ifTrue:[ |
|
1573 |
p receiver isUnaryMessage ifTrue:[ |
|
1574 |
cls := p receiver receiver name. |
|
1575 |
changeClass := (Smalltalk classNamed:cls) class. |
|
1576 |
cls := cls , ' class'. |
|
1577 |
] ifFalse:[ |
|
1578 |
cls := p receiver name. |
|
1579 |
changeClass := (Smalltalk classNamed:cls) |
|
1580 |
]. |
|
1581 |
sel := (p args at:1) evaluate. |
|
1582 |
||
1583 |
compareChanges ifTrue:[ |
|
1584 |
(changeClass isNil or:[changeClass isLoaded not]) ifTrue:[ |
|
1585 |
changeDelta := '?' |
|
1586 |
] ifFalse:[ |
|
1587 |
(changeClass implements:sel asSymbol) ifTrue:[ |
|
1588 |
changeDelta := '-'. |
|
1589 |
] |
|
1590 |
] |
|
1591 |
]. |
|
1592 |
changeType := '(remove)'. |
|
1593 |
changeString := self contractClass:cls selector:sel to:maxLen. |
|
1594 |
]. |
|
1595 |
(p ~~ #Error |
|
1596 |
and:[p isMessage |
|
1597 |
and:[p receiver isMessage |
|
1598 |
and:[p receiver selector == #compiledMethodAt:]]]) ifTrue:[ |
|
1599 |
p receiver receiver isUnaryMessage ifTrue:[ |
|
1600 |
cls := p receiver receiver receiver name. |
|
1601 |
changeClass := (Smalltalk classNamed:cls) class. |
|
1602 |
cls := cls , ' class'. |
|
1603 |
] ifFalse:[ |
|
1604 |
cls := p receiver receiver name. |
|
1605 |
changeClass := (Smalltalk classNamed:cls) |
|
1606 |
]. |
|
1607 |
(sel == #category:) ifTrue:[ |
|
1608 |
sel := (p receiver args at:1) evaluate. |
|
1609 |
changeType := '(category change)'. |
|
1610 |
changeString := self contractClass:cls selector:sel to:maxLen. |
|
1611 |
]. |
|
1612 |
(sel == #privacy:) ifTrue:[ |
|
1613 |
sel := (p receiver args at:1) evaluate. |
|
1614 |
changeType := '(privacy change)'. |
|
1615 |
changeString := self contractClass:cls selector:sel to:maxLen. |
|
1616 |
]. |
|
1617 |
]. |
|
1618 |
(#(#'subclass:' |
|
1619 |
#'variableSubclass:' |
|
1620 |
#'variableByteSubclass:' |
|
1621 |
#'variableWordSubclass:' |
|
1622 |
#'variableLongSubclass:' |
|
1623 |
#'variableFloatSubclass:' |
|
1624 |
#'variableDoubleSubclass:' |
|
1625 |
#'primitiveDefinitions:' |
|
1626 |
#'primitiveFunctions:' |
|
1627 |
#'primitiveVariables:' |
|
1628 |
) includes:sel) ifTrue:[ |
|
1629 |
changeType := '(class definition)'. |
|
1630 |
]. |
|
1631 |
] |
|
1632 |
] ifTrue:[ "sawExcla" |
|
1633 |
|done first p className cls text methodPos| |
|
1634 |
||
1635 |
" |
|
1636 |
method definitions actually consist of |
|
1637 |
two (or more) chunks; skip next chunk(s) |
|
1638 |
up to an empty one. |
|
1639 |
The system only writes one chunk, |
|
1640 |
and we cannot handle more in this ChangesBrowser .... |
|
1641 |
" |
|
1642 |
className := nil. |
|
1643 |
p := Parser parseExpression:chunkText inNameSpace:Smalltalk. |
|
1644 |
||
1645 |
(p notNil and:[p ~~ #Error]) ifTrue:[ |
|
1646 |
sel := p selector. |
|
1647 |
(sel == #methodsFor:) ifTrue:[ |
|
1648 |
p receiver isUnaryMessage ifTrue:[ |
|
1649 |
className := p receiver receiver name. |
|
1650 |
changeClass := (Smalltalk classNamed:className) class. |
|
1651 |
className := className , ' class'. |
|
1652 |
] ifFalse:[ |
|
1653 |
className := p receiver name. |
|
1654 |
changeClass := Smalltalk classNamed:className |
|
1655 |
]. |
|
1656 |
category := (p args at:1) evaluate. |
|
1657 |
]. |
|
1658 |
]. |
|
1659 |
||
1660 |
done := false. |
|
1661 |
first := true. |
|
1662 |
[done] whileFalse:[ |
|
1663 |
changeDelta := ' '. |
|
1664 |
methodPos := aStream position. |
|
1665 |
||
1666 |
text := aStream nextChunk. |
|
1667 |
text isNil ifTrue:[ |
|
1668 |
done := true |
|
1669 |
] ifFalse:[ |
|
1670 |
done := text isEmpty |
|
1671 |
]. |
|
1672 |
done ifFalse:[ |
|
1673 |
first ifFalse:[ |
|
1674 |
changeChunks add:chunkText. |
|
1675 |
changePositions add:methodPos. |
|
1676 |
changeTimeStamps add:timeStampInfo. |
|
1677 |
changeIsFollowupMethodChange add:true. |
|
1678 |
editingClassSource := true. |
|
1679 |
]. |
|
1680 |
||
1681 |
first := false. |
|
1682 |
" |
|
1683 |
try to find the selector |
|
1684 |
" |
|
1685 |
sel := nil. |
|
1686 |
className notNil ifTrue:[ |
|
1687 |
p := Parser |
|
1688 |
parseMethodSpecification:text |
|
1689 |
in:nil |
|
1690 |
ignoreErrors:true |
|
1691 |
ignoreWarnings:true. |
|
1692 |
(p notNil and:[p ~~ #Error]) ifTrue:[ |
|
1693 |
sel := p selector. |
|
1694 |
] |
|
1695 |
]. |
|
1696 |
||
1697 |
sel isNil ifTrue:[ |
|
1698 |
changeString := (chunkText contractTo:maxLen). |
|
1699 |
changeType := '(change)'. |
|
1700 |
headerLine := chunkText , ' (change)'. |
|
1701 |
] ifFalse:[ |
|
1702 |
changeString := self contractClass:className selector:sel to:maxLen. |
|
1703 |
changeType := '(method in: ''' , category , ''')'. |
|
1704 |
headerLine := className , ' ' , sel , ' ' , '(change category: ''' , category , ''')'. |
|
1705 |
]. |
|
1706 |
||
1707 |
compareChanges ifTrue:[ |
|
1708 |
changeClass isNil ifFalse:[ |
|
1709 |
changeClass isMeta ifTrue:[ |
|
1710 |
cls := changeClass soleInstance |
|
1711 |
] ifFalse:[ |
|
1712 |
cls := changeClass |
|
1713 |
]. |
|
1714 |
]. |
|
1715 |
||
1716 |
(changeClass isNil or:[cls isLoaded not]) ifTrue:[ |
|
1717 |
changeDelta := '?' |
|
1718 |
] ifFalse:[ |
|
1719 |
(changeClass implements:sel asSymbol) ifFalse:[ |
|
1720 |
changeDelta := '+'. |
|
1721 |
] ifTrue:[ |
|
1722 |
|m currentText t1 t2| |
|
1723 |
||
1724 |
m := changeClass compiledMethodAt:sel asSymbol. |
|
1725 |
currentText := m source. |
|
1726 |
currentText notNil ifTrue:[ |
|
1727 |
text asString = currentText asString ifTrue:[ |
|
1728 |
changeDelta := '=' |
|
1729 |
] ifFalse:[ |
|
1730 |
t1 := currentText asCollectionOfLines collect:[:s | s withTabsExpanded]. |
|
1731 |
t2 := text asCollectionOfLines collect:[:s | s withTabsExpanded]. |
|
1732 |
t1 = t2 ifTrue:[ |
|
1733 |
changeDelta := '=' |
|
1734 |
] |
|
1735 |
] |
|
1736 |
] |
|
1737 |
] |
|
1738 |
] |
|
1739 |
]. |
|
1740 |
entry := MultiColListEntry new. |
|
1741 |
entry tabulatorSpecification:tabSpec. |
|
1742 |
entry colAt:1 put:changeDelta. |
|
1743 |
entry colAt:2 put:changeString. |
|
1744 |
entry colAt:3 put:changeType. |
|
1745 |
timeStampInfo notNil ifTrue:[ |
|
1746 |
entry colAt:4 put:timeStampInfo. |
|
1747 |
]. |
|
1748 |
changeHeaderLines add:entry |
|
1749 |
]. |
|
1750 |
changeString := nil. |
|
1751 |
headerLine := nil. |
|
1752 |
||
1753 |
] |
|
1754 |
]. |
|
1755 |
changeString notNil ifTrue:[ |
|
1756 |
entry := MultiColListEntry new. |
|
1757 |
entry tabulatorSpecification:tabSpec. |
|
1758 |
entry colAt:1 put:changeDelta. |
|
1759 |
entry colAt:2 put:changeString. |
|
1760 |
entry colAt:3 put:changeType. |
|
1761 |
timeStampInfo notNil ifTrue:[ |
|
1762 |
entry colAt:4 put:timeStampInfo. |
|
1763 |
]. |
|
1764 |
changeHeaderLines add:entry |
|
1765 |
] ifFalse:[ |
|
1766 |
headerLine notNil ifTrue:[ |
|
1767 |
changeHeaderLines add:headerLine |
|
1768 |
] |
|
1769 |
] |
|
1770 |
] |
|
1771 |
] |
|
1772 |
]. |
|
1773 |
changeClassNames := OrderedCollection new grow:(changeChunks size). |
|
1774 |
anyChanges := false |
|
1775 |
] valueNowOrOnUnwindDo:[ |
|
1776 |
aStream close. |
|
1777 |
inBackground ifTrue:[myProcess priority:myPriority]. |
|
1778 |
]. |
|
133 | 1779 |
]. |
1780 |
||
1781 |
self checkIfFileHasChanged |
|
123 | 1782 |
|
1783 |
"Modified: 27.8.1995 / 23:06:55 / claus" |
|
1200
71de763d5847
always parse expressions in the Smalltalk nameSpace
Claus Gittinger <cg@exept.de>
parents:
1153
diff
changeset
|
1784 |
"Modified: 24.6.1997 / 16:44:57 / cg" |
45 | 1785 |
! |
37 | 1786 |
|
209
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1787 |
selectorOfMethodChange:changeNr |
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1788 |
"return a method-changes selector, or nil if its not a methodChange" |
209
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1789 |
|
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1790 |
|source parser sel| |
209
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1791 |
|
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1792 |
source := self sourceOfMethodChange:changeNr. |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1793 |
source isNil ifTrue:[^ nil]. |
209
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1794 |
|
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1795 |
parser := Parser |
1378 | 1796 |
parseMethod:source |
1797 |
in:nil |
|
1798 |
ignoreErrors:true |
|
1799 |
ignoreWarnings:true. |
|
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1800 |
|
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1801 |
(parser notNil and:[parser ~~ #Error]) ifTrue:[ |
1378 | 1802 |
sel := parser selector. |
209
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1803 |
]. |
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1804 |
^ sel |
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1805 |
|
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1806 |
"Created: 24.11.1995 / 14:30:46 / cg" |
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1807 |
"Modified: 5.9.1996 / 17:12:50 / cg" |
209
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1808 |
! |
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1809 |
|
202 | 1810 |
setChangeList |
1811 |
"extract type-information from changes and stuff into top selection |
|
1812 |
view" |
|
51 | 1813 |
|
202 | 1814 |
changeListView setList:changeHeaderLines expandTabs:false. |
1815 |
"/ changeListView deselect. |
|
51 | 1816 |
! |
1817 |
||
73 | 1818 |
silentDeleteChange:changeNr |
1819 |
"delete a change do not update changeListView" |
|
57 | 1820 |
|
73 | 1821 |
anyChanges := true. |
1822 |
changeChunks removeIndex:changeNr. |
|
1823 |
changePositions removeIndex:changeNr. |
|
1824 |
changeClassNames removeIndex:changeNr. |
|
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1825 |
changeHeaderLines removeIndex:changeNr. |
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1826 |
changeTimeStamps removeIndex:changeNr |
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1827 |
|
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1828 |
"Modified: 18.11.1995 / 17:08:44 / cg" |
45 | 1829 |
! |
1830 |
||
202 | 1831 |
silentDeleteChangesFor:aClassName from:start to:stop |
1428
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
1832 |
"delete changes for a given class in a range. |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
1833 |
Return the number of deleted changes." |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
1834 |
|
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
1835 |
|thisClassName index numDeleted| |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
1836 |
|
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
1837 |
numDeleted := 0. |
202 | 1838 |
index := stop. |
1839 |
[index >= start] whileTrue:[ |
|
1428
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
1840 |
thisClassName := self classNameOfChange:index. |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
1841 |
thisClassName = aClassName ifTrue:[ |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
1842 |
self silentDeleteChange:index. |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
1843 |
numDeleted := numDeleted + 1. |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
1844 |
]. |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
1845 |
index := index - 1 |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
1846 |
]. |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
1847 |
^ numDeleted |
51 | 1848 |
|
45 | 1849 |
! |
1850 |
||
1070
cdf5cf202f3b
faster redraw, when deleting items.
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
1851 |
silentDeleteInternalChange:changeNr |
cdf5cf202f3b
faster redraw, when deleting items.
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
1852 |
"delete a change do not update changeListView" |
cdf5cf202f3b
faster redraw, when deleting items.
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
1853 |
|
cdf5cf202f3b
faster redraw, when deleting items.
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
1854 |
anyChanges := true. |
cdf5cf202f3b
faster redraw, when deleting items.
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
1855 |
changeChunks removeIndex:changeNr. |
1473 | 1856 |
changePositions size >= changeNr ifTrue:[changePositions removeIndex:changeNr]. |
1857 |
changeClassNames size >= changeNr ifTrue:[changeClassNames removeIndex:changeNr]. |
|
1496
978b3c3565c9
#silentDeleteInternalChange: copy-paste error
Stefan Vogel <sv@exept.de>
parents:
1473
diff
changeset
|
1858 |
changeTimeStamps size >= changeNr ifTrue:[changeTimeStamps removeIndex:changeNr] |
1473 | 1859 |
|
1860 |
"Created: / 7.3.1997 / 16:28:32 / cg" |
|
1861 |
"Modified: / 7.2.1998 / 19:59:11 / cg" |
|
1496
978b3c3565c9
#silentDeleteInternalChange: copy-paste error
Stefan Vogel <sv@exept.de>
parents:
1473
diff
changeset
|
1862 |
"Modified: / 26.2.1998 / 18:20:48 / stefan" |
1070
cdf5cf202f3b
faster redraw, when deleting items.
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
1863 |
! |
cdf5cf202f3b
faster redraw, when deleting items.
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
1864 |
|
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1865 |
sourceOfMethodChange:changeNr |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1866 |
"return a method-changes source code, or nil if its not a methodChange." |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1867 |
|
742
2ef5e22d8983
code cleanup (unused vars eliminated)
Claus Gittinger <cg@exept.de>
parents:
724
diff
changeset
|
1868 |
|aStream chunk sawExcla parseTree sourceChunk| |
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1869 |
|
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1870 |
aStream := self streamForChange:changeNr. |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1871 |
aStream isNil ifTrue:[^ nil]. |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1872 |
|
1472 | 1873 |
(self changeIsFollowupMethodChange:changeNr) ifFalse:[ |
1874 |
sawExcla := aStream peekFor:(aStream class chunkSeparator). |
|
1875 |
chunk := aStream nextChunk. |
|
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1876 |
] ifTrue:[ |
1472 | 1877 |
chunk := (changeChunks at:changeNr). |
1878 |
sawExcla := true. |
|
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1879 |
]. |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1880 |
|
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1881 |
sawExcla ifTrue:[ |
1472 | 1882 |
parseTree := Parser parseExpression:chunk. |
1883 |
(parseTree notNil and:[parseTree isMessage]) ifTrue:[ |
|
1884 |
(parseTree selector == #methodsFor:) ifTrue:[ |
|
1885 |
sourceChunk := aStream nextChunk. |
|
1886 |
] |
|
1887 |
]. |
|
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1888 |
]. |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1889 |
aStream close. |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1890 |
^ sourceChunk |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1891 |
|
1472 | 1892 |
"Created: / 5.9.1996 / 17:11:32 / cg" |
1893 |
"Modified: / 6.2.1998 / 13:04:26 / cg" |
|
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1894 |
! |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1895 |
|
202 | 1896 |
streamForChange:changeNr |
1897 |
"answer a stream for change" |
|
1898 |
||
1899 |
|aStream| |
|
73 | 1900 |
|
202 | 1901 |
(changeNr between:1 and:changePositions size) ifFalse:[^ nil]. |
1902 |
aStream := FileStream readonlyFileNamed:changeFileName. |
|
1903 |
aStream isNil ifTrue:[^ nil]. |
|
1904 |
aStream position:(changePositions at:changeNr). |
|
1905 |
^ aStream |
|
1906 |
! |
|
1907 |
||
1908 |
unselect |
|
1909 |
"common unselect" |
|
1910 |
||
562
8f772068fd1a
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
1911 |
changeListView setSelection:nil. |
8f772068fd1a
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
1912 |
|
8f772068fd1a
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
1913 |
"Modified: 25.5.1996 / 13:02:49 / cg" |
73 | 1914 |
! |
1915 |
||
1916 |
withSelectedChangeDo:aBlock |
|
1917 |
"just a helper, check for a selected change and evaluate aBlock |
|
1918 |
with busy cursor" |
|
1919 |
||
1920 |
|changeNr| |
|
1921 |
||
1922 |
changeNr := changeListView selection. |
|
1923 |
changeNr notNil ifTrue:[ |
|
1378 | 1924 |
self withExecuteCursorDo:[ |
1925 |
aBlock value:changeNr |
|
1926 |
] |
|
73 | 1927 |
] |
294 | 1928 |
|
1929 |
"Modified: 14.12.1995 / 20:58:45 / cg" |
|
73 | 1930 |
! |
1931 |
||
45 | 1932 |
writeBackChanges |
163
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1933 |
"write back the changes file. To avoid problems when the disk is full |
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1934 |
or a crash occurs while writing (well, or someone kills us), |
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1935 |
first write the stuff to a new temporary file. If this works ok, |
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1936 |
rename the old change-file to a .bak file and finally rename the |
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1937 |
tempfile back to the change-file. |
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1938 |
That way, if anything happens, either the original file is left unchanged, |
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1939 |
or we have at least a backup of the previous change file." |
45 | 1940 |
|
1316 | 1941 |
|inStream outStream tempfile stamp f| |
163
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1942 |
|
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1943 |
editingClassSource ifTrue:[ |
1378 | 1944 |
(self confirm:'You are editing a classes sourceFile (not a changeFile) !!\\Are you certain, you want to overwrite it ?' withCRs) |
1945 |
ifFalse:[ |
|
1946 |
^ false |
|
1947 |
] |
|
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1948 |
]. |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1949 |
|
163
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1950 |
tempfile := Filename newTemporaryIn:nil. |
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1951 |
tempfile exists ifTrue:[tempfile remove]. |
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1952 |
|
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1953 |
outStream := tempfile writeStream. |
45 | 1954 |
outStream isNil ifTrue:[ |
1378 | 1955 |
self warn:'cannot create temporary file in current directory.'. |
1956 |
^ false |
|
45 | 1957 |
]. |
1958 |
||
1959 |
inStream := FileStream readonlyFileNamed:changeFileName. |
|
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1960 |
inStream isNil ifTrue:[^ false]. |
45 | 1961 |
|
1962 |
self withCursor:(Cursor write) do:[ |
|
1378 | 1963 |
|excla sawExcla done chunk |
1964 |
nChanges "{Class:SmallInteger}" | |
|
1965 |
||
1966 |
Stream writeErrorSignal handle:[:ex | |
|
1967 |
self warn:('could not update the changes file.\\' , ex errorString) withCRs. |
|
1968 |
^ false |
|
1969 |
] do:[ |
|
1970 |
||
1971 |
excla := inStream class chunkSeparator. |
|
1972 |
nChanges := self numberOfChanges. |
|
1973 |
||
1974 |
1 to:nChanges do:[:index | |
|
1975 |
inStream position:(changePositions at:index). |
|
1976 |
sawExcla := inStream peekFor:excla. |
|
1977 |
chunk := inStream nextChunk. |
|
1978 |
(stamp := changeTimeStamps at:index) notNil ifTrue:[ |
|
1979 |
outStream nextPutAll:'''---- timestamp ' , stamp , ' ----'''. |
|
1980 |
outStream nextPut:excla; cr. |
|
1981 |
]. |
|
1982 |
||
1983 |
sawExcla ifTrue:[ |
|
1984 |
outStream nextPut:excla. |
|
1985 |
outStream nextChunkPut:chunk. |
|
1986 |
outStream cr. |
|
1987 |
" |
|
1988 |
a method-definition chunk - skip followups |
|
1989 |
" |
|
1990 |
done := false. |
|
1991 |
[done] whileFalse:[ |
|
1992 |
chunk := inStream nextChunk. |
|
1993 |
chunk isNil ifTrue:[ |
|
1994 |
done := true |
|
1995 |
] ifFalse:[ |
|
1996 |
outStream nextChunkPut:chunk. |
|
1997 |
outStream cr. |
|
1998 |
done := chunk isEmpty |
|
1999 |
] |
|
2000 |
]. |
|
2001 |
] ifFalse:[ |
|
2002 |
outStream nextChunkPut:chunk. |
|
2003 |
outStream cr |
|
2004 |
] |
|
2005 |
]. |
|
2006 |
outStream close. |
|
2007 |
inStream close. |
|
2008 |
]. |
|
1264
6d8f690883f1
care for write-errors while saving the changeFile
Claus Gittinger <cg@exept.de>
parents:
1246
diff
changeset
|
2009 |
|
1316 | 2010 |
f := changeFileName asFilename. |
1321 | 2011 |
f renameTo:(f withSuffix:'bak'). |
1378 | 2012 |
tempfile renameTo:changeFileName. |
2013 |
anyChanges := false |
|
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
2014 |
]. |
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
2015 |
^ true |
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
2016 |
|
1014
2197dfb7c573
Use Filename instead of FileDirectory.
Stefan Vogel <sv@exept.de>
parents:
975
diff
changeset
|
2017 |
"Modified: 2.12.1996 / 22:29:15 / stefan" |
1264
6d8f690883f1
care for write-errors while saving the changeFile
Claus Gittinger <cg@exept.de>
parents:
1246
diff
changeset
|
2018 |
"Modified: 31.7.1997 / 18:27:14 / cg" |
202 | 2019 |
! ! |
0 | 2020 |
|
202 | 2021 |
!ChangesBrowser methodsFor:'termination'! |
51 | 2022 |
|
202 | 2023 |
destroy |
2024 |
"destroy the receiver; make certain, that boxes are destroyed too" |
|
73 | 2025 |
|
202 | 2026 |
Processor removeTimedBlock:checkBlock. |
2027 |
ObjectMemory removeDependent:self. |
|
2028 |
super destroy |
|
51 | 2029 |
! |
2030 |
||
202 | 2031 |
saveAndTerminate |
2032 |
"update the changes file and quit. |
|
2033 |
Dont depend on this being sent, not all window managers |
|
2034 |
send it; instead, they simply destroy the view." |
|
28 | 2035 |
|
202 | 2036 |
anyChanges ifTrue:[ |
2037 |
self writeBackChanges. |
|
0 | 2038 |
]. |
202 | 2039 |
self destroy |
0 | 2040 |
! |
2041 |
||
202 | 2042 |
terminate |
2043 |
"window manager wants us to go away" |
|
28 | 2044 |
|
1264
6d8f690883f1
care for write-errors while saving the changeFile
Claus Gittinger <cg@exept.de>
parents:
1246
diff
changeset
|
2045 |
|action again| |
0 | 2046 |
|
202 | 2047 |
anyChanges ifTrue:[ |
1378 | 2048 |
again := true. |
2049 |
[again] whileTrue:[ |
|
2050 |
action := OptionBox |
|
2051 |
request:(resources at:'changefile has not been updated from the modified changelist.\\Update before closing ?') withCRs |
|
2052 |
label:'ChangesBrowser' |
|
2053 |
form:(WarningBox iconBitmap) |
|
2054 |
buttonLabels:(resources array:#('cancel' 'don''t update' 'update')) |
|
2055 |
values:#(#abort #ignore #save) |
|
2056 |
default:#save. |
|
2057 |
||
2058 |
again := false. |
|
2059 |
action == #abort ifTrue:[^ self]. |
|
2060 |
action == #save ifTrue:[ |
|
2061 |
again := self writeBackChanges not |
|
2062 |
]. |
|
2063 |
] |
|
202 | 2064 |
]. |
2065 |
self destroy |
|
373 | 2066 |
|
1264
6d8f690883f1
care for write-errors while saving the changeFile
Claus Gittinger <cg@exept.de>
parents:
1246
diff
changeset
|
2067 |
"Modified: 31.7.1997 / 18:29:06 / cg" |
0 | 2068 |
! ! |
2069 |
||
73 | 2070 |
!ChangesBrowser methodsFor:'user interaction'! |
51 | 2071 |
|
221 | 2072 |
autoUpdate:aBoolean |
2073 |
autoUpdate := aBoolean |
|
2074 |
||
2075 |
"Created: 3.12.1995 / 14:14:24 / cg" |
|
2076 |
"Modified: 3.12.1995 / 14:20:45 / cg" |
|
2077 |
! |
|
2078 |
||
0 | 2079 |
changeSelection:lineNr |
2080 |
"show a change in the codeView" |
|
2081 |
||
2082 |
|aStream sawExcla chunk| |
|
2083 |
||
2084 |
aStream := self streamForChange:lineNr. |
|
2085 |
aStream isNil ifTrue:[^ self]. |
|
2086 |
sawExcla := aStream peekFor:(aStream class chunkSeparator). |
|
2087 |
chunk := aStream nextChunk. |
|
2088 |
sawExcla ifTrue:[ |
|
45 | 2089 |
chunk := aStream nextChunk |
0 | 2090 |
]. |
2091 |
aStream close. |
|
2092 |
codeView contents:chunk. |
|
13 | 2093 |
codeView acceptAction:[:theCode | self doApply "noChangesAllowed"]. |
15 | 2094 |
changeNrShown := lineNr. |
0 | 2095 |
|
51 | 2096 |
! |
2097 |
||
202 | 2098 |
doApply |
2099 |
"user wants a change to be applied" |
|
45 | 2100 |
|
202 | 2101 |
self withSelectedChangeDo:[:changeNr | |
2102 |
skipSignal := nil. |
|
2103 |
self applyChange:changeNr. |
|
2104 |
self autoSelect:(changeNr + 1) |
|
2105 |
] |
|
45 | 2106 |
! |
2107 |
||
202 | 2108 |
doApplyAll |
2109 |
"user wants all changes to be applied" |
|
37 | 2110 |
|
294 | 2111 |
self withExecuteCursorDo:[ |
1378 | 2112 |
|lastNr "{ Class: SmallInteger }" | |
2113 |
||
2114 |
self clearCodeView. |
|
2115 |
skipSignal isNil ifTrue:[skipSignal := Signal new]. |
|
2116 |
lastNr := self numberOfChanges. |
|
2117 |
1 to:lastNr do:[:changeNr | |
|
2118 |
changeListView setSelection:changeNr. |
|
2119 |
self applyChange:changeNr |
|
2120 |
]. |
|
2121 |
self autoSelectLast |
|
202 | 2122 |
] |
294 | 2123 |
|
975
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2124 |
"Modified: 21.1.1997 / 22:26:30 / cg" |
37 | 2125 |
! |
2126 |
||
202 | 2127 |
doApplyClassRest |
2128 |
"user wants all changes for this class from changeNr to be applied" |
|
2129 |
||
2130 |
self withSelectedChangeDo:[:changeNr | |
|
1378 | 2131 |
|thisClassName classNameToApply lastChange |
2132 |
lastNr "{ Class: SmallInteger }" | |
|
2133 |
||
2134 |
classNameToApply := self classNameOfChange:changeNr. |
|
2135 |
classNameToApply notNil ifTrue:[ |
|
2136 |
self clearCodeView. |
|
2137 |
skipSignal isNil ifTrue:[skipSignal := Signal new]. |
|
2138 |
||
2139 |
lastNr := self numberOfChanges. |
|
2140 |
changeNr to:lastNr do:[:changeNr | |
|
2141 |
thisClassName := self classNameOfChange:changeNr. |
|
2142 |
thisClassName = classNameToApply ifTrue:[ |
|
2143 |
changeListView setSelection:changeNr. |
|
2144 |
self applyChange:changeNr. |
|
2145 |
lastChange := changeNr |
|
2146 |
]. |
|
2147 |
]. |
|
2148 |
self autoSelect:lastChange. |
|
2149 |
] |
|
202 | 2150 |
] |
562
8f772068fd1a
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
2151 |
|
975
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2152 |
"Modified: 21.1.1997 / 22:26:04 / cg" |
37 | 2153 |
! |
2154 |
||
202 | 2155 |
doApplyRest |
2156 |
"user wants all changes from changeNr to be applied" |
|
28 | 2157 |
|
202 | 2158 |
self withSelectedChangeDo:[:changeNr | |
1378 | 2159 |
|lastNr "{ Class: SmallInteger }" | |
2160 |
||
2161 |
self clearCodeView. |
|
2162 |
skipSignal isNil ifTrue:[skipSignal := Signal new]. |
|
2163 |
||
2164 |
lastNr := self numberOfChanges. |
|
2165 |
changeNr to:lastNr do:[:changeNr | |
|
2166 |
changeListView setSelection:changeNr. |
|
2167 |
self applyChange:changeNr |
|
2168 |
]. |
|
2169 |
self autoSelect:self numberOfChanges. |
|
37 | 2170 |
] |
562
8f772068fd1a
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
2171 |
|
975
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2172 |
"Modified: 21.1.1997 / 22:25:29 / cg" |
37 | 2173 |
! |
2174 |
||
45 | 2175 |
doBrowse |
2176 |
"user wants a browser on the class of a change" |
|
2177 |
||
241
9366ced0db42
doBrowse was wrong for class-methods
Claus Gittinger <cg@exept.de>
parents:
226
diff
changeset
|
2178 |
|changeNr className cls isMeta| |
45 | 2179 |
|
2180 |
changeNr := changeListView selection. |
|
2181 |
changeNr notNil ifTrue:[ |
|
241
9366ced0db42
doBrowse was wrong for class-methods
Claus Gittinger <cg@exept.de>
parents:
226
diff
changeset
|
2182 |
className := self fullClassNameOfChange:changeNr. |
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
2183 |
className notNil ifTrue:[ |
241
9366ced0db42
doBrowse was wrong for class-methods
Claus Gittinger <cg@exept.de>
parents:
226
diff
changeset
|
2184 |
isMeta := false. |
9366ced0db42
doBrowse was wrong for class-methods
Claus Gittinger <cg@exept.de>
parents:
226
diff
changeset
|
2185 |
(className endsWith:' class') ifTrue:[ |
9366ced0db42
doBrowse was wrong for class-methods
Claus Gittinger <cg@exept.de>
parents:
226
diff
changeset
|
2186 |
className := className copyWithoutLast:6. |
9366ced0db42
doBrowse was wrong for class-methods
Claus Gittinger <cg@exept.de>
parents:
226
diff
changeset
|
2187 |
isMeta := true. |
9366ced0db42
doBrowse was wrong for class-methods
Claus Gittinger <cg@exept.de>
parents:
226
diff
changeset
|
2188 |
]. |
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
2189 |
(cls := Smalltalk classNamed:className) notNil ifTrue:[ |
241
9366ced0db42
doBrowse was wrong for class-methods
Claus Gittinger <cg@exept.de>
parents:
226
diff
changeset
|
2190 |
isMeta ifTrue:[ |
9366ced0db42
doBrowse was wrong for class-methods
Claus Gittinger <cg@exept.de>
parents:
226
diff
changeset
|
2191 |
cls := cls class |
9366ced0db42
doBrowse was wrong for class-methods
Claus Gittinger <cg@exept.de>
parents:
226
diff
changeset
|
2192 |
]. |
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
2193 |
SystemBrowser |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
2194 |
openInClass:cls |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
2195 |
selector:(self selectorOfMethodChange:changeNr) |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
2196 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
2197 |
] |
37 | 2198 |
] |
209
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
2199 |
|
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
2200 |
"Created: 24.11.1995 / 23:13:24 / cg" |
241
9366ced0db42
doBrowse was wrong for class-methods
Claus Gittinger <cg@exept.de>
parents:
226
diff
changeset
|
2201 |
"Modified: 6.12.1995 / 17:09:26 / cg" |
37 | 2202 |
! |
2203 |
||
73 | 2204 |
doCompare |
2205 |
"compare change with current system version |
|
2206 |
- give a note in transcript" |
|
2207 |
||
2208 |
|changeNr| |
|
2209 |
||
2210 |
changeNr := changeListView selection. |
|
2211 |
changeNr notNil ifTrue:[ |
|
1378 | 2212 |
self withExecuteCursorDo:[ |
2213 |
self compareChange:changeNr |
|
2214 |
] |
|
394 | 2215 |
]. |
2216 |
self newLabel:'' |
|
294 | 2217 |
|
394 | 2218 |
"Modified: 24.2.1996 / 19:37:19 / cg" |
73 | 2219 |
! |
2220 |
||
45 | 2221 |
doCompress |
2222 |
"compress the change-set; this replaces multiple method-changes by the last |
|
2223 |
(i.e. the most recent) change" |
|
2224 |
||
1359 | 2225 |
self compressForClass:nil |
2226 |
||
2227 |
"Modified: / 29.10.1997 / 01:03:26 / cg" |
|
2228 |
! |
|
2229 |
||
2230 |
doCompressClass |
|
2231 |
"compress changes for the selected class. |
|
2232 |
this replaces multiple method-changes by the last (i.e. the most recent) change." |
|
2233 |
||
2234 |
self withSelectedChangeDo:[:changeNr | |
|
1378 | 2235 |
| classNameToCompress | |
2236 |
||
2237 |
classNameToCompress := self classNameOfChange:changeNr. |
|
2238 |
classNameToCompress notNil ifTrue:[ |
|
2239 |
self compressForClass:classNameToCompress. |
|
2240 |
] |
|
1359 | 2241 |
] |
2242 |
||
2243 |
"Created: / 29.10.1997 / 01:05:16 / cg" |
|
2244 |
"Modified: / 29.10.1997 / 01:06:22 / cg" |
|
45 | 2245 |
! |
2246 |
||
202 | 2247 |
doDelete |
2248 |
"delete currently selected change" |
|
2249 |
||
2250 |
|changeNr| |
|
73 | 2251 |
|
202 | 2252 |
changeNr := changeListView selection. |
2253 |
changeNr notNil ifTrue:[ |
|
2254 |
self deleteChange:changeNr. |
|
2255 |
self autoSelectOrEnd:changeNr |
|
73 | 2256 |
] |
2257 |
! |
|
2258 |
||
202 | 2259 |
doDeleteClassAll |
2260 |
"delete all changes with same class as currently selected change" |
|
2261 |
||
2262 |
self withSelectedChangeDo:[:changeNr | |
|
1428
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2263 |
|classNameToDelete numDeletedBefore| |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2264 |
|
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2265 |
classNameToDelete := self classNameOfChange:changeNr. |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2266 |
classNameToDelete notNil ifTrue:[ |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2267 |
changeListView setSelection:nil. |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2268 |
self silentDeleteChangesFor:classNameToDelete |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2269 |
from:changeNr |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2270 |
to:(self numberOfChanges). |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2271 |
numDeletedBefore := self |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2272 |
silentDeleteChangesFor:classNameToDelete |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2273 |
from:1 |
1431 | 2274 |
to:(changeNr-1). |
1428
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2275 |
self setChangeList. |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2276 |
self autoSelectOrEnd:(changeNr - numDeletedBefore) |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2277 |
] |
51 | 2278 |
] |
286
96d31200b0c1
added delete-for-class-from-beginning; ignore timestamps for fileOut/checkin/snapshot entries
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2279 |
|
1431 | 2280 |
"Created: / 13.12.1995 / 16:07:14 / cg" |
2281 |
"Modified: / 28.1.1998 / 20:42:14 / cg" |
|
286
96d31200b0c1
added delete-for-class-from-beginning; ignore timestamps for fileOut/checkin/snapshot entries
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2282 |
! |
96d31200b0c1
added delete-for-class-from-beginning; ignore timestamps for fileOut/checkin/snapshot entries
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2283 |
|
96d31200b0c1
added delete-for-class-from-beginning; ignore timestamps for fileOut/checkin/snapshot entries
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2284 |
doDeleteClassFromBeginning |
96d31200b0c1
added delete-for-class-from-beginning; ignore timestamps for fileOut/checkin/snapshot entries
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2285 |
"delete changes with same class as currently selected change from the beginning |
96d31200b0c1
added delete-for-class-from-beginning; ignore timestamps for fileOut/checkin/snapshot entries
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2286 |
up to the selected change. |
96d31200b0c1
added delete-for-class-from-beginning; ignore timestamps for fileOut/checkin/snapshot entries
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2287 |
Useful to get rid of obsolete changes before a fileout or checkin entry." |
96d31200b0c1
added delete-for-class-from-beginning; ignore timestamps for fileOut/checkin/snapshot entries
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2288 |
|
96d31200b0c1
added delete-for-class-from-beginning; ignore timestamps for fileOut/checkin/snapshot entries
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2289 |
self withSelectedChangeDo:[:changeNr | |
1428
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2290 |
|classNameToDelete prevSelection numDeleted| |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2291 |
|
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2292 |
classNameToDelete := self classNameOfChange:changeNr. |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2293 |
classNameToDelete notNil ifTrue:[ |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2294 |
prevSelection := changeNr. |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2295 |
changeListView setSelection:nil. |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2296 |
numDeleted := self |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2297 |
silentDeleteChangesFor:classNameToDelete |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2298 |
from:1 |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2299 |
to:changeNr. |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2300 |
self setChangeList. |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2301 |
self autoSelectOrEnd:(changeNr + 1 - numDeleted) |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2302 |
] |
180d03d00db4
fixed selection after deleting a bunch of changes
Claus Gittinger <cg@exept.de>
parents:
1427
diff
changeset
|
2303 |
]. |
286
96d31200b0c1
added delete-for-class-from-beginning; ignore timestamps for fileOut/checkin/snapshot entries
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2304 |
|
96d31200b0c1
added delete-for-class-from-beginning; ignore timestamps for fileOut/checkin/snapshot entries
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
2305 |
"Created: 13.12.1995 / 15:41:58 / cg" |
562
8f772068fd1a
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
2306 |
"Modified: 25.5.1996 / 12:26:34 / cg" |
51 | 2307 |
! |
2308 |
||
73 | 2309 |
doDeleteClassRest |
2310 |
"delete rest of changes with same class as currently selected change" |
|
2311 |
||
2312 |
self withSelectedChangeDo:[:changeNr | |
|
1378 | 2313 |
| classNameToDelete | |
2314 |
||
2315 |
classNameToDelete := self classNameOfChange:changeNr. |
|
2316 |
classNameToDelete notNil ifTrue:[ |
|
2317 |
changeListView setSelection:nil. |
|
2318 |
self silentDeleteChangesFor:classNameToDelete |
|
2319 |
from:changeNr |
|
2320 |
to:(self numberOfChanges). |
|
2321 |
self setChangeList. |
|
2322 |
self autoSelectOrEnd:changeNr |
|
2323 |
] |
|
73 | 2324 |
] |
562
8f772068fd1a
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
2325 |
|
8f772068fd1a
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
2326 |
"Modified: 25.5.1996 / 12:26:39 / cg" |
73 | 2327 |
! |
2328 |
||
202 | 2329 |
doDeleteRest |
2330 |
"delete all changes from current to the end" |
|
51 | 2331 |
|
202 | 2332 |
|changeNr| |
51 | 2333 |
|
202 | 2334 |
changeNr := changeListView selection. |
2335 |
changeNr notNil ifTrue:[ |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
2336 |
self deleteChangesFrom:changeNr to:(self numberOfChanges). |
202 | 2337 |
self clearCodeView. |
2338 |
self autoSelectOrEnd:changeNr-1 |
|
51 | 2339 |
] |
132 | 2340 |
! |
2341 |
||
2342 |
doFileoutAndDeleteClassAll |
|
2343 |
"first fileOut the selected changes class then delete all changes |
|
2344 |
for it." |
|
2345 |
||
2346 |
self withSelectedChangeDo:[:changeNr | |
|
2347 |
| className class | |
|
2348 |
||
2349 |
className := self classNameOfChange:changeNr. |
|
2350 |
className notNil ifTrue:[ |
|
2351 |
class := Smalltalk classNamed:className. |
|
2352 |
class notNil ifTrue:[ |
|
2353 |
Class fileOutErrorSignal handle:[:ex | |
|
2354 |
self warn:('fileout failed: ' , ex errorString). |
|
2355 |
] do:[ |
|
2356 |
class fileOut. |
|
2357 |
self doDeleteClassAll |
|
2358 |
]. |
|
2359 |
]. |
|
2360 |
||
2361 |
]. |
|
2362 |
] |
|
2363 |
||
2364 |
"Modified: 6.9.1995 / 17:11:16 / claus" |
|
202 | 2365 |
! |
73 | 2366 |
|
202 | 2367 |
doMakePatch |
2368 |
"user wants a change to be made a patch |
|
2369 |
- copy it over to the patches file" |
|
89 | 2370 |
|
202 | 2371 |
|changeNr| |
89 | 2372 |
|
202 | 2373 |
changeNr := changeListView selection. |
2374 |
changeNr notNil ifTrue:[ |
|
2375 |
self makeChangeAPatch:changeNr. |
|
2376 |
self autoSelect:(changeNr + 1) |
|
2377 |
] |
|
73 | 2378 |
! |
2379 |
||
202 | 2380 |
doMakePermanent |
2381 |
"user wants a change to be made permanent |
|
2382 |
- rewrite the source file where this change has to go" |
|
2383 |
||
2384 |
|yesNoBox| |
|
73 | 2385 |
|
202 | 2386 |
yesNoBox := YesNoBox new. |
2387 |
yesNoBox title:(resources at:'Warning: this operation cannot be undone'). |
|
1378 | 2388 |
yesNoBox okText:(resources at:'continue') noText:(resources at:'abort'). |
202 | 2389 |
yesNoBox okAction:[ |changeNr| |
2390 |
||
1378 | 2391 |
changeNr := changeListView selection. |
2392 |
changeNr notNil ifTrue:[ |
|
2393 |
self makeChangePermanent:changeNr. |
|
2394 |
self autoSelect:(changeNr + 1) |
|
2395 |
] |
|
2396 |
]. |
|
917 | 2397 |
yesNoBox showAtPointer. |
2398 |
yesNoBox destroy |
|
2399 |
||
2400 |
"Modified: 7.1.1997 / 23:03:33 / cg" |
|
73 | 2401 |
! |
2402 |
||
202 | 2403 |
doSave |
2404 |
"user wants a change to be appended to a file" |
|
73 | 2405 |
|
202 | 2406 |
|changeNr fileName| |
73 | 2407 |
|
202 | 2408 |
changeNr := changeListView selection. |
2409 |
changeNr notNil ifTrue:[ |
|
1473 | 2410 |
fileName := Dialog |
2411 |
requestFileName:'append change to:' |
|
2412 |
default:'' |
|
2413 |
ok:'append' |
|
2414 |
abort:'abort' |
|
2415 |
pattern:'*.chg'. |
|
2416 |
||
2417 |
fileName notNil ifTrue:[ |
|
2418 |
self withCursor:(Cursor write) do:[ |
|
2419 |
self appendChange:changeNr toFile:fileName. |
|
2420 |
]. |
|
2421 |
self autoSelect:(changeNr + 1) |
|
2422 |
]. |
|
202 | 2423 |
] |
73 | 2424 |
! |
2425 |
||
202 | 2426 |
doSaveClass |
2427 |
"user wants changes for some class from current to end to be appended to a file" |
|
89 | 2428 |
|
202 | 2429 |
self doSaveClassFrom:1 |
89 | 2430 |
! |
2431 |
||
202 | 2432 |
doSaveClassAll |
2433 |
"user wants changes for some class from current to end to be appended to a file" |
|
73 | 2434 |
|
202 | 2435 |
self doSaveClassFrom:1 |
2436 |
! |
|
2437 |
||
2438 |
doSaveClassFrom:startNr |
|
2439 |
"user wants changes from current to end to be appended to a file" |
|
2440 |
||
2441 |
|changeNr classNameToSave| |
|
73 | 2442 |
|
202 | 2443 |
changeNr := changeListView selection. |
2444 |
changeNr notNil ifTrue:[ |
|
2445 |
classNameToSave := self classNameOfChange:changeNr. |
|
2446 |
classNameToSave notNil ifTrue:[ |
|
2447 |
self saveClass:classNameToSave from:startNr |
|
2448 |
] |
|
2449 |
] |
|
2450 |
! |
|
73 | 2451 |
|
202 | 2452 |
doSaveClassRest |
2453 |
"user wants changes for some class from current to end to be appended to a file" |
|
73 | 2454 |
|
202 | 2455 |
|changeNr| |
132 | 2456 |
|
202 | 2457 |
changeNr := changeListView selection. |
2458 |
changeNr notNil ifTrue:[ |
|
2459 |
self doSaveClassFrom:changeNr |
|
2460 |
] |
|
81 | 2461 |
! |
2462 |
||
202 | 2463 |
doSaveRest |
2464 |
"user wants changes from current to end to be appended to a file" |
|
73 | 2465 |
|
202 | 2466 |
|changeNr fileName| |
51 | 2467 |
|
202 | 2468 |
changeNr := changeListView selection. |
2469 |
changeNr notNil ifTrue:[ |
|
1378 | 2470 |
fileName := Dialog |
2471 |
requestFileName:'append changes to:' |
|
2472 |
default:'' |
|
2473 |
ok:'append' |
|
2474 |
abort:'abort' |
|
2475 |
pattern:'*.chg'. |
|
2476 |
||
2477 |
fileName notNil ifTrue:[ |
|
2478 |
self withCursor:(Cursor write) do:[ |
|
2479 |
changeNr to:(self numberOfChanges) do:[:changeNr | |
|
2480 |
changeListView setSelection:changeNr. |
|
2481 |
(self appendChange:changeNr toFile:fileName) ifFalse:[ |
|
2482 |
^ self |
|
2483 |
] |
|
2484 |
] |
|
2485 |
] |
|
2486 |
]. |
|
202 | 2487 |
] |
562
8f772068fd1a
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
2488 |
|
8f772068fd1a
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
2489 |
"Modified: 25.5.1996 / 12:26:41 / cg" |
51 | 2490 |
! |
2491 |
||
202 | 2492 |
doUpdate |
2493 |
"reread the changes-file" |
|
51 | 2494 |
|
202 | 2495 |
self readChangesFileInBackground:true. |
2496 |
realized ifTrue:[ |
|
2497 |
self setChangeList. |
|
2498 |
] |
|
2499 |
||
51 | 2500 |
! |
2501 |
||
202 | 2502 |
doWriteBack |
2503 |
"write back the list onto the changes file" |
|
51 | 2504 |
|
2505 |
anyChanges ifTrue:[ |
|
1378 | 2506 |
(self writeBackChanges) ifTrue:[ |
2507 |
realized ifTrue:[ |
|
2508 |
self readChangesFileInBackground:false. |
|
2509 |
realized ifTrue:[ |
|
2510 |
self setChangeList |
|
2511 |
] |
|
2512 |
] |
|
2513 |
] |
|
202 | 2514 |
] |
703
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
2515 |
|
1b3b008d9f19
fixed to allow class-source files to be handled
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
2516 |
"Modified: 5.9.1996 / 17:19:46 / cg" |
202 | 2517 |
! |
126 | 2518 |
|
1471 | 2519 |
doubleClickOnChange:lineNr |
2520 |
self doBrowse |
|
2521 |
||
2522 |
"Created: / 6.2.1998 / 13:08:49 / cg" |
|
2523 |
! |
|
2524 |
||
1127 | 2525 |
findClass |
2526 |
|nm current savedCursor search| |
|
2527 |
||
2528 |
changeNrShown notNil ifTrue:[ |
|
1378 | 2529 |
current := self classNameOfChange:changeNrShown. |
1127 | 2530 |
]. |
1275 | 2531 |
nm := Dialog |
1378 | 2532 |
request:'class to search for:' |
2533 |
initialAnswer:current |
|
2534 |
onCancel:nil. |
|
1275 | 2535 |
nm isNil ifTrue:[ |
1378 | 2536 |
^ self |
1275 | 2537 |
]. |
1127 | 2538 |
|
2539 |
changeNrShown isNil ifTrue:[ |
|
1378 | 2540 |
search := 1. |
1127 | 2541 |
] ifFalse:[ |
1378 | 2542 |
search := changeNrShown + 1 |
1127 | 2543 |
]. |
2544 |
||
2545 |
self withCursor:Cursor questionMark do:[ |
|
1378 | 2546 |
|lastNr cls nr thisClass | |
2547 |
||
2548 |
lastNr := self numberOfChanges. |
|
2549 |
nr := search. |
|
2550 |
[nr <= lastNr] whileTrue:[ |
|
2551 |
thisClass := self classNameOfChange:nr. |
|
2552 |
thisClass = nm ifTrue:[ |
|
2553 |
changeListView setSelection:nr. |
|
2554 |
self changeSelection:nr. |
|
2555 |
^ self |
|
2556 |
]. |
|
2557 |
nr := nr + 1. |
|
2558 |
]. |
|
1127 | 2559 |
]. |
2560 |
self beep. |
|
2561 |
||
2562 |
savedCursor := cursor. |
|
2563 |
self cursor:(Cursor cross). |
|
1150
fc05bbed9e43
Use 'Delay' instead of Process waitForMilliseconds:
Stefan Vogel <sv@exept.de>
parents:
1127
diff
changeset
|
2564 |
Delay waitForMilliseconds:300. |
1127 | 2565 |
self cursor:savedCursor |
2566 |
||
2567 |
"Created: 8.4.1997 / 11:00:16 / cg" |
|
1150
fc05bbed9e43
Use 'Delay' instead of Process waitForMilliseconds:
Stefan Vogel <sv@exept.de>
parents:
1127
diff
changeset
|
2568 |
"Modified: 18.4.1997 / 12:47:52 / stefan" |
1275 | 2569 |
"Modified: 5.8.1997 / 23:13:39 / cg" |
1127 | 2570 |
! |
2571 |
||
975
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2572 |
findNextForClass |
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2573 |
|savedCursor| |
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2574 |
|
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2575 |
changeNrShown isNil ifTrue:[^ self]. |
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2576 |
|
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2577 |
self withCursor:Cursor questionMark do:[ |
1378 | 2578 |
|lastNr cls nr thisClass | |
2579 |
||
2580 |
cls := self classNameOfChange:changeNrShown. |
|
2581 |
cls isNil ifTrue:[^ self]. |
|
2582 |
||
2583 |
lastNr := self numberOfChanges. |
|
2584 |
nr := changeNrShown + 1. |
|
2585 |
[nr <= lastNr] whileTrue:[ |
|
2586 |
thisClass := self classNameOfChange:nr. |
|
2587 |
thisClass = cls ifTrue:[ |
|
2588 |
changeListView setSelection:nr . |
|
2589 |
self changeSelection:nr. |
|
2590 |
^ self |
|
2591 |
]. |
|
2592 |
nr := nr + 1. |
|
2593 |
]. |
|
975
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2594 |
]. |
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2595 |
self beep. |
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2596 |
|
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2597 |
savedCursor := cursor. |
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2598 |
self cursor:(Cursor cross). |
1150
fc05bbed9e43
Use 'Delay' instead of Process waitForMilliseconds:
Stefan Vogel <sv@exept.de>
parents:
1127
diff
changeset
|
2599 |
Delay waitForMilliseconds:300. |
975
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2600 |
self cursor:savedCursor |
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2601 |
|
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2602 |
"Created: 21.1.1997 / 22:28:07 / cg" |
1150
fc05bbed9e43
Use 'Delay' instead of Process waitForMilliseconds:
Stefan Vogel <sv@exept.de>
parents:
1127
diff
changeset
|
2603 |
"Modified: 18.4.1997 / 12:48:18 / stefan" |
975
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2604 |
! |
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2605 |
|
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2606 |
findPreviousForClass |
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2607 |
|savedCursor| |
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2608 |
|
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2609 |
changeNrShown isNil ifTrue:[^ self]. |
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2610 |
|
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2611 |
self withCursor:Cursor questionMark do:[ |
1378 | 2612 |
|cls nr thisClass | |
2613 |
||
2614 |
Object userInterruptSignal handle:[:ex | |
|
2615 |
self beep. |
|
2616 |
^ self |
|
2617 |
] do:[ |
|
2618 |
cls := self classNameOfChange:changeNrShown. |
|
2619 |
cls isNil ifTrue:[^ self]. |
|
2620 |
||
2621 |
nr := changeNrShown - 1. |
|
2622 |
[nr >= 1] whileTrue:[ |
|
2623 |
thisClass := self classNameOfChange:nr. |
|
2624 |
thisClass = cls ifTrue:[ |
|
2625 |
changeListView setSelection:nr . |
|
2626 |
self changeSelection:nr. |
|
2627 |
^ self |
|
2628 |
]. |
|
2629 |
nr := nr - 1. |
|
2630 |
]. |
|
2631 |
] |
|
975
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2632 |
]. |
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2633 |
self beep. |
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2634 |
|
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2635 |
savedCursor := cursor. |
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2636 |
self cursor:(Cursor cross). |
1150
fc05bbed9e43
Use 'Delay' instead of Process waitForMilliseconds:
Stefan Vogel <sv@exept.de>
parents:
1127
diff
changeset
|
2637 |
Delay waitForMilliseconds:300. |
975
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2638 |
self cursor:savedCursor |
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2639 |
|
1109 | 2640 |
"Modified: 2.4.1997 / 18:17:02 / cg" |
1150
fc05bbed9e43
Use 'Delay' instead of Process waitForMilliseconds:
Stefan Vogel <sv@exept.de>
parents:
1127
diff
changeset
|
2641 |
"Modified: 18.4.1997 / 12:48:41 / stefan" |
975
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2642 |
! |
41a41f54874d
added findPrev (Alt-B) and findNext (Alt-F)
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
2643 |
|
202 | 2644 |
noChangesAllowed |
2645 |
"show a warning that changes cannot be changed" |
|
93 | 2646 |
|
202 | 2647 |
self warn:'changes are not allowed to be changed' |
0 | 2648 |
! |
2649 |
||
202 | 2650 |
saveClass:aClassName from:startNr |
2651 |
"user wants changes from current to end to be appended to a file" |
|
51 | 2652 |
|
202 | 2653 |
|changeNr fileName| |
51 | 2654 |
|
202 | 2655 |
changeNr := changeListView selection. |
2656 |
changeNr notNil ifTrue:[ |
|
1378 | 2657 |
fileName := Dialog |
2658 |
requestFileName:'append changes for class to:' |
|
2659 |
default:'' |
|
2660 |
ok:'append' |
|
2661 |
abort:'abort' |
|
2662 |
pattern:'*.chg'. |
|
2663 |
||
2664 |
fileName notNil ifTrue:[ |
|
2665 |
self withCursor:(Cursor write) do:[ |
|
2666 |
startNr to:(self numberOfChanges) do:[:changeNr | |
|
2667 |
|thisClassName| |
|
2668 |
||
2669 |
thisClassName := self classNameOfChange:changeNr. |
|
2670 |
thisClassName = aClassName ifTrue:[ |
|
2671 |
changeListView setSelection:changeNr. |
|
2672 |
(self appendChange:changeNr toFile:fileName) ifFalse:[ |
|
2673 |
^ self |
|
2674 |
] |
|
2675 |
] |
|
2676 |
] |
|
2677 |
] |
|
2678 |
]. |
|
202 | 2679 |
] |
562
8f772068fd1a
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
2680 |
|
8f772068fd1a
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
2681 |
"Modified: 25.5.1996 / 12:26:44 / cg" |
202 | 2682 |
! ! |
0 | 2683 |
|
761 | 2684 |
!ChangesBrowser class methodsFor:'documentation'! |
202 | 2685 |
|
2686 |
version |
|
1496
978b3c3565c9
#silentDeleteInternalChange: copy-paste error
Stefan Vogel <sv@exept.de>
parents:
1473
diff
changeset
|
2687 |
^ '$Header: /cvs/stx/stx/libtool/ChangesBrowser.st,v 1.130 1998-02-26 18:11:03 stefan Exp $' |
276
017219e571e4
more stuff for autoloaded classes
Claus Gittinger <cg@exept.de>
parents:
275
diff
changeset
|
2688 |
! ! |