author | Claus Gittinger <cg@exept.de> |
Sun, 03 Dec 1995 19:45:01 +0100 | |
changeset 225 | 61d4648018c1 |
parent 223 | d451e2badbd1 |
child 226 | 4b050498fe46 |
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 |
|
45 | 14 |
instanceVariableNames:'changeListView codeView changeFileName changeChunks |
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
15 |
changePositions changeClassNames changeHeaderLines anyChanges |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
16 |
changeNrShown changeNrProcessed skipSignal compareChanges |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
17 |
compareCheckBox changeFileSize changeFileTimestamp checkBlock |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
18 |
changeTimeStamps tabSpec autoUpdate' |
58 | 19 |
classVariableNames:'CompressSnapshotInfo' |
45 | 20 |
poolDictionaries:'' |
21 |
category:'Interface-Browsers' |
|
0 | 22 |
! |
23 |
||
29 | 24 |
!ChangesBrowser class methodsFor:'documentation'! |
25 |
||
26 |
copyright |
|
27 |
" |
|
28 |
COPYRIGHT (c) 1990 by Claus Gittinger |
|
45 | 29 |
All Rights Reserved |
0 | 30 |
|
29 | 31 |
This software is furnished under a license and may be used |
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
! |
|
39 |
||
40 |
documentation |
|
41 |
" |
|
42 |
this implements a browser for the changes-file. |
|
43 |
See the extra document 'doc/misc/cbrowser.doc' for how to use this browser. |
|
44 |
||
45 |
written jan 90 by claus |
|
51 | 46 |
|
58 | 47 |
Class variables: |
48 |
CompressSnapshotInfo if true (the default), snapshot entries |
|
49 |
are also compressed in the compress function. |
|
50 |
Some users prefer them to be not compressed. |
|
51 |
Set it to false for this. |
|
52 |
||
51 | 53 |
Notice: |
54 |
this needs a total rewrite, to build up a changeSet from the file |
|
123 | 55 |
(which did not exist when the ChangesBrowser was originally written) |
56 |
and manipulate that changeSet. |
|
57 |
||
58 | 58 |
This way, we get a browser for any upcoming incore changeSets for |
59 |
free. Also, this will put the chunk analyzation code into Change and |
|
60 |
subclasses (where it belongs) and give a better encapsulation and |
|
61 |
overall structure. Do not take this as an example for good style ;-) |
|
29 | 62 |
" |
63 |
! ! |
|
0 | 64 |
|
45 | 65 |
!ChangesBrowser class methodsFor:'instance creation'! |
66 |
||
67 |
new |
|
68 |
"create a new changes browser" |
|
69 |
||
70 |
^ super label:'Changes Browser' |
|
71 |
icon:(Form fromFile:'CBrowser.xbm' resolution:100) |
|
72 |
! |
|
73 |
||
74 |
openOn:aFileName |
|
75 |
"create c changes browser on a change file" |
|
76 |
||
49 | 77 |
^ ((self new label:'Changes Browser: ', aFileName) changeFileName:aFileName) open |
45 | 78 |
! ! |
79 |
||
0 | 80 |
!ChangesBrowser class methodsFor:'behavior'! |
81 |
||
82 |
autoSelectNext |
|
83 |
"returning true here, makes a Delete operation automatically |
|
84 |
select the next change" |
|
85 |
||
86 |
^ true |
|
87 |
! ! |
|
88 |
||
73 | 89 |
!ChangesBrowser class methodsFor:'defaults'! |
0 | 90 |
|
73 | 91 |
defaultLabel |
92 |
^ 'Changes Browser' |
|
28 | 93 |
! ! |
94 |
||
202 | 95 |
!ChangesBrowser methodsFor:'compiler interface'! |
96 |
||
97 |
wantChangeLog |
|
98 |
"sent by the compiler to ask if a changeLog entry should |
|
99 |
be written. Return false here." |
|
100 |
||
101 |
^ false |
|
102 |
! ! |
|
103 |
||
104 |
!ChangesBrowser methodsFor:'error handling'! |
|
105 |
||
106 |
correctableError:aString position:relPos to:relEndPos from:aCompiler |
|
107 |
"compiler notifys us of an error - this should really not happen since |
|
108 |
changes ought to be correct (did someone edit the changes file ??). |
|
109 |
Show the bad change in the codeView and let codeView hilight the error; |
|
110 |
no corrections allowed here therefore return false" |
|
111 |
||
112 |
self error:aString position:relPos to:relEndPos from:aCompiler. |
|
113 |
^ false |
|
114 |
! |
|
115 |
||
116 |
error:aString position:relPos to:relEndPos from:aCompiler |
|
117 |
"compiler notifys us of an error - this should really not happen since |
|
118 |
changes ought to be correct (did someone edit the changes file ??). |
|
119 |
Show the bad change in the codeView and let codeView hilight the error" |
|
120 |
||
121 |
|action| |
|
122 |
||
123 |
(changeNrProcessed ~~ changeNrShown) ifTrue:[ |
|
124 |
self changeSelection:changeNrProcessed |
|
125 |
]. |
|
126 |
(skipSignal notNil) ifTrue:[ |
|
127 |
||
128 |
codeView highlightingErrorPosition:relPos to:relEndPos do:[ |
|
129 |
|box| |
|
0 | 130 |
|
202 | 131 |
" |
132 |
start dialog - make certain cleanup is done |
|
133 |
" |
|
134 |
action := OptionBox |
|
135 |
request:aString |
|
136 |
label:'Error' |
|
137 |
form:(WarningBox iconBitmap) |
|
138 |
buttonLabels:#('abort' 'skip' 'continue') |
|
139 |
values:#(#abort #skip #continue) |
|
140 |
default:#continue. |
|
141 |
]. |
|
0 | 142 |
|
202 | 143 |
action == #abort ifTrue:[ |
144 |
Object abortSignal raise. |
|
145 |
^ false |
|
146 |
]. |
|
147 |
action == #skip ifTrue:[ |
|
148 |
skipSignal raise. |
|
149 |
^ false |
|
150 |
]. |
|
151 |
^ false |
|
152 |
]. |
|
153 |
^ codeView error:aString position:relPos to:relEndPos from:aCompiler |
|
154 |
! |
|
155 |
||
156 |
warning:aString position:relPos to:relEndPos from:aCompiler |
|
157 |
"compiler notifys us of a warning - ignore it" |
|
158 |
||
159 |
^ self |
|
160 |
! ! |
|
161 |
||
162 |
!ChangesBrowser methodsFor:'event handling '! |
|
163 |
||
164 |
handlesKeyPress:key inView:view |
|
165 |
"this method is reached via delegation: are we prepared to handle |
|
166 |
a keyPress in some other view ?" |
|
167 |
||
168 |
view == changeListView ifTrue:[ |
|
169 |
(key == #Delete or:[key == #BackSpace]) ifTrue:[^ true]. |
|
170 |
]. |
|
171 |
^ false |
|
0 | 172 |
! |
173 |
||
202 | 174 |
keyPress:key x:x y:y view:view |
175 |
"this method is reached via delegation from the changeListView" |
|
176 |
||
177 |
(key == #Delete or:[key == #BackSpace]) ifTrue:[ |
|
178 |
self doDelete. |
|
179 |
^ self |
|
180 |
]. |
|
181 |
changeListView keyPress:key x:x y:y |
|
182 |
! ! |
|
183 |
||
184 |
!ChangesBrowser methodsFor:'help '! |
|
185 |
||
186 |
helpTextFor:aComponent |
|
187 |
|s| |
|
188 |
||
189 |
aComponent == codeView ifTrue:[ |
|
190 |
s := 'HELP_CODEVIEW' |
|
191 |
]. |
|
192 |
aComponent == changeListView ifTrue:[ |
|
193 |
s := 'HELP_CHANGELIST' |
|
194 |
]. |
|
195 |
((aComponent == compareCheckBox) |
|
196 |
or:[aComponent superView == compareCheckBox]) ifTrue:[ |
|
197 |
s := 'HELP_CHECK_COMPARE' |
|
198 |
]. |
|
199 |
s notNil ifTrue:[ |
|
200 |
^ resources string:s |
|
201 |
]. |
|
202 |
^ nil |
|
203 |
! ! |
|
204 |
||
205 |
!ChangesBrowser methodsFor:'initialize / release'! |
|
206 |
||
207 |
changeListMenu |
|
208 |
|labels selectors m| |
|
209 |
||
210 |
||
221 | 211 |
"/ self sensor ctrlDown ifTrue:[ |
212 |
"/ labels := #( |
|
213 |
"/ '\c auto update' |
|
214 |
"/ ). |
|
215 |
"/ selectors := #( |
|
216 |
"/ autoUpdate: |
|
217 |
"/ ). |
|
218 |
"/ ] ifFalse:[ |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
219 |
labels := #( |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
220 |
'apply change' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
221 |
'apply changes to end' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
222 |
'apply changes for this class to end' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
223 |
'apply all changes' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
224 |
'-' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
225 |
'delete' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
226 |
'delete to end' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
227 |
'delete changes for this class to end' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
228 |
'delete all changes for this class' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
229 |
'-' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
230 |
'update' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
231 |
'compress' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
232 |
'compare with current version' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
233 |
'browse' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
234 |
'-' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
235 |
'make change a patch' |
221 | 236 |
"/ 'update sourcefile from change' |
237 |
"/ '-' |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
238 |
'fileout & delete changes for this class' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
239 |
'-' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
240 |
'save change in file ...' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
241 |
'save changes to end in file ...' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
242 |
'save changes for this class to end in file ...' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
243 |
'save all changes for this class in file ...' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
244 |
'-' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
245 |
'writeback changeFile'). |
221 | 246 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
247 |
selectors := #( |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
248 |
doApply |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
249 |
doApplyRest |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
250 |
doApplyClassRest |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
251 |
doApplyAll |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
252 |
nil |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
253 |
doDelete |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
254 |
doDeleteRest |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
255 |
doDeleteClassRest |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
256 |
doDeleteClassAll |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
257 |
nil |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
258 |
doUpdate |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
259 |
doCompress |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
260 |
doCompare |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
261 |
doBrowse |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
262 |
nil |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
263 |
doMakePatch |
221 | 264 |
"/ doMakePermanent |
265 |
"/ nil |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
266 |
doFileoutAndDeleteClassAll |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
267 |
nil |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
268 |
doSave |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
269 |
doSaveRest |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
270 |
doSaveClassRest |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
271 |
doSaveClassAll |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
272 |
nil |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
273 |
doWriteBack |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
274 |
). |
221 | 275 |
"/ ]. |
202 | 276 |
|
277 |
m := PopUpMenu |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
278 |
labels:(resources array:labels) |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
279 |
selectors:selectors. |
202 | 280 |
|
221 | 281 |
"/ autoUpdate ifTrue:[ |
282 |
"/ m checkToggleAt:#autoUpdate: put:true |
|
283 |
"/ ]. |
|
202 | 284 |
changeListView hasSelection ifFalse:[ |
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
285 |
m disableAll:#(doApply doApplyClassRest doApplyRest doDelete doDeleteRest doDeleteClassRest |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
286 |
doDeleteClassAll doCompare doMakePatch doSaveChangeInFile doMakePermanent |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
287 |
doSave doSaveRest doSaveClassAll doSaveClassRest doBrowse) |
202 | 288 |
]. |
289 |
^ m |
|
290 |
||
291 |
"Modified: 6.9.1995 / 17:14:22 / claus" |
|
221 | 292 |
"Modified: 3.12.1995 / 14:31:44 / cg" |
202 | 293 |
! |
294 |
||
295 |
compare:aBoolean |
|
296 |
"sent from the compare-toggle" |
|
73 | 297 |
|
202 | 298 |
aBoolean ~~ compareChanges ifTrue:[ |
299 |
compareChanges := aBoolean. |
|
300 |
compareChanges ifTrue:[ |
|
301 |
tabSpec positions:#(0 0.15 5 8.5 ). |
|
302 |
self doUpdate |
|
303 |
] ifFalse:[ |
|
304 |
"/ |
|
305 |
"/ set tabs to hide compare-column |
|
306 |
"/ |
|
307 |
tabSpec positions:#(-1 0 5 8.5 ). |
|
308 |
changeListView clear; redraw. |
|
309 |
] |
|
310 |
] |
|
311 |
||
312 |
"Modified: 18.11.1995 / 17:30:20 / cg" |
|
313 |
! |
|
314 |
||
315 |
focusSequence |
|
316 |
^ Array with:changeListView with:codeView |
|
317 |
! |
|
318 |
||
319 |
initialize |
|
221 | 320 |
|panel v upperFrame buttonPanel autoUpdateCheckBox| |
202 | 321 |
|
322 |
super initialize. |
|
323 |
||
324 |
changeFileName := ObjectMemory nameForChanges. "/ 'changes'. |
|
325 |
compareChanges := false. |
|
221 | 326 |
autoUpdate := false. |
327 |
||
202 | 328 |
checkBlock := [self checkIfFileHasChanged]. |
329 |
||
330 |
panel := VariableVerticalPanel origin:(0.0 @ 0.0) |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
331 |
corner:(1.0 @ 1.0) |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
332 |
borderWidth:0 |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
333 |
in:self. |
202 | 334 |
|
335 |
upperFrame := View origin:(0.0 @ 0.0) corner:(1.0 @ 0.3) in:panel. |
|
336 |
||
337 |
v := HVScrollableView for:SelectionInListView miniScrollerH:true in:upperFrame. |
|
338 |
v origin:(0.0 @ 0.0) corner:(0.8 @ 1.0). |
|
339 |
changeListView := v scrolledView. |
|
340 |
changeListView delegate:self. |
|
341 |
changeListView menuHolder:self; menuPerformer:self; menuMessage:#changeListMenu. |
|
342 |
||
343 |
buttonPanel := VerticalPanelView in:upperFrame. |
|
344 |
buttonPanel origin:(0.8 @ 0.0) corner:(1.0 @ 1.0). |
|
221 | 345 |
buttonPanel verticalLayout:#topSpace; horizontalLayout:#leftSpace. |
202 | 346 |
|
347 |
compareCheckBox := CheckBox new. |
|
348 |
compareCheckBox label:(resources string:'compare'). |
|
349 |
compareCheckBox action:[:val | self compare:val]. |
|
350 |
buttonPanel addSubView:compareCheckBox. |
|
351 |
||
221 | 352 |
autoUpdateCheckBox := CheckBox new. |
353 |
autoUpdateCheckBox label:(resources string:'auto update'). |
|
354 |
autoUpdateCheckBox action:[:val | self autoUpdate:val]. |
|
355 |
buttonPanel addSubView:autoUpdateCheckBox. |
|
356 |
||
202 | 357 |
v := HVScrollableView for:CodeView miniScrollerH:true miniScrollerV:false in:panel. |
358 |
v origin:(0.0 @ 0.3) corner:(1.0 @ 1.0). |
|
359 |
codeView := v scrolledView. |
|
360 |
codeView readOnly. |
|
361 |
||
362 |
anyChanges := false. |
|
363 |
ObjectMemory addDependent:self. "to get shutdown-update" |
|
364 |
||
365 |
tabSpec := TabulatorSpecification new. |
|
366 |
tabSpec unit:#inch. |
|
367 |
tabSpec positions:#(-1 0 5 8.5 ). |
|
368 |
" +/- cls>>sel type info" |
|
369 |
tabSpec align: #(#left #left #left #left). |
|
370 |
||
221 | 371 |
"Modified: 3.12.1995 / 14:26:18 / cg" |
202 | 372 |
! |
373 |
||
374 |
realize |
|
375 |
super realize. |
|
376 |
self readChangesFileInBackground:true. |
|
377 |
self setChangeList. |
|
378 |
changeListView action:[:lineNr | self changeSelection:lineNr]. |
|
379 |
Processor addTimedBlock:checkBlock afterSeconds:5. |
|
380 |
! |
|
381 |
||
382 |
update:what |
|
383 |
|box| |
|
384 |
||
385 |
(what == #aboutToExit) ifTrue:[ |
|
386 |
" |
|
387 |
smalltalk is about to shut down - |
|
388 |
- if change list was modified, ask user and save if requested. |
|
389 |
" |
|
390 |
anyChanges ifTrue:[ |
|
391 |
self raiseDeiconified. |
|
392 |
||
393 |
box := YesNoBox new. |
|
394 |
box title:(resources at:'changefile has not been updated from the modified changelist.\\Update before exiting ?') withCRs. |
|
395 |
box noText:(resources at:'don''t update'). |
|
396 |
box okText:(resources at:'update'). |
|
397 |
box yesAction:[self writeBackChanges] |
|
398 |
noAction:[]. |
|
399 |
box showAtPointer |
|
400 |
]. |
|
401 |
^ self |
|
402 |
]. |
|
403 |
super update:what |
|
404 |
! ! |
|
405 |
||
406 |
!ChangesBrowser methodsFor:'private'! |
|
407 |
||
408 |
appendChange:changeNr toFile:fileName |
|
409 |
"append change to a file. return true if ok." |
|
410 |
||
411 |
|aStream outStream chunk sawExcla separator| |
|
412 |
||
413 |
outStream := FileStream oldFileNamed:fileName. |
|
414 |
outStream isNil ifTrue:[ |
|
415 |
outStream isNil ifTrue:[ |
|
416 |
outStream := FileStream newFileNamed:fileName. |
|
417 |
outStream isNil ifTrue:[ |
|
418 |
self warn:'cannot update file ''%1''' with:fileName. |
|
419 |
^ false |
|
420 |
] |
|
73 | 421 |
] |
422 |
]. |
|
202 | 423 |
|
424 |
outStream setToEnd. |
|
425 |
||
426 |
aStream := self streamForChange:changeNr. |
|
427 |
aStream isNil ifTrue:[ |
|
428 |
self warn:'oops cannot read change'. |
|
429 |
^ false |
|
430 |
]. |
|
73 | 431 |
|
202 | 432 |
separator := aStream class chunkSeparator. |
433 |
sawExcla := aStream peekFor:separator. |
|
434 |
sawExcla ifTrue:[ |
|
435 |
outStream nextPut:separator |
|
436 |
]. |
|
437 |
chunk := aStream nextChunk. |
|
438 |
outStream nextChunkPut:chunk. |
|
439 |
outStream cr. |
|
440 |
sawExcla ifTrue:[ |
|
441 |
chunk := aStream nextChunk. |
|
442 |
outStream nextChunkPut:chunk. |
|
443 |
outStream space |
|
444 |
]. |
|
445 |
sawExcla ifTrue:[ |
|
446 |
outStream nextPut:separator |
|
447 |
]. |
|
448 |
outStream cr. |
|
449 |
aStream close. |
|
450 |
outStream close. |
|
451 |
^ true |
|
73 | 452 |
! |
453 |
||
51 | 454 |
applyChange:changeNr |
455 |
"fileIn a change" |
|
456 |
||
163
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
457 |
|aStream nm| |
45 | 458 |
|
51 | 459 |
aStream := self streamForChange:changeNr. |
460 |
aStream isNil ifTrue:[^ self]. |
|
461 |
||
462 |
nm := self classNameOfChange:changeNr. |
|
463 |
nm notNil ifTrue:[ |
|
464 |
|cls| |
|
45 | 465 |
|
51 | 466 |
cls := Smalltalk at:(nm asSymbol) ifAbsent:[]. |
467 |
cls notNil ifTrue:[ |
|
468 |
cls isLoaded ifFalse:[ |
|
469 |
cls autoload |
|
470 |
] |
|
471 |
] |
|
472 |
]. |
|
45 | 473 |
|
51 | 474 |
changeNrProcessed := changeNr. |
45 | 475 |
|
132 | 476 |
Class withoutUpdatingChangesDo:[ |
51 | 477 |
|sig| |
45 | 478 |
|
51 | 479 |
(skipSignal notNil) ifTrue:[ |
480 |
sig := skipSignal |
|
481 |
] ifFalse:[ |
|
482 |
sig := Object abortSignal |
|
483 |
]. |
|
484 |
sig catch:[ |
|
485 |
aStream fileInNextChunkNotifying:self |
|
486 |
]. |
|
487 |
changeNrProcessed := nil. |
|
45 | 488 |
]. |
132 | 489 |
aStream close |
45 | 490 |
! |
491 |
||
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
492 |
numberOfChanges |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
493 |
^ changePositions size |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
494 |
|
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
495 |
"Created: 3.12.1995 / 18:15:39 / cg" |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
496 |
! |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
497 |
|
202 | 498 |
autoSelect:changeNr |
499 |
"select a change" |
|
73 | 500 |
|
202 | 501 |
self class autoSelectNext ifTrue:[ |
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
502 |
(changeNr <= self numberOfChanges) ifTrue:[ |
202 | 503 |
changeListView selection:changeNr. |
504 |
self changeSelection:changeNr. |
|
505 |
^ self |
|
506 |
] |
|
507 |
]. |
|
508 |
self clearCodeView. |
|
509 |
changeListView selection:nil. |
|
73 | 510 |
! |
511 |
||
202 | 512 |
autoSelectLast |
513 |
"select the last change" |
|
0 | 514 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
515 |
self autoSelect:(self numberOfChanges) |
202 | 516 |
! |
107 | 517 |
|
202 | 518 |
autoSelectOrEnd:changeNr |
519 |
"select the next change or the last" |
|
520 |
||
521 |
|last| |
|
50 | 522 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
523 |
last := self numberOfChanges. |
202 | 524 |
changeNr < last ifTrue:[ |
525 |
self autoSelect:changeNr |
|
133 | 526 |
] ifFalse:[ |
202 | 527 |
changeListView selection:last . |
528 |
self changeSelection:last. |
|
529 |
] |
|
530 |
! |
|
133 | 531 |
|
202 | 532 |
changeFileName:aFileName |
533 |
changeFileName := aFileName |
|
133 | 534 |
! |
535 |
||
536 |
checkIfFileHasChanged |
|
537 |
|f info | |
|
538 |
||
539 |
Processor removeTimedBlock:checkBlock. |
|
540 |
f := changeFileName asFilename. |
|
541 |
(info := f info) isNil ifTrue:[ |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
542 |
self newLabel:'(unaccessable)' |
133 | 543 |
] ifFalse:[ |
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
544 |
(info at:#modified) > changeFileTimestamp ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
545 |
self newLabel:'(outdated)'. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
546 |
autoUpdate ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
547 |
self doUpdate |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
548 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
549 |
] ifFalse:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
550 |
self newLabel:'' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
551 |
] |
133 | 552 |
]. |
553 |
Processor addTimedBlock:checkBlock afterSeconds:5. |
|
554 |
||
555 |
"Created: 8.9.1995 / 19:30:19 / claus" |
|
556 |
"Modified: 8.9.1995 / 19:38:18 / claus" |
|
221 | 557 |
"Modified: 3.12.1995 / 14:14:55 / cg" |
133 | 558 |
! |
559 |
||
202 | 560 |
classNameOfChange:changeNr |
561 |
"return the classname of a change (for xxx class - changes xxx is returned) |
|
562 |
- since parsing ascii methods is slow, keep result cached in |
|
563 |
changeClassNames for the next query" |
|
564 |
||
565 |
|chunk aParseTree recTree sel name arg1Tree| |
|
566 |
||
567 |
changeNr isNil ifTrue:[^ nil]. |
|
568 |
||
569 |
" |
|
570 |
first look, if not already known |
|
571 |
" |
|
572 |
name := changeClassNames at:changeNr. |
|
573 |
name notNil ifTrue:[^ name]. |
|
574 |
||
575 |
" |
|
576 |
get the chunk |
|
577 |
" |
|
578 |
chunk := changeChunks at:changeNr. |
|
579 |
chunk isNil ifTrue:[^ nil]. "mhmh - empty" |
|
580 |
||
581 |
" |
|
582 |
use parser to construct a parseTree |
|
583 |
" |
|
584 |
aParseTree := Parser parseExpression:chunk. |
|
585 |
(aParseTree isNil or:[aParseTree == #Error]) ifTrue:[ |
|
586 |
^ nil "seems strange ... (could be a comment)" |
|
587 |
]. |
|
588 |
aParseTree isMessage ifFalse:[ |
|
589 |
^ nil "very strange ... (whats that ?)" |
|
590 |
]. |
|
591 |
||
592 |
" |
|
593 |
ask parser for selector |
|
594 |
" |
|
595 |
sel := aParseTree selector. |
|
596 |
recTree := aParseTree receiver. |
|
597 |
||
598 |
" |
|
599 |
is it a method-change, methodRemove or comment-change ? |
|
600 |
" |
|
601 |
(#(#'methodsFor:' |
|
602 |
#'privateMethodsFor:' |
|
603 |
#'protectedMethodsFor:' |
|
604 |
#'publicMethodsFor:' |
|
605 |
#'removeSelector:' |
|
606 |
#'comment:' |
|
607 |
#'primitiveDefinitions:' |
|
608 |
#'primitiveFunctions:' |
|
609 |
#'primitiveVariables:' |
|
610 |
#'renameCategory:to:' |
|
611 |
#'instanceVariableNames:' |
|
612 |
) includes:sel) ifTrue:[ |
|
613 |
" |
|
614 |
yes, the className is the receiver |
|
615 |
" |
|
616 |
(recTree notNil and:[recTree ~~ #Error]) ifTrue:[ |
|
617 |
recTree isUnaryMessage ifTrue:[ |
|
618 |
(recTree selector ~~ #class) ifTrue:[^ nil]. |
|
619 |
"id class methodsFor:..." |
|
620 |
recTree := recTree receiver |
|
621 |
]. |
|
622 |
recTree isPrimary ifTrue:[ |
|
623 |
name := recTree name. |
|
624 |
changeClassNames at:changeNr put:name. |
|
625 |
^ name |
|
626 |
] |
|
627 |
]. |
|
628 |
"more strange things" |
|
629 |
^ nil |
|
630 |
]. |
|
631 |
||
632 |
" |
|
633 |
is it a change in a class-description ? |
|
634 |
" |
|
635 |
(('subclass:*' match:sel) |
|
636 |
or:[('variable*subclass:*' match:sel)]) ifTrue:[ |
|
637 |
arg1Tree := aParseTree arg1. |
|
638 |
(arg1Tree notNil and:[arg1Tree isConstant]) ifTrue:[ |
|
639 |
name := arg1Tree value asString. |
|
640 |
changeClassNames at:changeNr put:name. |
|
641 |
^ name |
|
642 |
]. |
|
643 |
"very strange" |
|
644 |
^ nil |
|
645 |
]. |
|
646 |
||
647 |
" |
|
648 |
is it a class remove ? |
|
649 |
" |
|
650 |
(sel == #removeClass:) ifTrue:[ |
|
651 |
(recTree notNil |
|
652 |
and:[recTree ~~ #Error |
|
653 |
and:[recTree isPrimary |
|
654 |
and:[recTree name = 'Smalltalk']]]) ifTrue:[ |
|
655 |
arg1Tree := aParseTree arg1. |
|
656 |
(arg1Tree notNil and:[arg1Tree isPrimary]) ifTrue:[ |
|
657 |
name := arg1Tree name. |
|
658 |
changeClassNames at:changeNr put:name. |
|
659 |
^ name |
|
660 |
]. |
|
661 |
] |
|
662 |
]. |
|
663 |
||
664 |
" |
|
665 |
is it a method category change ? |
|
666 |
" |
|
667 |
(sel == #category:) ifTrue:[ |
|
668 |
(recTree notNil |
|
669 |
and:[recTree ~~ #Error |
|
670 |
and:[recTree isMessage |
|
671 |
and:[recTree selector == #compiledMethodAt:]]]) ifTrue:[ |
|
672 |
recTree := recTree receiver. |
|
673 |
recTree isUnaryMessage ifTrue:[ |
|
674 |
(recTree selector ~~ #class) ifTrue:[^ nil]. |
|
675 |
"id class " |
|
676 |
recTree := recTree receiver |
|
677 |
]. |
|
678 |
recTree isPrimary ifTrue:[ |
|
679 |
name := recTree name. |
|
680 |
changeClassNames at:changeNr put:name. |
|
681 |
^ name |
|
682 |
] |
|
683 |
] |
|
684 |
]. |
|
685 |
^ nil |
|
686 |
! |
|
687 |
||
688 |
clearCodeView |
|
689 |
self unselect "changeListView deselect". |
|
690 |
codeView contents:nil. |
|
691 |
changeNrShown := nil |
|
692 |
! |
|
693 |
||
694 |
compareChange:changeNr |
|
695 |
"compare a change with current version" |
|
696 |
||
697 |
|aStream chunk sawExcla parseTree thisClass cat oldSource newSource |
|
698 |
parser sel oldMethod outcome showDiff d t1 t2| |
|
699 |
||
700 |
aStream := self streamForChange:changeNr. |
|
701 |
aStream isNil ifTrue:[^ self]. |
|
702 |
||
703 |
sawExcla := aStream peekFor:(aStream class chunkSeparator). |
|
704 |
chunk := aStream nextChunk. |
|
705 |
sawExcla ifFalse:[ |
|
207
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
706 |
outcome := 'not comparable ...' |
202 | 707 |
] ifTrue:[ |
207
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
708 |
parseTree := Parser parseExpression:chunk. |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
709 |
(parseTree notNil and:[parseTree isMessage]) ifTrue:[ |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
710 |
(parseTree selector == #methodsFor:) ifTrue:[ |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
711 |
thisClass := (parseTree receiver evaluate). |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
712 |
thisClass isBehavior ifTrue:[ |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
713 |
showDiff := false. |
202 | 714 |
|
207
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
715 |
cat := parseTree arg1 evaluate. |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
716 |
newSource := aStream nextChunk. |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
717 |
parser := Parser parseMethod:newSource in:thisClass. |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
718 |
(parser notNil and:[parser ~~ #Error]) ifTrue:[ |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
719 |
sel := parser selector. |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
720 |
oldMethod := thisClass compiledMethodAt:sel. |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
721 |
oldMethod notNil ifTrue:[ |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
722 |
(oldMethod category = cat) ifFalse:[ |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
723 |
Transcript showCr:'category changed.'. |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
724 |
]. |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
725 |
oldSource := oldMethod source. |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
726 |
(oldSource = newSource) ifTrue:[ |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
727 |
outcome := 'same source' |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
728 |
] ifFalse:[ |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
729 |
oldSource isNil ifTrue:[ |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
730 |
outcome := 'no source for compare.' |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
731 |
] ifFalse:[ |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
732 |
"/ |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
733 |
"/ compare for tabulator <-> space changes |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
734 |
"/ before showing diff ... |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
735 |
"/ |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
736 |
t1 := oldSource asCollectionOfLines collect:[:s | s withTabsExpanded]. |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
737 |
t2 := newSource asCollectionOfLines collect:[:s | s withTabsExpanded]. |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
738 |
t1 = t2 ifTrue:[ |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
739 |
outcome := 'same source' |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
740 |
] ifFalse:[ |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
741 |
outcome := 'source changed.'. |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
742 |
showDiff := true |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
743 |
] |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
744 |
] |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
745 |
] |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
746 |
] ifFalse:[ |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
747 |
outcome := 'method does not exist.' |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
748 |
] |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
749 |
] ifFalse:[ |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
750 |
outcome := 'change unparsable.' |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
751 |
]. |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
752 |
(showDiff and:[oldSource notNil and:[newSource notNil]]) ifTrue:[ |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
753 |
d := DiffTextView |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
754 |
openOn:oldSource label:'current version' |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
755 |
and:newSource label:'changeFile version'. |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
756 |
d label:'method differences'. |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
757 |
] |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
758 |
] ifFalse:[ |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
759 |
outcome := 'class does not exist.' |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
760 |
] |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
761 |
] ifFalse:[ |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
762 |
outcome := 'not comparable.' |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
763 |
] |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
764 |
] ifFalse:[ |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
765 |
outcome := 'not comparable.' |
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
766 |
] |
202 | 767 |
]. |
768 |
aStream close. |
|
769 |
showDiff ifFalse:[ |
|
207
8729533e8607
nobody likes class browsers - better open a full one
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
770 |
self information:outcome. |
202 | 771 |
"/ Transcript showCr:outcome. |
772 |
]. |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
773 |
|
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
774 |
"Created: 24.11.1995 / 14:30:46 / cg" |
202 | 775 |
! |
776 |
||
777 |
contractClass:className selector:selector to:maxLen |
|
778 |
|s l| |
|
779 |
||
780 |
s := className , ' ', selector. |
|
781 |
s size > maxLen ifTrue:[ |
|
782 |
l := maxLen - 1 - selector size max:20. |
|
783 |
s := (className contractTo:l) , ' ' , selector. |
|
784 |
||
785 |
s size > maxLen ifTrue:[ |
|
786 |
l := maxLen - 1 - className size max:20. |
|
787 |
s := className , ' ', (selector contractTo:l). |
|
788 |
||
789 |
s size > maxLen ifTrue:[ |
|
790 |
s := (className contractTo:(maxLen // 2 - 1)) , ' ' , (selector contractTo:maxLen // 2) |
|
791 |
] |
|
792 |
] |
|
793 |
]. |
|
794 |
^ s |
|
795 |
! |
|
796 |
||
797 |
deleteChange:changeNr |
|
798 |
"delete a change" |
|
799 |
||
225 | 800 |
self deleteChangesFrom:changeNr to:changeNr |
202 | 801 |
! |
802 |
||
803 |
deleteChangesFrom:start to:stop |
|
804 |
"delete a range of changes" |
|
805 |
||
806 |
changeListView deselect. |
|
807 |
stop to:start by:-1 do:[:changeNr | |
|
808 |
self silentDeleteChange:changeNr |
|
809 |
]. |
|
810 |
self setChangeList |
|
811 |
||
812 |
! |
|
813 |
||
814 |
makeChangeAPatch:changeNr |
|
815 |
"append change to patchfile" |
|
816 |
||
817 |
self appendChange:changeNr toFile:'patches' |
|
818 |
! |
|
819 |
||
820 |
makeChangePermanent:changeNr |
|
821 |
"rewrite the source file where change changeNr lies" |
|
822 |
||
823 |
self notify:'this is not yet implemented' |
|
824 |
! |
|
825 |
||
826 |
newLabel:how |
|
827 |
|l| |
|
828 |
||
829 |
(changeFileName ~= 'changes') ifTrue:[ |
|
830 |
l := 'Changes Browser: ', changeFileName |
|
831 |
] ifFalse:[ |
|
832 |
l := 'Changes Browser' |
|
833 |
]. |
|
834 |
l := l , ' ' , how. |
|
835 |
self label:l |
|
836 |
||
837 |
"Created: 8.9.1995 / 19:32:04 / claus" |
|
838 |
"Modified: 8.9.1995 / 19:39:29 / claus" |
|
839 |
! |
|
840 |
||
841 |
queryCloseText |
|
842 |
"made this a method for easy redefinition in subclasses" |
|
843 |
||
844 |
^ 'Quit without updating changeFile ?' |
|
845 |
! |
|
846 |
||
847 |
readChangesFile |
|
848 |
"read the changes file, create a list of header-lines (changeChunks) |
|
849 |
and a list of chunk-positions (changePositions)" |
|
850 |
||
851 |
^ self readChangesFileInBackground:false |
|
852 |
! |
|
853 |
||
37 | 854 |
readChangesFileInBackground:inBackground |
855 |
"read the changes file, create a list of header-lines (changeChunks) |
|
51 | 856 |
and a list of chunk-positions (changePositions). |
857 |
Starting with 2.10.3, the entries are multi-col entries; |
|
858 |
the cols are: |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
859 |
1 delta (only if comparing) |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
860 |
'+' -> new method (w.r.t. current state) |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
861 |
'-' -> removed method (w.r.t. current state) |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
862 |
'?' -> class does not exist currently |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
863 |
'=' -> change is same as current methods source |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
864 |
2 class/selector |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
865 |
3 type of change |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
866 |
doit |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
867 |
method |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
868 |
category change |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
869 |
4 timestamp |
89 | 870 |
|
871 |
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
|
872 |
default and can be enabled via a toggle." |
37 | 873 |
|
133 | 874 |
|aStream maxLen f| |
50 | 875 |
|
221 | 876 |
self newLabel:'updating ...'. |
877 |
||
50 | 878 |
maxLen := 60. |
0 | 879 |
|
133 | 880 |
f := changeFileName asFilename. |
881 |
aStream := f readStream. |
|
0 | 882 |
aStream isNil ifTrue:[^ nil]. |
883 |
||
133 | 884 |
changeFileSize := f info at:#size. |
885 |
changeFileTimestamp := f info at:#modified. |
|
886 |
||
0 | 887 |
self withCursor:(Cursor read) do:[ |
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
888 |
|myProcess myPriority| |
49 | 889 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
890 |
" |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
891 |
this is a time consuming operation (especially, if reading an |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
892 |
NFS-mounted directory; therefore lower my priority ... |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
893 |
" |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
894 |
inBackground ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
895 |
myProcess := Processor activeProcess. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
896 |
myPriority := myProcess priority. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
897 |
myProcess priority:(Processor userBackgroundPriority). |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
898 |
]. |
51 | 899 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
900 |
[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
901 |
|excla timeStampInfo| |
50 | 902 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
903 |
changeChunks := OrderedCollection new. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
904 |
changeHeaderLines := OrderedCollection new. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
905 |
changePositions := OrderedCollection new. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
906 |
changeTimeStamps := OrderedCollection new. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
907 |
excla := aStream class chunkSeparator. |
0 | 908 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
909 |
[aStream atEnd] whileFalse:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
910 |
|entry changeDelta changeString changeType |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
911 |
line s l changeClass sawExcla category |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
912 |
chunkText chunkPos sel| |
51 | 913 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
914 |
" |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
915 |
get a chunk (separated by excla) |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
916 |
" |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
917 |
aStream skipSeparators. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
918 |
chunkPos := aStream position. |
73 | 919 |
|
920 |
||
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
921 |
sawExcla := aStream peekFor:excla. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
922 |
chunkText := aStream nextChunk. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
923 |
chunkText notNil ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
924 |
|index headerLine| |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
925 |
|
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
926 |
(chunkText startsWith:'''---- timestamp ') ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
927 |
timeStampInfo := (chunkText copyFrom:16 to:(chunkText size - 6)) withoutSpaces. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
928 |
] ifFalse:[ |
51 | 929 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
930 |
" |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
931 |
only first line is saved in changeChunks ... |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
932 |
" |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
933 |
index := chunkText indexOf:(Character cr). |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
934 |
(index ~~ 0) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
935 |
chunkText := chunkText copyTo:(index - 1). |
45 | 936 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
937 |
"take care for comment changes - must still be a |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
938 |
valid expression for classNameOfChange: to work" |
50 | 939 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
940 |
(chunkText endsWith:'comment:''') ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
941 |
chunkText := chunkText , '...''' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
942 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
943 |
(chunkText endsWith:'primitiveDefinitions:''') ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
944 |
sel := 'primitiveDefinitions:'. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
945 |
chunkText := chunkText copyWithoutLast:1 |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
946 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
947 |
(chunkText endsWith:'primitiveVariables:''') ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
948 |
sel := 'primitiveVariables:'. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
949 |
chunkText := chunkText copyWithoutLast:1 |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
950 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
951 |
(chunkText endsWith:'primitiveFunctions:''') ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
952 |
sel := 'primitiveFunctions:'. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
953 |
chunkText := chunkText copyWithoutLast:1 |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
954 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
955 |
]. |
51 | 956 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
957 |
changeChunks add:chunkText. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
958 |
changePositions add:chunkPos. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
959 |
changeTimeStamps add:timeStampInfo. |
37 | 960 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
961 |
headerLine := nil. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
962 |
changeDelta := ' '. |
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
963 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
964 |
sawExcla ifFalse:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
965 |
(chunkText startsWith:'''---- snap') ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
966 |
changeType := ''. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
967 |
headerLine := chunkText. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
968 |
changeString := (chunkText contractTo:maxLen). |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
969 |
] ifFalse:[ |
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
970 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
971 |
|p cls| |
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
972 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
973 |
headerLine := chunkText , ' (doIt)'. |
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
974 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
975 |
" |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
976 |
first, assume doIt - then lets have a more detailed look ... |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
977 |
" |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
978 |
(chunkText startsWith:'''---- file') ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
979 |
changeType := ''. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
980 |
] ifFalse:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
981 |
changeType := '(doIt)'. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
982 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
983 |
changeString := (chunkText contractTo:maxLen). |
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
984 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
985 |
p := Parser parseExpression:chunkText. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
986 |
(p notNil |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
987 |
and:[p ~~ #Error |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
988 |
and:[p isMessage]]) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
989 |
sel := p selector. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
990 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
991 |
(sel == #removeSelector:) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
992 |
p receiver isUnaryMessage ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
993 |
cls := p receiver receiver name. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
994 |
changeClass := (Smalltalk classNamed:cls) class. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
995 |
cls := cls , ' class'. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
996 |
] ifFalse:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
997 |
cls := p receiver name. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
998 |
changeClass := (Smalltalk classNamed:cls) |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
999 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1000 |
sel := (p args at:1) evaluate. |
50 | 1001 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1002 |
compareChanges ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1003 |
(changeClass isNil or:[changeClass isLoaded not]) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1004 |
changeDelta := '?' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1005 |
] ifFalse:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1006 |
(changeClass implements:sel asSymbol) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1007 |
changeDelta := '-'. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1008 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1009 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1010 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1011 |
changeType := '(remove)'. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1012 |
changeString := self contractClass:cls selector:sel to:maxLen. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1013 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1014 |
(p ~~ #Error |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1015 |
and:[p isMessage |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1016 |
and:[p receiver isMessage |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1017 |
and:[p receiver selector == #compiledMethodAt:]]]) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1018 |
p receiver receiver isUnaryMessage ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1019 |
cls := p receiver receiver receiver name. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1020 |
changeClass := (Smalltalk classNamed:cls) class. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1021 |
cls := cls , ' class'. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1022 |
] ifFalse:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1023 |
cls := p receiver receiver name. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1024 |
changeClass := (Smalltalk classNamed:cls) |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1025 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1026 |
(sel == #category:) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1027 |
sel := (p receiver args at:1) evaluate. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1028 |
changeType := '(category change)'. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1029 |
changeString := self contractClass:cls selector:sel to:maxLen. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1030 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1031 |
(sel == #privacy:) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1032 |
sel := (p receiver args at:1) evaluate. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1033 |
changeType := '(privacy change)'. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1034 |
changeString := self contractClass:cls selector:sel to:maxLen. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1035 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1036 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1037 |
(#(#'subclass:' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1038 |
#'variableSubclass:' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1039 |
#'variableByteSubclass:' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1040 |
#'variableWordSubclass:' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1041 |
#'variableLongSubclass:' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1042 |
#'variableFloatSubclass:' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1043 |
#'variableDoubleSubclass:' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1044 |
#'primitiveDefinitions:' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1045 |
#'primitiveFunctions:' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1046 |
#'primitiveVariables:' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1047 |
) includes:sel) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1048 |
changeType := '(class definition)'. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1049 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1050 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1051 |
] ifTrue:[ "sawExcla" |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1052 |
|done first p cls text| |
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1053 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1054 |
" |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1055 |
method definitions actually consist of |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1056 |
two (or more) chunks; skip next chunk(s) |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1057 |
up to an empty one. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1058 |
The system only writes one chunk, |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1059 |
and we cannot handle more in this ChangesBrowser .... |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1060 |
" |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1061 |
cls := nil. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1062 |
p := Parser parseExpression:chunkText. |
89 | 1063 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1064 |
(p notNil and:[p ~~ #Error]) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1065 |
sel := p selector. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1066 |
(sel == #methodsFor:) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1067 |
p receiver isUnaryMessage ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1068 |
cls := p receiver receiver name. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1069 |
changeClass := (Smalltalk classNamed:cls) class. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1070 |
cls := cls , ' class'. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1071 |
] ifFalse:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1072 |
cls := p receiver name. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1073 |
changeClass := Smalltalk classNamed:cls |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1074 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1075 |
category := (p args at:1) evaluate. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1076 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1077 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1078 |
done := false. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1079 |
first := true. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1080 |
[done] whileFalse:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1081 |
text := aStream nextChunk. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1082 |
text isNil ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1083 |
done := true |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1084 |
] ifFalse:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1085 |
done := text isEmpty |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1086 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1087 |
done ifFalse:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1088 |
first ifFalse:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1089 |
Transcript showCr:'only one method per ''methodsFor:'' handled'. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1090 |
] ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1091 |
first := false. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1092 |
" |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1093 |
try to find the selector |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1094 |
" |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1095 |
sel := nil. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1096 |
cls notNil ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1097 |
p := Parser |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1098 |
parseMethodSpecification:text |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1099 |
in:nil |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1100 |
ignoreErrors:true |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1101 |
ignoreWarnings:true. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1102 |
(p notNil and:[p ~~ #Error]) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1103 |
sel := p selector. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1104 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1105 |
]. |
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1106 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1107 |
sel isNil ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1108 |
changeString := (chunkText contractTo:maxLen). |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1109 |
changeType := '(change)'. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1110 |
] ifFalse:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1111 |
changeString := self contractClass:cls selector:sel to:maxLen. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1112 |
changeType := '(method in: ''' , category , ''')'. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1113 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1114 |
sel isNil ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1115 |
headerLine := chunkText , ' (change)'. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1116 |
] ifFalse:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1117 |
headerLine := cls , ' ' , sel , ' ' , '(change category: ''' , category , ''')'. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1118 |
]. |
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1119 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1120 |
compareChanges ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1121 |
(changeClass isNil or:[changeClass isLoaded not]) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1122 |
changeDelta := '?' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1123 |
] ifFalse:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1124 |
(changeClass implements:sel asSymbol) ifFalse:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1125 |
changeDelta := '+'. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1126 |
] ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1127 |
|m currentText t1 t2| |
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1128 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1129 |
m := changeClass compiledMethodAt:sel asSymbol. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1130 |
currentText := m source. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1131 |
currentText notNil ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1132 |
text asString = currentText asString ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1133 |
changeDelta := '=' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1134 |
] ifFalse:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1135 |
t1 := currentText asCollectionOfLines collect:[:s | s withTabsExpanded]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1136 |
t2 := text asCollectionOfLines collect:[:s | s withTabsExpanded]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1137 |
t1 = t2 ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1138 |
changeDelta := '=' |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1139 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1140 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1141 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1142 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1143 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1144 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1145 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1146 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1147 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1148 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1149 |
changeString notNil ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1150 |
entry := MultiColListEntry new. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1151 |
entry tabulatorSpecification:tabSpec. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1152 |
entry colAt:1 put:changeDelta. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1153 |
entry colAt:2 put:changeString. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1154 |
entry colAt:3 put:changeType. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1155 |
entry colAt:4 put:timeStampInfo. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1156 |
changeHeaderLines add:entry |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1157 |
] ifFalse:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1158 |
headerLine notNil ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1159 |
changeHeaderLines add:headerLine |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1160 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1161 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1162 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1163 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1164 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1165 |
changeClassNames := OrderedCollection new grow:(changeChunks size). |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1166 |
aStream close. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1167 |
anyChanges := false |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1168 |
] valueNowOrOnUnwindDo:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1169 |
inBackground ifTrue:[myProcess priority:myPriority]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1170 |
]. |
133 | 1171 |
]. |
1172 |
||
1173 |
self checkIfFileHasChanged |
|
123 | 1174 |
|
1175 |
"Modified: 27.8.1995 / 23:06:55 / claus" |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1176 |
"Modified: 3.12.1995 / 18:52:34 / cg" |
45 | 1177 |
! |
37 | 1178 |
|
209
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1179 |
selectorOfMethodChange:changeNr |
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1180 |
"return a changes selector" |
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1181 |
|
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1182 |
|aStream chunk sawExcla parseTree thisClass newSource |
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1183 |
parser sel | |
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1184 |
|
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1185 |
aStream := self streamForChange:changeNr. |
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1186 |
aStream isNil ifTrue:[^ nil]. |
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1187 |
|
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1188 |
sawExcla := aStream peekFor:(aStream class chunkSeparator). |
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1189 |
chunk := aStream nextChunk. |
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1190 |
sawExcla ifFalse:[^ nil]. |
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1191 |
parseTree := Parser parseExpression:chunk. |
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1192 |
(parseTree notNil and:[parseTree isMessage]) ifTrue:[ |
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1193 |
(parseTree selector == #methodsFor:) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1194 |
newSource := aStream nextChunk. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1195 |
parser := Parser parseMethod:newSource. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1196 |
(parser notNil and:[parser ~~ #Error]) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1197 |
sel := parser selector. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1198 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1199 |
] |
209
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1200 |
]. |
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1201 |
aStream close. |
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1202 |
^ sel |
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1203 |
|
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1204 |
"Created: 24.11.1995 / 14:30:46 / cg" |
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1205 |
"Modified: 24.11.1995 / 23:12:50 / cg" |
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1206 |
! |
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1207 |
|
202 | 1208 |
setChangeList |
1209 |
"extract type-information from changes and stuff into top selection |
|
1210 |
view" |
|
51 | 1211 |
|
202 | 1212 |
changeListView setList:changeHeaderLines expandTabs:false. |
1213 |
"/ changeListView deselect. |
|
51 | 1214 |
! |
1215 |
||
73 | 1216 |
silentDeleteChange:changeNr |
1217 |
"delete a change do not update changeListView" |
|
57 | 1218 |
|
73 | 1219 |
anyChanges := true. |
1220 |
changeChunks removeIndex:changeNr. |
|
1221 |
changePositions removeIndex:changeNr. |
|
1222 |
changeClassNames removeIndex:changeNr. |
|
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1223 |
changeHeaderLines removeIndex:changeNr. |
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1224 |
changeTimeStamps removeIndex:changeNr |
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1225 |
|
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1226 |
"Modified: 18.11.1995 / 17:08:44 / cg" |
45 | 1227 |
! |
1228 |
||
202 | 1229 |
silentDeleteChangesFor:aClassName from:start to:stop |
1230 |
"delete changes for a given class in a range" |
|
45 | 1231 |
|
202 | 1232 |
|thisClassName index| |
45 | 1233 |
|
202 | 1234 |
index := stop. |
1235 |
[index >= start] whileTrue:[ |
|
1236 |
thisClassName := self classNameOfChange:index. |
|
1237 |
thisClassName = aClassName ifTrue:[ |
|
1238 |
self silentDeleteChange:index |
|
51 | 1239 |
]. |
202 | 1240 |
index := index - 1 |
1241 |
] |
|
51 | 1242 |
|
45 | 1243 |
! |
1244 |
||
202 | 1245 |
streamForChange:changeNr |
1246 |
"answer a stream for change" |
|
1247 |
||
1248 |
|aStream| |
|
73 | 1249 |
|
202 | 1250 |
(changeNr between:1 and:changePositions size) ifFalse:[^ nil]. |
1251 |
aStream := FileStream readonlyFileNamed:changeFileName. |
|
1252 |
aStream isNil ifTrue:[^ nil]. |
|
1253 |
aStream position:(changePositions at:changeNr). |
|
1254 |
^ aStream |
|
1255 |
! |
|
1256 |
||
1257 |
unselect |
|
1258 |
"common unselect" |
|
1259 |
||
1260 |
changeListView deselect. |
|
73 | 1261 |
! |
1262 |
||
1263 |
withSelectedChangeDo:aBlock |
|
1264 |
"just a helper, check for a selected change and evaluate aBlock |
|
1265 |
with busy cursor" |
|
1266 |
||
1267 |
|changeNr| |
|
1268 |
||
1269 |
changeNr := changeListView selection. |
|
1270 |
changeNr notNil ifTrue:[ |
|
1271 |
self withCursor:(Cursor execute) do:[ |
|
1272 |
aBlock value:changeNr |
|
1273 |
] |
|
1274 |
] |
|
1275 |
! |
|
1276 |
||
45 | 1277 |
writeBackChanges |
163
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1278 |
"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
|
1279 |
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
|
1280 |
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
|
1281 |
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
|
1282 |
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
|
1283 |
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
|
1284 |
or we have at least a backup of the previous change file." |
45 | 1285 |
|
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1286 |
|inStream outStream tempfile stamp| |
163
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1287 |
|
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1288 |
tempfile := Filename newTemporaryIn:nil. |
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1289 |
tempfile exists ifTrue:[tempfile remove]. |
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1290 |
|
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1291 |
outStream := tempfile writeStream. |
45 | 1292 |
outStream isNil ifTrue:[ |
163
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1293 |
self warn:'cannot create temporary file in current directory.'. |
45 | 1294 |
^ self |
1295 |
]. |
|
1296 |
||
1297 |
inStream := FileStream readonlyFileNamed:changeFileName. |
|
1298 |
inStream isNil ifTrue:[^ nil]. |
|
1299 |
||
1300 |
self withCursor:(Cursor write) do:[ |
|
51 | 1301 |
|excla sawExcla done dir chunk |
1302 |
nChanges "{Class:SmallInteger}" | |
|
1303 |
||
45 | 1304 |
excla := inStream class chunkSeparator. |
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1305 |
nChanges := self numberOfChanges. |
51 | 1306 |
|
1307 |
1 to:nChanges do:[:index | |
|
45 | 1308 |
inStream position:(changePositions at:index). |
1309 |
sawExcla := inStream peekFor:excla. |
|
1310 |
chunk := inStream nextChunk. |
|
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1311 |
(stamp := changeTimeStamps at:index) notNil ifTrue:[ |
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1312 |
outStream nextPutAll:'''---- timestamp ' , stamp , ' ----'''. |
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1313 |
outStream nextPut:excla; cr. |
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1314 |
]. |
45 | 1315 |
|
1316 |
sawExcla ifTrue:[ |
|
1317 |
outStream nextPut:excla. |
|
1318 |
outStream nextChunkPut:chunk. |
|
1319 |
outStream cr. |
|
51 | 1320 |
" |
1321 |
a method-definition chunk - skip followups |
|
1322 |
" |
|
45 | 1323 |
done := false. |
1324 |
[done] whileFalse:[ |
|
1325 |
chunk := inStream nextChunk. |
|
1326 |
chunk isNil ifTrue:[ |
|
1327 |
done := true |
|
1328 |
] ifFalse:[ |
|
1329 |
outStream nextChunkPut:chunk. |
|
1330 |
outStream cr. |
|
1331 |
done := chunk isEmpty |
|
1332 |
] |
|
1333 |
]. |
|
1334 |
] ifFalse:[ |
|
1335 |
outStream nextChunkPut:chunk. |
|
1336 |
outStream cr |
|
1337 |
] |
|
1338 |
]. |
|
1339 |
outStream close. |
|
1340 |
inStream close. |
|
1341 |
dir := FileDirectory currentDirectory. |
|
163
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1342 |
dir renameFile:changeFileName newName:(changeFileName , '.bak'). |
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1343 |
dir renameFile:tempfile name newName:changeFileName. |
45 | 1344 |
anyChanges := false |
1345 |
] |
|
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1346 |
|
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1347 |
"Modified: 18.11.1995 / 17:12:37 / cg" |
202 | 1348 |
! ! |
0 | 1349 |
|
202 | 1350 |
!ChangesBrowser methodsFor:'termination'! |
51 | 1351 |
|
202 | 1352 |
destroy |
1353 |
"destroy the receiver; make certain, that boxes are destroyed too" |
|
73 | 1354 |
|
202 | 1355 |
Processor removeTimedBlock:checkBlock. |
1356 |
ObjectMemory removeDependent:self. |
|
1357 |
super destroy |
|
51 | 1358 |
! |
1359 |
||
202 | 1360 |
saveAndTerminate |
1361 |
"update the changes file and quit. |
|
1362 |
Dont depend on this being sent, not all window managers |
|
1363 |
send it; instead, they simply destroy the view." |
|
28 | 1364 |
|
202 | 1365 |
anyChanges ifTrue:[ |
1366 |
self writeBackChanges. |
|
0 | 1367 |
]. |
202 | 1368 |
self destroy |
0 | 1369 |
! |
1370 |
||
202 | 1371 |
terminate |
1372 |
"window manager wants us to go away" |
|
28 | 1373 |
|
202 | 1374 |
|action| |
0 | 1375 |
|
202 | 1376 |
anyChanges ifTrue:[ |
1377 |
action := OptionBox |
|
1378 |
request:(resources at:'changefile has not been updated from the modified changelist.\\Update before closing ?') withCRs |
|
1379 |
label:'ChangesBrowser' |
|
1380 |
form:(WarningBox iconBitmap) |
|
1381 |
buttonLabels:(resources array:#('abort' 'don''t update' 'update')) |
|
1382 |
values:#(#abort #ignore #save) |
|
1383 |
default:#save. |
|
1384 |
action == #abort ifTrue:[^ self]. |
|
1385 |
action == #save ifTrue:[ |
|
1386 |
self writeBackChanges |
|
45 | 1387 |
]. |
202 | 1388 |
]. |
1389 |
self destroy |
|
0 | 1390 |
! ! |
1391 |
||
73 | 1392 |
!ChangesBrowser methodsFor:'user interaction'! |
51 | 1393 |
|
221 | 1394 |
autoUpdate:aBoolean |
1395 |
autoUpdate := aBoolean |
|
1396 |
||
1397 |
"Created: 3.12.1995 / 14:14:24 / cg" |
|
1398 |
"Modified: 3.12.1995 / 14:20:45 / cg" |
|
1399 |
! |
|
1400 |
||
0 | 1401 |
changeSelection:lineNr |
1402 |
"show a change in the codeView" |
|
1403 |
||
1404 |
|aStream sawExcla chunk| |
|
1405 |
||
1406 |
aStream := self streamForChange:lineNr. |
|
1407 |
aStream isNil ifTrue:[^ self]. |
|
1408 |
sawExcla := aStream peekFor:(aStream class chunkSeparator). |
|
1409 |
chunk := aStream nextChunk. |
|
1410 |
sawExcla ifTrue:[ |
|
45 | 1411 |
chunk := aStream nextChunk |
0 | 1412 |
]. |
1413 |
aStream close. |
|
1414 |
codeView contents:chunk. |
|
13 | 1415 |
codeView acceptAction:[:theCode | self doApply "noChangesAllowed"]. |
15 | 1416 |
changeNrShown := lineNr. |
0 | 1417 |
|
51 | 1418 |
! |
1419 |
||
202 | 1420 |
doApply |
1421 |
"user wants a change to be applied" |
|
45 | 1422 |
|
202 | 1423 |
self withSelectedChangeDo:[:changeNr | |
1424 |
skipSignal := nil. |
|
1425 |
self applyChange:changeNr. |
|
1426 |
self autoSelect:(changeNr + 1) |
|
1427 |
] |
|
45 | 1428 |
! |
1429 |
||
202 | 1430 |
doApplyAll |
1431 |
"user wants all changes to be applied" |
|
37 | 1432 |
|
202 | 1433 |
self withCursor:(Cursor execute) do:[ |
1434 |
self clearCodeView. |
|
1435 |
skipSignal isNil ifTrue:[skipSignal := Signal new]. |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1436 |
1 to:(self numberOfChanges) do:[:changeNr | |
202 | 1437 |
changeListView selection:changeNr. |
1438 |
self applyChange:changeNr |
|
1439 |
]. |
|
1440 |
self autoSelectLast |
|
1441 |
] |
|
37 | 1442 |
! |
1443 |
||
202 | 1444 |
doApplyClassRest |
1445 |
"user wants all changes for this class from changeNr to be applied" |
|
1446 |
||
1447 |
self withSelectedChangeDo:[:changeNr | |
|
1448 |
|thisClassName classNameToApply lastChange| |
|
37 | 1449 |
|
202 | 1450 |
classNameToApply := self classNameOfChange:changeNr. |
1451 |
classNameToApply notNil ifTrue:[ |
|
1452 |
self clearCodeView. |
|
1453 |
skipSignal isNil ifTrue:[skipSignal := Signal new]. |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1454 |
changeNr to:(self numberOfChanges) do:[:changeNr | |
202 | 1455 |
thisClassName := self classNameOfChange:changeNr. |
1456 |
thisClassName = classNameToApply ifTrue:[ |
|
1457 |
changeListView selection:changeNr. |
|
1458 |
self applyChange:changeNr. |
|
1459 |
lastChange := changeNr |
|
1460 |
]. |
|
1461 |
]. |
|
1462 |
self autoSelect:lastChange. |
|
1463 |
] |
|
1464 |
] |
|
37 | 1465 |
! |
1466 |
||
202 | 1467 |
doApplyRest |
1468 |
"user wants all changes from changeNr to be applied" |
|
28 | 1469 |
|
202 | 1470 |
self withSelectedChangeDo:[:changeNr | |
1471 |
self clearCodeView. |
|
1472 |
skipSignal isNil ifTrue:[skipSignal := Signal new]. |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1473 |
changeNr to:(self numberOfChanges) do:[:changeNr | |
202 | 1474 |
changeListView selection:changeNr. |
1475 |
self applyChange:changeNr |
|
1476 |
]. |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1477 |
self autoSelect:self numberOfChanges. |
37 | 1478 |
] |
1479 |
! |
|
1480 |
||
45 | 1481 |
doBrowse |
1482 |
"user wants a browser on the class of a change" |
|
1483 |
||
1484 |
|changeNr className cls| |
|
1485 |
||
1486 |
changeNr := changeListView selection. |
|
1487 |
changeNr notNil ifTrue:[ |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1488 |
className := self classNameOfChange:changeNr. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1489 |
className notNil ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1490 |
(cls := Smalltalk classNamed:className) notNil ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1491 |
SystemBrowser |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1492 |
openInClass:cls |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1493 |
selector:(self selectorOfMethodChange:changeNr) |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1494 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1495 |
] |
37 | 1496 |
] |
209
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1497 |
|
dc43fdd0aadf
browse-menu function opens browser in selected method
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
1498 |
"Created: 24.11.1995 / 23:13:24 / cg" |
37 | 1499 |
! |
1500 |
||
73 | 1501 |
doCompare |
1502 |
"compare change with current system version |
|
1503 |
- give a note in transcript" |
|
1504 |
||
1505 |
|changeNr| |
|
1506 |
||
1507 |
changeNr := changeListView selection. |
|
1508 |
changeNr notNil ifTrue:[ |
|
1509 |
self withCursor:(Cursor execute) do:[ |
|
1510 |
self compareChange:changeNr |
|
1511 |
] |
|
1512 |
] |
|
1513 |
! |
|
1514 |
||
45 | 1515 |
doCompress |
1516 |
"compress the change-set; this replaces multiple method-changes by the last |
|
1517 |
(i.e. the most recent) change" |
|
1518 |
||
51 | 1519 |
|aStream searchIndex anyMore deleteSet index |
1520 |
str snapshotProto snapshotPrefix snapshotNameIndex fileName| |
|
45 | 1521 |
|
1522 |
aStream := FileStream readonlyFileNamed:changeFileName. |
|
1523 |
aStream isNil ifTrue:[^ self]. |
|
1524 |
||
221 | 1525 |
self newLabel:'compressing ...'. |
1526 |
||
58 | 1527 |
CompressSnapshotInfo == true ifTrue:[ |
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1528 |
" |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1529 |
get a prototype snapshot record (to be independent of |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1530 |
the actual format .. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1531 |
" |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1532 |
str := WriteStream on:String new. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1533 |
Class addChangeRecordForSnapshot:'foo' to:str. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1534 |
snapshotProto := str contents. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1535 |
snapshotPrefix := snapshotProto copyTo:10. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1536 |
snapshotNameIndex := snapshotProto findString:'foo'. |
58 | 1537 |
]. |
45 | 1538 |
|
1539 |
self withCursor:(Cursor execute) do:[ |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1540 |
|numChanges classes selectors types excla sawExcla |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1541 |
changeNr chunk aParseTree parseTreeChunk |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1542 |
thisClass thisSelector codeChunk codeParser| |
51 | 1543 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1544 |
numChanges := self numberOfChanges. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1545 |
classes := Array new:numChanges. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1546 |
selectors := Array new:numChanges. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1547 |
types := Array new:numChanges. |
45 | 1548 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1549 |
"starting at the end, get the change class and change selector; |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1550 |
collect all in classes / selectors" |
45 | 1551 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1552 |
changeNr := numChanges. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1553 |
excla := aStream class chunkSeparator. |
45 | 1554 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1555 |
[changeNr >= 1] whileTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1556 |
aStream position:(changePositions at:changeNr). |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1557 |
sawExcla := aStream peekFor:excla. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1558 |
chunk := aStream nextChunk. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1559 |
sawExcla ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1560 |
"optimize a bit if multiple methods for same category arrive" |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1561 |
(chunk = parseTreeChunk) ifFalse:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1562 |
aParseTree := Parser parseExpression:chunk. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1563 |
parseTreeChunk := chunk |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1564 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1565 |
(aParseTree notNil |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1566 |
and:[(aParseTree ~~ #Error) |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1567 |
and:[aParseTree isMessage]]) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1568 |
(aParseTree selector == #methodsFor:) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1569 |
thisClass := (aParseTree receiver evaluate). |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1570 |
codeChunk := aStream nextChunk. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1571 |
codeParser := Parser |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1572 |
parseMethodSpecification:codeChunk |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1573 |
in:thisClass |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1574 |
ignoreErrors:true |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1575 |
ignoreWarnings:true. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1576 |
(codeParser notNil and:[codeParser ~~ #Error]) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1577 |
selectors at:changeNr put:(codeParser selector). |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1578 |
classes at:changeNr put:thisClass. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1579 |
types at:changeNr put:#methodsFor |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1580 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1581 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1582 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1583 |
] ifFalse:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1584 |
aParseTree := Parser parseExpression:chunk. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1585 |
parseTreeChunk := chunk. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1586 |
(aParseTree notNil |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1587 |
and:[(aParseTree ~~ #Error) |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1588 |
and:[aParseTree isMessage]]) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1589 |
(aParseTree selector == #removeSelector:) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1590 |
selectors at:changeNr put:(aParseTree arg1 value ). |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1591 |
classes at:changeNr put:(aParseTree receiver evaluate). |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1592 |
types at:changeNr put:#removeSelector |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1593 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1594 |
] ifFalse:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1595 |
CompressSnapshotInfo == true ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1596 |
(chunk startsWith:snapshotPrefix) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1597 |
str := chunk readStream position:snapshotNameIndex. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1598 |
fileName := str upTo:(Character space). |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1599 |
" |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1600 |
kludge to allow use of match-check below |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1601 |
" |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1602 |
selectors at:changeNr put:snapshotPrefix. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1603 |
classes at:changeNr put:fileName. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1604 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1605 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1606 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1607 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1608 |
changeNr := changeNr - 1 |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1609 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1610 |
aStream close. |
45 | 1611 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1612 |
"for all changes, look for another class/selector occurence later |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1613 |
in the list and, if there is one, add change number to the delete set" |
45 | 1614 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1615 |
deleteSet := OrderedCollection new. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1616 |
changeNr := 1. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1617 |
[changeNr < self numberOfChanges] whileTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1618 |
thisClass := classes at:changeNr. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1619 |
thisSelector := selectors at:changeNr. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1620 |
searchIndex := changeNr. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1621 |
anyMore := true. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1622 |
[anyMore] whileTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1623 |
searchIndex := classes indexOf:thisClass |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1624 |
startingAt:(searchIndex + 1). |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1625 |
(searchIndex ~~ 0) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1626 |
((selectors at:searchIndex) == thisSelector) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1627 |
thisClass notNil ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1628 |
deleteSet add:changeNr. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1629 |
anyMore := false |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1630 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1631 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1632 |
] ifFalse:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1633 |
anyMore := false |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1634 |
] |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1635 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1636 |
changeNr := changeNr + 1 |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1637 |
]. |
45 | 1638 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1639 |
"finally delete what has been found" |
45 | 1640 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1641 |
(deleteSet size > 0) ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1642 |
changeListView deselect. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1643 |
index := deleteSet size. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1644 |
[index > 0] whileTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1645 |
self silentDeleteChange:(deleteSet at:index). |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1646 |
index := index - 1 |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1647 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1648 |
self setChangeList. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1649 |
" |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1650 |
scroll back a bit, if we are left way behind the list |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1651 |
" |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1652 |
changeListView firstLineShown > self numberOfChanges ifTrue:[ |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1653 |
changeListView makeLineVisible:self numberOfChanges |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1654 |
]. |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1655 |
self clearCodeView |
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1656 |
] |
221 | 1657 |
]. |
1658 |
self newLabel:''. |
|
1659 |
||
1660 |
"Created: 3.12.1995 / 14:29:54 / cg" |
|
45 | 1661 |
! |
1662 |
||
202 | 1663 |
doDelete |
1664 |
"delete currently selected change" |
|
1665 |
||
1666 |
|changeNr| |
|
73 | 1667 |
|
202 | 1668 |
changeNr := changeListView selection. |
1669 |
changeNr notNil ifTrue:[ |
|
1670 |
self deleteChange:changeNr. |
|
1671 |
self autoSelectOrEnd:changeNr |
|
73 | 1672 |
] |
1673 |
! |
|
1674 |
||
202 | 1675 |
doDeleteClassAll |
1676 |
"delete all changes with same class as currently selected change" |
|
1677 |
||
1678 |
self withSelectedChangeDo:[:changeNr | |
|
1679 |
| classNameToDelete | |
|
45 | 1680 |
|
202 | 1681 |
classNameToDelete := self classNameOfChange:changeNr. |
1682 |
classNameToDelete notNil ifTrue:[ |
|
1683 |
changeListView selection:nil. |
|
1684 |
self silentDeleteChangesFor:classNameToDelete |
|
1685 |
from:1 |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1686 |
to:(self numberOfChanges). |
202 | 1687 |
self setChangeList. |
1688 |
self autoSelectOrEnd:changeNr |
|
51 | 1689 |
] |
1690 |
] |
|
1691 |
! |
|
1692 |
||
73 | 1693 |
doDeleteClassRest |
1694 |
"delete rest of changes with same class as currently selected change" |
|
1695 |
||
1696 |
self withSelectedChangeDo:[:changeNr | |
|
1697 |
| classNameToDelete | |
|
1698 |
||
1699 |
classNameToDelete := self classNameOfChange:changeNr. |
|
1700 |
classNameToDelete notNil ifTrue:[ |
|
1701 |
changeListView selection:nil. |
|
1702 |
self silentDeleteChangesFor:classNameToDelete |
|
1703 |
from:changeNr |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1704 |
to:(self numberOfChanges). |
73 | 1705 |
self setChangeList. |
1706 |
self autoSelectOrEnd:changeNr |
|
1707 |
] |
|
1708 |
] |
|
1709 |
! |
|
1710 |
||
202 | 1711 |
doDeleteRest |
1712 |
"delete all changes from current to the end" |
|
51 | 1713 |
|
202 | 1714 |
|changeNr| |
51 | 1715 |
|
202 | 1716 |
changeNr := changeListView selection. |
1717 |
changeNr notNil ifTrue:[ |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1718 |
self deleteChangesFrom:changeNr to:(self numberOfChanges). |
202 | 1719 |
self clearCodeView. |
1720 |
self autoSelectOrEnd:changeNr-1 |
|
51 | 1721 |
] |
132 | 1722 |
! |
1723 |
||
1724 |
doFileoutAndDeleteClassAll |
|
1725 |
"first fileOut the selected changes class then delete all changes |
|
1726 |
for it." |
|
1727 |
||
1728 |
self withSelectedChangeDo:[:changeNr | |
|
1729 |
| className class | |
|
1730 |
||
1731 |
className := self classNameOfChange:changeNr. |
|
1732 |
className notNil ifTrue:[ |
|
1733 |
class := Smalltalk classNamed:className. |
|
1734 |
class notNil ifTrue:[ |
|
1735 |
Class fileOutErrorSignal handle:[:ex | |
|
1736 |
self warn:('fileout failed: ' , ex errorString). |
|
1737 |
] do:[ |
|
1738 |
class fileOut. |
|
1739 |
self doDeleteClassAll |
|
1740 |
]. |
|
1741 |
]. |
|
1742 |
||
1743 |
]. |
|
1744 |
] |
|
1745 |
||
1746 |
"Modified: 6.9.1995 / 17:11:16 / claus" |
|
202 | 1747 |
! |
73 | 1748 |
|
202 | 1749 |
doMakePatch |
1750 |
"user wants a change to be made a patch |
|
1751 |
- copy it over to the patches file" |
|
89 | 1752 |
|
202 | 1753 |
|changeNr| |
89 | 1754 |
|
202 | 1755 |
changeNr := changeListView selection. |
1756 |
changeNr notNil ifTrue:[ |
|
1757 |
self makeChangeAPatch:changeNr. |
|
1758 |
self autoSelect:(changeNr + 1) |
|
1759 |
] |
|
73 | 1760 |
! |
1761 |
||
202 | 1762 |
doMakePermanent |
1763 |
"user wants a change to be made permanent |
|
1764 |
- rewrite the source file where this change has to go" |
|
1765 |
||
1766 |
|yesNoBox| |
|
73 | 1767 |
|
202 | 1768 |
yesNoBox := YesNoBox new. |
1769 |
yesNoBox title:(resources at:'Warning: this operation cannot be undone'). |
|
1770 |
yesNoBox okText:(resources at:'continue'). |
|
1771 |
yesNoBox noText:(resources at:'abort'). |
|
1772 |
yesNoBox okAction:[ |changeNr| |
|
1773 |
||
1774 |
changeNr := changeListView selection. |
|
1775 |
changeNr notNil ifTrue:[ |
|
1776 |
self makeChangePermanent:changeNr. |
|
1777 |
self autoSelect:(changeNr + 1) |
|
1778 |
] |
|
1779 |
]. |
|
1780 |
yesNoBox showAtPointer |
|
73 | 1781 |
! |
1782 |
||
202 | 1783 |
doSave |
1784 |
"user wants a change to be appended to a file" |
|
73 | 1785 |
|
202 | 1786 |
|changeNr fileName| |
73 | 1787 |
|
202 | 1788 |
changeNr := changeListView selection. |
1789 |
changeNr notNil ifTrue:[ |
|
1790 |
fileName := Dialog |
|
1791 |
requestFileName:'append change to:' |
|
1792 |
default:'' |
|
1793 |
ok:'append' |
|
1794 |
abort:'abort' |
|
1795 |
pattern:'*.chg'. |
|
1796 |
||
1797 |
fileName notNil ifTrue:[ |
|
1798 |
self withCursor:(Cursor write) do:[ |
|
1799 |
self appendChange:changeNr toFile:fileName. |
|
1800 |
]. |
|
1801 |
self autoSelect:(changeNr + 1) |
|
73 | 1802 |
]. |
202 | 1803 |
] |
73 | 1804 |
! |
1805 |
||
202 | 1806 |
doSaveClass |
1807 |
"user wants changes for some class from current to end to be appended to a file" |
|
89 | 1808 |
|
202 | 1809 |
self doSaveClassFrom:1 |
89 | 1810 |
! |
1811 |
||
202 | 1812 |
doSaveClassAll |
1813 |
"user wants changes for some class from current to end to be appended to a file" |
|
73 | 1814 |
|
202 | 1815 |
self doSaveClassFrom:1 |
1816 |
! |
|
1817 |
||
1818 |
doSaveClassFrom:startNr |
|
1819 |
"user wants changes from current to end to be appended to a file" |
|
1820 |
||
1821 |
|changeNr classNameToSave| |
|
73 | 1822 |
|
202 | 1823 |
changeNr := changeListView selection. |
1824 |
changeNr notNil ifTrue:[ |
|
1825 |
classNameToSave := self classNameOfChange:changeNr. |
|
1826 |
classNameToSave notNil ifTrue:[ |
|
1827 |
self saveClass:classNameToSave from:startNr |
|
1828 |
] |
|
1829 |
] |
|
1830 |
! |
|
73 | 1831 |
|
202 | 1832 |
doSaveClassRest |
1833 |
"user wants changes for some class from current to end to be appended to a file" |
|
73 | 1834 |
|
202 | 1835 |
|changeNr| |
132 | 1836 |
|
202 | 1837 |
changeNr := changeListView selection. |
1838 |
changeNr notNil ifTrue:[ |
|
1839 |
self doSaveClassFrom:changeNr |
|
1840 |
] |
|
81 | 1841 |
! |
1842 |
||
202 | 1843 |
doSaveRest |
1844 |
"user wants changes from current to end to be appended to a file" |
|
73 | 1845 |
|
202 | 1846 |
|changeNr fileName| |
51 | 1847 |
|
202 | 1848 |
changeNr := changeListView selection. |
1849 |
changeNr notNil ifTrue:[ |
|
1850 |
fileName := Dialog |
|
1851 |
requestFileName:'append changes to:' |
|
1852 |
default:'' |
|
1853 |
ok:'append' |
|
1854 |
abort:'abort' |
|
1855 |
pattern:'*.chg'. |
|
51 | 1856 |
|
202 | 1857 |
fileName notNil ifTrue:[ |
1858 |
self withCursor:(Cursor write) do:[ |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1859 |
changeNr to:(self numberOfChanges) do:[:changeNr | |
202 | 1860 |
changeListView selection:changeNr. |
1861 |
(self appendChange:changeNr toFile:fileName) ifFalse:[ |
|
1862 |
^ self |
|
1863 |
] |
|
1864 |
] |
|
1865 |
] |
|
73 | 1866 |
]. |
202 | 1867 |
] |
51 | 1868 |
! |
1869 |
||
202 | 1870 |
doUpdate |
1871 |
"reread the changes-file" |
|
51 | 1872 |
|
202 | 1873 |
self readChangesFileInBackground:true. |
1874 |
realized ifTrue:[ |
|
1875 |
self setChangeList. |
|
1876 |
] |
|
1877 |
||
51 | 1878 |
! |
1879 |
||
202 | 1880 |
doWriteBack |
1881 |
"write back the list onto the changes file" |
|
51 | 1882 |
|
1883 |
anyChanges ifTrue:[ |
|
1884 |
self writeBackChanges. |
|
202 | 1885 |
realized ifTrue:[ |
1886 |
self readChangesFileInBackground:false. |
|
1887 |
realized ifTrue:[ |
|
1888 |
self setChangeList |
|
1889 |
] |
|
1890 |
] |
|
1891 |
] |
|
1892 |
! |
|
126 | 1893 |
|
202 | 1894 |
noChangesAllowed |
1895 |
"show a warning that changes cannot be changed" |
|
93 | 1896 |
|
202 | 1897 |
self warn:'changes are not allowed to be changed' |
0 | 1898 |
! |
1899 |
||
202 | 1900 |
saveClass:aClassName from:startNr |
1901 |
"user wants changes from current to end to be appended to a file" |
|
51 | 1902 |
|
202 | 1903 |
|changeNr fileName| |
51 | 1904 |
|
202 | 1905 |
changeNr := changeListView selection. |
1906 |
changeNr notNil ifTrue:[ |
|
1907 |
fileName := Dialog |
|
1908 |
requestFileName:'append changes for class to:' |
|
1909 |
default:'' |
|
1910 |
ok:'append' |
|
1911 |
abort:'abort' |
|
1912 |
pattern:'*.chg'. |
|
0 | 1913 |
|
202 | 1914 |
fileName notNil ifTrue:[ |
1915 |
self withCursor:(Cursor write) do:[ |
|
223
d451e2badbd1
fixed handling of primitive def/var/function changes
Claus Gittinger <cg@exept.de>
parents:
221
diff
changeset
|
1916 |
startNr to:(self numberOfChanges) do:[:changeNr | |
202 | 1917 |
|thisClassName| |
0 | 1918 |
|
202 | 1919 |
thisClassName := self classNameOfChange:changeNr. |
1920 |
thisClassName = aClassName ifTrue:[ |
|
1921 |
changeListView selection:changeNr. |
|
1922 |
(self appendChange:changeNr toFile:fileName) ifFalse:[ |
|
1923 |
^ self |
|
1924 |
] |
|
1925 |
] |
|
1926 |
] |
|
1927 |
] |
|
45 | 1928 |
]. |
202 | 1929 |
] |
1930 |
! ! |
|
0 | 1931 |
|
202 | 1932 |
!ChangesBrowser class methodsFor:'documentation'! |
1933 |
||
1934 |
version |
|
225 | 1935 |
^ '$Header: /cvs/stx/stx/libtool/ChangesBrowser.st,v 1.56 1995-12-03 18:45:01 cg Exp $'! ! |