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