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