1226 autoCompare onChangeSend:#autoCompareChanged to:self. |
1226 autoCompare onChangeSend:#autoCompareChanged to:self. |
1227 autoUpdate := false asValue. |
1227 autoUpdate := false asValue. |
1228 autoloadAsRequired := false asValue. |
1228 autoloadAsRequired := false asValue. |
1229 applyInOriginalNameSpace := true asValue. |
1229 applyInOriginalNameSpace := true asValue. |
1230 applyInOriginalNameSpace |
1230 applyInOriginalNameSpace |
1231 onChangeEvaluate:[ |
1231 onChangeEvaluate:[ |
1232 autoCompare value ifTrue:[ |
1232 autoCompare value ifTrue:[ |
1233 self doUpdate |
1233 self doUpdate |
1234 ]. |
1234 ]. |
1235 ]. |
1235 ]. |
1236 updateChangeSet := true "false" asValue. |
1236 updateChangeSet := true "false" asValue. |
1237 |
1237 |
1238 " |
1238 " |
1239 checkBlock is executed by the Processor. |
1239 checkBlock is executed by the Processor. |
1240 We use #pushEvent: to perform the update |
1240 We use #pushEvent: to perform the update |
1241 in our windowgroups process. |
1241 in our windowgroups process. |
1242 " |
1242 " |
1243 checkBlock := [self pushEvent:#checkIfFileHasChanged]. |
1243 checkBlock := [self pushEvent:#checkIfFileHasChanged]. |
1244 |
1244 |
1245 oldStyle ifFalse:[ |
1245 oldStyle ifFalse:[ |
1246 menuPanel := MenuPanel in:self. |
1246 menuPanel := MenuPanel in:self. |
1247 "/ menuPanel level:1. |
1247 "/ menuPanel level:1. |
1248 menuPanel verticalLayout:false. |
1248 menuPanel verticalLayout:false. |
1249 menuPanel receiver:self. |
1249 menuPanel receiver:self. |
1250 menuPanel menu:(self pullDownMenu). |
1250 menuPanel menu:(self pullDownMenu). |
1251 |
1251 |
1252 mH := menuPanel preferredExtent y. |
1252 mH := menuPanel preferredExtent y. |
1253 menuPanel origin:(0.0 @ 0.0) corner:(1.0 @ (mH)). |
1253 menuPanel origin:(0.0 @ 0.0) corner:(1.0 @ (mH)). |
1254 mH := mH + 1. |
1254 mH := mH + 1. |
1255 ] ifTrue:[ |
1255 ] ifTrue:[ |
1256 mH := 0.0 |
1256 mH := 0.0 |
1257 ]. |
1257 ]. |
1258 |
1258 |
1259 panel := VariableVerticalPanel origin:(0.0 @ mH) |
1259 panel := VariableVerticalPanel origin:(0.0 @ mH) |
1260 corner:(1.0 @ 1.0) |
1260 corner:(1.0 @ 1.0) |
1261 borderWidth:0 |
1261 borderWidth:0 |
1262 in:self. |
1262 in:self. |
1263 |
1263 |
1264 upperFrame := panel. |
1264 upperFrame := panel. |
1265 oldStyle ifTrue:[ |
1265 oldStyle ifTrue:[ |
1266 upperFrame := VariableHorizontalPanel origin:(0.0 @ 0.0) corner:(1.0 @ 0.3) in:panel. |
1266 upperFrame := VariableHorizontalPanel origin:(0.0 @ 0.0) corner:(1.0 @ 0.3) in:panel. |
1267 ]. |
1267 ]. |
1268 |
1268 |
1269 v := HVScrollableView for:SelectionInListView miniScrollerH:true in:upperFrame. |
1269 v := HVScrollableView for:SelectionInListView miniScrollerH:true in:upperFrame. |
1270 oldStyle ifTrue:[ |
1270 oldStyle ifTrue:[ |
1271 v origin:(0.0 @ 0.0) corner:(0.75 @ 1.0). |
1271 v origin:(0.0 @ 0.0) corner:(0.75 @ 1.0). |
1272 ] ifFalse:[ |
1272 ] ifFalse:[ |
1273 v origin:(0.0 @ 0.0) corner:(1.0 @ 0.3). |
1273 v origin:(0.0 @ 0.0) corner:(1.0 @ 0.3). |
1274 ]. |
1274 ]. |
1275 |
1275 |
1276 changeListView := v scrolledView. |
1276 changeListView := v scrolledView. |
1277 changeListView delegate:self. |
1277 changeListView delegate:self. |
1278 changeListView menuHolder:self; menuPerformer:self; menuMessage:#changeListMenu. |
1278 changeListView menuHolder:self; menuPerformer:self; menuMessage:#changeListMenu. |
1279 changeListView doubleClickAction:[:line | self doubleClickOnChange:line]. |
1279 changeListView doubleClickAction:[:line | self doubleClickOnChange:line]. |
1280 oldStyle ifFalse:[ |
1280 oldStyle ifFalse:[ |
1281 changeListView multipleSelectOk:true. |
1281 changeListView multipleSelectOk:true. |
1282 ]. |
1282 ]. |
1283 |
1283 |
1284 oldStyle ifTrue:[ |
1284 oldStyle ifTrue:[ |
1285 buttonPanel := VerticalPanelView in:upperFrame. |
1285 buttonPanel := VerticalPanelView in:upperFrame. |
1286 buttonPanel origin:(0.75 @ 0.0) corner:(1.0 @ 1.0). |
1286 buttonPanel origin:(0.75 @ 0.0) corner:(1.0 @ 1.0). |
1287 buttonPanel verticalLayout:#topSpace; horizontalLayout:#leftSpace. |
1287 buttonPanel verticalLayout:#topSpace; horizontalLayout:#leftSpace. |
1288 |
1288 |
1289 checkBox := CheckBox new model:autoCompare. |
1289 checkBox := CheckBox new model:autoCompare. |
1290 checkBox label:(resources string:'Auto Compare'). |
1290 checkBox label:(resources string:'Auto Compare'). |
1291 checkBox action:[:val | autoCompare value:val]. |
1291 checkBox action:[:val | autoCompare value:val]. |
1292 buttonPanel addSubView:checkBox. |
1292 buttonPanel addSubView:checkBox. |
1293 |
1293 |
1294 checkBox := CheckBox new model:autoUpdate. |
1294 checkBox := CheckBox new model:autoUpdate. |
1295 checkBox label:(resources string:'Auto Update'). |
1295 checkBox label:(resources string:'Auto Update'). |
1296 checkBox action:[:val | autoUpdate value:val]. |
1296 checkBox action:[:val | autoUpdate value:val]. |
1297 buttonPanel addSubView:checkBox. |
1297 buttonPanel addSubView:checkBox. |
1298 |
1298 |
1299 checkBox := CheckBox new. |
1299 checkBox := CheckBox new. |
1300 checkBox label:(resources string:'Apply in original NameSpace' withCRs). |
1300 checkBox label:(resources stringWithCRs:'Apply in original NameSpace'). |
1301 checkBox model:applyInOriginalNameSpace. |
1301 checkBox model:applyInOriginalNameSpace. |
1302 buttonPanel addSubView:checkBox. |
1302 buttonPanel addSubView:checkBox. |
1303 ]. |
1303 ]. |
1304 |
1304 |
1305 "/ protectExistingMethods := CheckBox new. |
1305 "/ protectExistingMethods := CheckBox new. |
1306 "/ protectExistingMethods label:(resources string:'Protect existing code' withCRs). |
1306 "/ protectExistingMethods label:(resources string:'Protect existing code' withCRs). |
1307 "/ protectExistingMethods model:protectExistingMethods. |
1307 "/ protectExistingMethods model:protectExistingMethods. |
3305 aStream isNil ifTrue:[^ nil]. |
3305 aStream isNil ifTrue:[^ nil]. |
3306 |
3306 |
3307 showDiff := false. |
3307 showDiff := false. |
3308 |
3308 |
3309 (self changeIsFollowupMethodChange:changeNr) ifFalse:[ |
3309 (self changeIsFollowupMethodChange:changeNr) ifFalse:[ |
3310 sawExcla := aStream peekFor:(aStream class chunkSeparator). |
3310 sawExcla := aStream peekFor:(aStream class chunkSeparator). |
3311 chunk := aStream nextChunk. |
3311 chunk := aStream nextChunk. |
3312 ] ifTrue:[ |
3312 ] ifTrue:[ |
3313 chunk := (changeChunks at:changeNr). |
3313 chunk := (changeChunks at:changeNr). |
3314 sawExcla := true. |
3314 sawExcla := true. |
3315 ]. |
3315 ]. |
3316 |
3316 |
3317 isSame := nil. |
3317 isSame := nil. |
3318 |
3318 |
3319 beep := false. |
3319 beep := false. |
3320 sawExcla ifFalse:[ |
3320 sawExcla ifFalse:[ |
3321 outcome := 'cannot compare this change\\(i.e. this is not a method change).'. |
3321 outcome := 'cannot compare this change\\(i.e. this is not a method change).'. |
3322 |
3322 |
3323 Class nameSpaceQuerySignal answer:(self nameSpaceForApply) |
3323 Class nameSpaceQuerySignal answer:(self nameSpaceForApply) |
3324 do:[ |
3324 do:[ |
3325 parseTree := Parser parseExpression:chunk. |
3325 parseTree := Parser parseExpression:chunk. |
3326 ]. |
3326 ]. |
3327 (parseTree notNil and:[parseTree ~~ #Error and:[ parseTree isMessage ]]) ifTrue:[ |
3327 (parseTree notNil and:[parseTree ~~ #Error and:[ parseTree isMessage ]]) ifTrue:[ |
3328 selector := parseTree selector. |
3328 selector := parseTree selector. |
3329 |
3329 |
3330 selector == #'removeSelector:' ifTrue:[ |
3330 selector == #'removeSelector:' ifTrue:[ |
3331 thisClass := (parseTree receiver evaluate). |
3331 thisClass := (parseTree receiver evaluate). |
3332 thisClass isBehavior ifTrue:[ |
3332 thisClass isBehavior ifTrue:[ |
3333 (self checkClassIsLoaded:thisClass) ifTrue:[ |
3333 (self checkClassIsLoaded:thisClass) ifTrue:[ |
3334 selector := (parseTree arg1 evaluate). |
3334 selector := (parseTree arg1 evaluate). |
3335 (thisClass includesSelector:selector) ifTrue:[ |
3335 (thisClass includesSelector:selector) ifTrue:[ |
3336 outcome := 'Change removes the #' , selector , ' method from ' , thisClass name. |
3336 outcome := 'Change removes the #' , selector , ' method from ' , thisClass name. |
3337 isSame := false. |
3337 isSame := false. |
3338 ] ifFalse:[ |
3338 ] ifFalse:[ |
3339 outcome := 'Change has no effect\\(there is no method for #' , selector , ' in ' , thisClass name , ')'. |
3339 outcome := 'Change has no effect\\(there is no method for #' , selector , ' in ' , thisClass name , ')'. |
3340 isSame := true. |
3340 isSame := true. |
3341 ] |
3341 ] |
3342 ] ifFalse:[ |
3342 ] ifFalse:[ |
3343 beep := true. |
3343 beep := true. |
3344 outcome := 'Cannot compare this change (compare requires class to be loaded).'. |
3344 outcome := 'Cannot compare this change (compare requires class to be loaded).'. |
3345 isSame := nil. |
3345 isSame := nil. |
3346 ] |
3346 ] |
3347 ] ifFalse:[ |
3347 ] ifFalse:[ |
3348 outcome := 'Cannot compare this change (class not present)'. |
3348 outcome := 'Cannot compare this change (class not present)'. |
3349 isSame := nil. |
3349 isSame := nil. |
3350 ]. |
3350 ]. |
3351 ]. |
3351 ]. |
3352 selector == #'category:' ifTrue:[ |
3352 selector == #'category:' ifTrue:[ |
3353 parseTree receiver isMessage ifTrue:[ |
3353 parseTree receiver isMessage ifTrue:[ |
3354 parseTree receiver selector == #compiledMethodAt: ifTrue:[ |
3354 parseTree receiver selector == #compiledMethodAt: ifTrue:[ |
3355 |receiver| |
3355 |receiver| |
3356 receiver := parseTree receiver. |
3356 receiver := parseTree receiver. |
3357 (receiver receiver evaluate isBehavior |
3357 (receiver receiver evaluate isBehavior |
3358 and:[(method := receiver evaluate) isMethod]) ifTrue:[ |
3358 and:[(method := receiver evaluate) isMethod]) ifTrue:[ |
3359 method category = parseTree arg1 evaluate ifTrue:[ |
3359 method category = parseTree arg1 evaluate ifTrue:[ |
3360 outcome := 'Change has no effect\\(same category)'. |
3360 outcome := 'Change has no effect\\(same category)'. |
3361 isSame := true. |
3361 isSame := true. |
3362 ] ifFalse:[ |
3362 ] ifFalse:[ |
3363 outcome := 'Category is different (''' , method category , ''' vs. ''' , parseTree arg1 evaluate , ''')'. |
3363 outcome := 'Category is different (''' , method category , ''' vs. ''' , parseTree arg1 evaluate , ''')'. |
3364 isSame := false. |
3364 isSame := false. |
3365 ] |
3365 ] |
3366 ] ifFalse:[ |
3366 ] ifFalse:[ |
3367 beep := true. |
3367 beep := true. |
3368 outcome := 'There is no such method'. |
3368 outcome := 'There is no such method'. |
3369 isSame := nil. |
3369 isSame := nil. |
3370 ] |
3370 ] |
3371 ] |
3371 ] |
3372 ] |
3372 ] |
3373 ]. |
3373 ]. |
3374 selector == #'comment:' ifTrue:[ |
3374 selector == #'comment:' ifTrue:[ |
3375 thisClass := (parseTree receiver evaluate). |
3375 thisClass := (parseTree receiver evaluate). |
3376 thisClass isBehavior ifTrue:[ |
3376 thisClass isBehavior ifTrue:[ |
3377 (self checkClassIsLoaded:thisClass) ifTrue:[ |
3377 (self checkClassIsLoaded:thisClass) ifTrue:[ |
3378 (thisClass comment = parseTree arg1 evaluate) ifTrue:[ |
3378 (thisClass comment = parseTree arg1 evaluate) ifTrue:[ |
3379 outcome := 'Change has no effect\\(same comment)'. |
3379 outcome := 'Change has no effect\\(same comment)'. |
3380 isSame := true. |
3380 isSame := true. |
3381 ] ifFalse:[ |
3381 ] ifFalse:[ |
3382 outcome := 'Comment is different'. |
3382 outcome := 'Comment is different'. |
3383 isSame := false. |
3383 isSame := false. |
3384 ] |
3384 ] |
3385 ] ifFalse:[ |
3385 ] ifFalse:[ |
3386 beep := true. |
3386 beep := true. |
3387 outcome := 'Cannot compare this change (compare requires class to be loaded).'. |
3387 outcome := 'Cannot compare this change (compare requires class to be loaded).'. |
3388 isSame := nil. |
3388 isSame := nil. |
3389 ] |
3389 ] |
3390 ] ifFalse:[ |
3390 ] ifFalse:[ |
3391 outcome := 'Cannot compare this change (class not present)'. |
3391 outcome := 'Cannot compare this change (class not present)'. |
3392 isSame := nil. |
3392 isSame := nil. |
3393 ]. |
3393 ]. |
3394 ]. |
3394 ]. |
3395 |
3395 |
3396 selector == #'instanceVariableNames:' ifTrue:[ |
3396 selector == #'instanceVariableNames:' ifTrue:[ |
3397 parseTree receiver isMessage ifTrue:[ |
3397 parseTree receiver isMessage ifTrue:[ |
3398 parseTree receiver selector == #class ifTrue:[ |
3398 parseTree receiver selector == #class ifTrue:[ |
3399 thisClass := (parseTree receiver evaluate). |
3399 thisClass := (parseTree receiver evaluate). |
3400 varsHere := thisClass instanceVariableString asCollectionOfWords. |
3400 varsHere := thisClass instanceVariableString asCollectionOfWords. |
3401 varsInChange := (parseTree arguments at:1) evaluate asCollectionOfWords. |
3401 varsInChange := (parseTree arguments at:1) evaluate asCollectionOfWords. |
3402 varsHere = varsInChange ifTrue:[ |
3402 varsHere = varsInChange ifTrue:[ |
3403 outcome := 'Change has no effect\\(same definition)'. |
3403 outcome := 'Change has no effect\\(same definition)'. |
3404 isSame := true. |
3404 isSame := true. |
3405 ] ifFalse:[ |
3405 ] ifFalse:[ |
3406 outcome := 'Class-instanceVariable definition is different'. |
3406 outcome := 'Class-instanceVariable definition is different'. |
3407 isSame := false. |
3407 isSame := false. |
3408 ]. |
3408 ]. |
3409 ]. |
3409 ]. |
3410 ] |
3410 ] |
3411 ]. |
3411 ]. |
3412 |
3412 |
3413 (Class definitionSelectors includes:selector) |
3413 (Class definitionSelectors includes:selector) |
3414 "/ selector == #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:' |
3414 "/ selector == #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:' |
3415 ifTrue:[ |
3415 ifTrue:[ |
3416 superClass := (parseTree receiver evaluate). |
3416 superClass := (parseTree receiver evaluate). |
3417 superClass isBehavior ifFalse:[ |
3417 superClass isBehavior ifFalse:[ |
3418 outcome := 'Cannot compare this change\\(superclass not loaded).'. |
3418 outcome := 'Cannot compare this change\\(superclass not loaded).'. |
3419 isSame := nil. |
3419 isSame := nil. |
3420 ] ifTrue:[ |
3420 ] ifTrue:[ |
3421 (self checkClassIsLoaded:superClass) ifTrue:[ |
3421 (self checkClassIsLoaded:superClass) ifTrue:[ |
3422 thisClassSym := (parseTree arguments at:1) evaluate. |
3422 thisClassSym := (parseTree arguments at:1) evaluate. |
3423 |
3423 |
3424 (selector endsWith:':privateIn:') ifTrue:[ |
3424 (selector endsWith:':privateIn:') ifTrue:[ |
3425 ownerClass := (parseTree arguments at:5) evaluate. |
3425 ownerClass := (parseTree arguments at:5) evaluate. |
3426 ownerClass isBehavior ifTrue:[ |
3426 ownerClass isBehavior ifTrue:[ |
3427 thisClass := ownerClass privateClassesAt:thisClassSym. |
3427 thisClass := ownerClass privateClassesAt:thisClassSym. |
3428 ]. |
3428 ]. |
3429 ] ifFalse:[ |
3429 ] ifFalse:[ |
3430 thisClass := (self nameSpaceForApply) at:thisClassSym ifAbsent:nil. |
3430 thisClass := (self nameSpaceForApply) at:thisClassSym ifAbsent:nil. |
3431 ]. |
3431 ]. |
3432 thisClass isNil ifTrue:[ |
3432 thisClass isNil ifTrue:[ |
3433 outcome := 'Change defines the class: ' , thisClassSym allBold. |
3433 outcome := 'Change defines the class: ' , thisClassSym allBold. |
3434 isSame := false. |
3434 isSame := false. |
3435 ] ifFalse:[ |
3435 ] ifFalse:[ |
3436 (isLoaded := self checkClassIsLoaded:thisClass) ifFalse:[ |
3436 (isLoaded := self checkClassIsLoaded:thisClass) ifFalse:[ |
3437 outcome := 'Cannot compare this change\\(compare requires class to be loaded).'. |
3437 outcome := 'Cannot compare this change\\(compare requires class to be loaded).'. |
3438 isSame := nil. |
3438 isSame := nil. |
3439 ] ifTrue:[ |
3439 ] ifTrue:[ |
3440 superClassHere := thisClass superclass name. |
3440 superClassHere := thisClass superclass name. |
3441 superClassInChange := parseTree receiver name. |
3441 superClassInChange := parseTree receiver name. |
3442 superClassHere ~~ superClassInChange ifTrue:[ |
3442 superClassHere ~~ superClassInChange ifTrue:[ |
3443 outcome := 'Superclass is different.'. |
3443 outcome := 'Superclass is different.'. |
3444 isSame := false. |
3444 isSame := false. |
3445 ] ifFalse:[ |
3445 ] ifFalse:[ |
3446 varsHere := thisClass instanceVariableString asCollectionOfWords. |
3446 varsHere := thisClass instanceVariableString asCollectionOfWords. |
3447 varsInChange := (parseTree arguments at:2) evaluate asCollectionOfWords. |
3447 varsInChange := (parseTree arguments at:2) evaluate asCollectionOfWords. |
3448 varsHere = varsInChange ifTrue:[ |
3448 varsHere = varsInChange ifTrue:[ |
3449 thisClass classVariableString asCollectionOfWords = (parseTree arguments at:3) evaluate asCollectionOfWords ifTrue:[ |
3449 thisClass classVariableString asCollectionOfWords = (parseTree arguments at:3) evaluate asCollectionOfWords ifTrue:[ |
3450 ((thisClass sharedPools size == 0) and:[(parseTree arguments at:4) evaluate = '']) ifTrue:[ |
3450 ((thisClass sharedPools size == 0) and:[(parseTree arguments at:4) evaluate = '']) ifTrue:[ |
3451 ((selector endsWith:':category:') |
3451 ((selector endsWith:':category:') |
3452 and:[thisClass category ~= (parseTree arguments at:5) evaluate]) ifTrue:[ |
3452 and:[thisClass category ~= (parseTree arguments at:5) evaluate]) ifTrue:[ |
3453 outcome := 'Category is different'. |
3453 outcome := 'Category is different'. |
3454 isSame := false. |
3454 isSame := false. |
3455 ] ifFalse:[ |
3455 ] ifFalse:[ |
3456 outcome := 'Change has no effect\\(same definition)'. |
3456 outcome := 'Change has no effect\\(same definition)'. |
3457 isSame := true. |
3457 isSame := true. |
3458 ] |
3458 ] |
3459 "/ thisClass category = (parseTree arguments at:5) evaluate ifTrue:[ |
3459 "/ thisClass category = (parseTree arguments at:5) evaluate ifTrue:[ |
3460 "/ outcome := 'Change has no effect\\(same definition)'. |
3460 "/ outcome := 'Change has no effect\\(same definition)'. |
3461 "/ isSame := true. |
3461 "/ isSame := true. |
3462 "/ ] ifFalse:[ |
3462 "/ ] ifFalse:[ |
3463 "/ outcome := 'Category is different'. |
3463 "/ outcome := 'Category is different'. |
3464 "/ isSame := false. |
3464 "/ isSame := false. |
3465 "/ ] |
3465 "/ ] |
3466 ] ifFalse:[ |
3466 ] ifFalse:[ |
3467 outcome := 'SharedPool definition is different'. |
3467 outcome := 'SharedPool definition is different'. |
3468 isSame := false. |
3468 isSame := false. |
3469 ]. |
3469 ]. |
3470 ] ifFalse:[ |
3470 ] ifFalse:[ |
3471 outcome := 'ClassVariable definition is different'. |
3471 outcome := 'ClassVariable definition is different'. |
3472 isSame := false. |
3472 isSame := false. |
3473 ] |
3473 ] |
3474 ] ifFalse:[ |
3474 ] ifFalse:[ |
3475 outcome := 'InstanceVariable definition is different'. |
3475 outcome := 'InstanceVariable definition is different'. |
3476 isSame := false. |
3476 isSame := false. |
3477 addedVars := varsInChange select:[:eachVar | (varsHere includes:eachVar) not]. |
3477 addedVars := varsInChange select:[:eachVar | (varsHere includes:eachVar) not]. |
3478 removedVars := varsHere select:[:eachVar | (varsInChange includes:eachVar) not]. |
3478 removedVars := varsHere select:[:eachVar | (varsInChange includes:eachVar) not]. |
3479 addedVars isEmpty ifTrue:[ |
3479 addedVars isEmpty ifTrue:[ |
3480 removedVars isEmpty ifTrue:[ |
3480 removedVars isEmpty ifTrue:[ |
3481 outcome := 'Change reorders instanceVariable(s)'. |
3481 outcome := 'Change reorders instanceVariable(s)'. |
3482 ] ifFalse:[ |
3482 ] ifFalse:[ |
3483 removedVars := removedVars collect:[:eachVar | '''' , eachVar , '''']. |
3483 removedVars := removedVars collect:[:eachVar | '''' , eachVar , '''']. |
3484 outcome := 'Change removes instanceVariable(s): ' , (removedVars asStringWith:Character space) allBold. |
3484 outcome := 'Change removes instanceVariable(s): ' , (removedVars asStringWith:Character space) allBold. |
3485 ] |
3485 ] |
3486 ] ifFalse:[ |
3486 ] ifFalse:[ |
3487 removedVars isEmpty ifTrue:[ |
3487 removedVars isEmpty ifTrue:[ |
3488 addedVars := addedVars collect:[:eachVar | '''' , eachVar , '''']. |
3488 addedVars := addedVars collect:[:eachVar | '''' , eachVar , '''']. |
3489 outcome := 'Change adds instanceVariable(s): ' , (addedVars asStringWith:Character space) allBold. |
3489 outcome := 'Change adds instanceVariable(s): ' , (addedVars asStringWith:Character space) allBold. |
3490 ]. |
3490 ]. |
3491 ]. |
3491 ]. |
3492 ] |
3492 ] |
3493 ] |
3493 ] |
3494 ] |
3494 ] |
3495 ] |
3495 ] |
3496 ] |
3496 ] |
3497 ] |
3497 ] |
3498 ] |
3498 ] |
3499 ] |
3499 ] |
3500 ] ifTrue:[ |
3500 ] ifTrue:[ |
3501 Class nameSpaceQuerySignal answer:(self nameSpaceForApply) |
3501 Class nameSpaceQuerySignal answer:(self nameSpaceForApply) |
3502 do:[ |
3502 do:[ |
3503 parseTree := Parser parseExpression:chunk. |
3503 parseTree := Parser parseExpression:chunk. |
3504 ]. |
3504 ]. |
3505 (parseTree notNil |
3505 (parseTree notNil |
3506 and:[parseTree ~~ #Error |
3506 and:[parseTree ~~ #Error |
3507 and:[parseTree isMessage]]) ifTrue:[ |
3507 and:[parseTree isMessage]]) ifTrue:[ |
3508 "/ Squeak support (#methodsFor:***) |
3508 "/ Squeak support (#methodsFor:***) |
3509 (#( |
3509 (#( |
3510 #methodsFor: |
3510 #methodsFor: |
3511 #privateMethodsFor: |
3511 #privateMethodsFor: |
3512 #publicMethodsFor: |
3512 #publicMethodsFor: |
3513 #ignoredMethodsFor: |
3513 #ignoredMethodsFor: |
3514 #protectedMethodsFor: |
3514 #protectedMethodsFor: |
3515 |
3515 |
3516 #methodsFor:stamp: "/ Squeak support |
3516 #methodsFor:stamp: "/ Squeak support |
3517 #methodsFor "/ Dolphin support |
3517 #methodsFor "/ Dolphin support |
3518 #methods "/ STV support |
3518 #methods "/ STV support |
3519 ) |
3519 ) |
3520 includes:parseTree selector) ifTrue:[ |
3520 includes:parseTree selector) ifTrue:[ |
3521 thisClass := (parseTree receiver evaluate). |
3521 thisClass := (parseTree receiver evaluate). |
3522 (thisClass notNil and:[thisClass isKindOf:UndefinedVariable]) ifTrue:[ |
3522 (thisClass notNil and:[thisClass isKindOf:UndefinedVariable]) ifTrue:[ |
3523 |thisName path| |
3523 |thisName path| |
3524 |
3524 |
3525 thisName := thisClass name. |
3525 thisName := thisClass name. |
3526 path := thisName asCollectionOfSubstringsSeparatedByAll:'::'. |
3526 path := thisName asCollectionOfSubstringsSeparatedByAll:'::'. |
3527 1 to:path size do:[:length | |
3527 1 to:path size do:[:length | |
3528 |ownerName owner| |
3528 |ownerName owner| |
3529 |
3529 |
3530 ownerName := (path copyTo:length) asStringCollection asStringWith:'::'. |
3530 ownerName := (path copyTo:length) asStringCollection asStringWith:'::'. |
3531 owner := Smalltalk classNamed:ownerName. |
3531 owner := Smalltalk classNamed:ownerName. |
3532 (owner notNil and:[owner isBehavior and:[owner isLoaded not]]) ifTrue:[ |
3532 (owner notNil and:[owner isBehavior and:[owner isLoaded not]]) ifTrue:[ |
3533 self checkClassIsLoaded:owner. |
3533 self checkClassIsLoaded:owner. |
3534 ]. |
3534 ]. |
3535 ]. |
3535 ]. |
3536 thisClass := (parseTree receiver evaluate). |
3536 thisClass := (parseTree receiver evaluate). |
3537 ]. |
3537 ]. |
3538 |
3538 |
3539 thisClass isBehavior ifTrue:[ |
3539 thisClass isBehavior ifTrue:[ |
3540 (isLoaded := self checkClassIsLoaded:thisClass) ifFalse:[ |
3540 (isLoaded := self checkClassIsLoaded:thisClass) ifFalse:[ |
3541 outcome := 'Cannot compare this change\\(compare requires class to be loaded).'. |
3541 outcome := 'Cannot compare this change\\(compare requires class to be loaded).'. |
3542 isSame := nil. |
3542 isSame := nil. |
3543 ]. |
3543 ]. |
3544 |
3544 |
3545 parseTree selector == #methodsFor ifTrue:[ |
3545 parseTree selector == #methodsFor ifTrue:[ |
3546 cat := 'Dolphin methods'. |
3546 cat := 'Dolphin methods'. |
3547 ] ifFalse:[ |
3547 ] ifFalse:[ |
3548 parseTree selector == #methods ifTrue:[ |
3548 parseTree selector == #methods ifTrue:[ |
3549 cat := 'STV methods'. |
3549 cat := 'STV methods'. |
3550 ] ifFalse:[ |
3550 ] ifFalse:[ |
3551 cat := parseTree arg1 evaluate. |
3551 cat := parseTree arg1 evaluate. |
3552 ]. |
3552 ]. |
3553 ]. |
3553 ]. |
3554 newSource := aStream nextChunk. |
3554 newSource := aStream nextChunk. |
3555 |
3555 |
3556 Class nameSpaceQuerySignal answer:(self nameSpaceForApply) |
3556 Class nameSpaceQuerySignal answer:(self nameSpaceForApply) |
3557 do:[ |
3557 do:[ |
3558 parser := Parser parseMethod:newSource in:thisClass. |
3558 parser := Parser parseMethod:newSource in:thisClass. |
3559 ]. |
3559 ]. |
3560 (parser notNil and:[parser ~~ #Error]) ifTrue:[ |
3560 (parser notNil and:[parser ~~ #Error]) ifTrue:[ |
3561 sel := parser selector. |
3561 sel := parser selector. |
3562 oldMethod := thisClass compiledMethodAt:sel. |
3562 oldMethod := thisClass compiledMethodAt:sel. |
3563 oldMethod notNil ifTrue:[ |
3563 oldMethod notNil ifTrue:[ |
3564 (oldMethod category = cat) ifFalse:[ |
3564 (oldMethod category = cat) ifFalse:[ |
3565 Transcript showCR:'category changed.'. |
3565 Transcript showCR:'category changed.'. |
3566 ]. |
3566 ]. |
3567 oldSource := oldMethod source. |
3567 oldSource := oldMethod source. |
3568 (oldSource = newSource) ifTrue:[ |
3568 (oldSource = newSource) ifTrue:[ |
3569 outcome := 'Same source'. |
3569 outcome := 'Same source'. |
3570 isSame := true. |
3570 isSame := true. |
3571 ] ifFalse:[ |
3571 ] ifFalse:[ |
3572 oldSource isNil ifTrue:[ |
3572 oldSource isNil ifTrue:[ |
3573 beep := true. |
3573 beep := true. |
3574 outcome := 'No source for compare.'. |
3574 outcome := 'No source for compare.'. |
3575 isSame := true. |
3575 isSame := true. |
3576 ] ifFalse:[ |
3576 ] ifFalse:[ |
3577 "/ |
3577 "/ |
3578 "/ compare for tabulator <-> space changes |
3578 "/ compare for tabulator <-> space changes |
3579 "/ before showing diff ... |
3579 "/ before showing diff ... |
3580 "/ |
3580 "/ |
3581 t1 := oldSource asCollectionOfLines collect:[:s | s withTabsExpanded]. |
3581 t1 := oldSource asCollectionOfLines collect:[:s | s withTabsExpanded]. |
3582 t2 := newSource asCollectionOfLines collect:[:s | s withTabsExpanded]. |
3582 t2 := newSource asCollectionOfLines collect:[:s | s withTabsExpanded]. |
3583 t1 = t2 ifTrue:[ |
3583 t1 = t2 ifTrue:[ |
3584 outcome := 'Same source'. |
3584 outcome := 'Same source'. |
3585 isSame := true. |
3585 isSame := true. |
3586 ] ifFalse:[ |
3586 ] ifFalse:[ |
3587 outcome := 'Source changed.'. |
3587 outcome := 'Source changed.'. |
3588 showDiff := true. |
3588 showDiff := true. |
3589 isSame := false. |
3589 isSame := false. |
3590 |
3590 |
3591 "/ |
3591 "/ |
3592 "/ check if only historyLine diffs |
3592 "/ check if only historyLine diffs |
3593 "/ |
3593 "/ |
3594 (HistoryManager notNil |
3594 (HistoryManager notNil |
3595 and:[HistoryManager isActive]) ifTrue:[ |
3595 and:[HistoryManager isActive]) ifTrue:[ |
3596 (HistoryManager withoutHistoryLines:newSource) |
3596 (HistoryManager withoutHistoryLines:newSource) |
3597 = |
3597 = |
3598 (HistoryManager withoutHistoryLines:oldSource) |
3598 (HistoryManager withoutHistoryLines:oldSource) |
3599 ifTrue:[ |
3599 ifTrue:[ |
3600 outcome := 'Same source (history only)'. |
3600 outcome := 'Same source (history only)'. |
3601 isSame := true. |
3601 isSame := true. |
3602 showDiff := false. |
3602 showDiff := false. |
3603 ] |
3603 ] |
3604 ]. |
3604 ]. |
3605 ] |
3605 ] |
3606 ] |
3606 ] |
3607 ] |
3607 ] |
3608 ] ifFalse:[ |
3608 ] ifFalse:[ |
3609 isLoaded ifTrue:[ |
3609 isLoaded ifTrue:[ |
3610 beep := true. |
3610 beep := true. |
3611 outcome := 'Method does not exist.'. |
3611 outcome := 'Method does not exist.'. |
3612 isSame := nil. |
3612 isSame := nil. |
3613 ] |
3613 ] |
3614 ] |
3614 ] |
3615 ] ifFalse:[ |
3615 ] ifFalse:[ |
3616 outcome := 'Change is unparsable (parse error).'. |
3616 outcome := 'Change is unparsable (parse error).'. |
3617 isSame := nil. |
3617 isSame := nil. |
3618 ]. |
3618 ]. |
3619 doShowResult ifTrue:[ |
3619 doShowResult ifTrue:[ |
3620 (showDiff and:[oldSource notNil and:[newSource notNil]]) ifTrue:[ |
3620 (showDiff and:[oldSource notNil and:[newSource notNil]]) ifTrue:[ |
3621 d := DiffTextView |
3621 d := DiffTextView |
3622 openOn:oldSource label:(resources string:'current version (in image)') |
3622 openOn:oldSource label:(resources string:'current version (in image)') |
3623 and:newSource label:(resources string:'change version'). |
3623 and:newSource label:(resources string:'change version'). |
3624 d label:'method differences'. |
3624 d label:'method differences'. |
3625 ] |
3625 ] |
3626 ] |
3626 ] |
3627 ] ifFalse:[ |
3627 ] ifFalse:[ |
3628 beep := true. |
3628 beep := true. |
3629 outcome := 'Class does not exist.'. |
3629 outcome := 'Class does not exist.'. |
3630 isSame := nil. |
3630 isSame := nil. |
3631 ] |
3631 ] |
3632 ] ifFalse:[ |
3632 ] ifFalse:[ |
3633 beep := true. |
3633 beep := true. |
3634 outcome := 'Not comparable.'. |
3634 outcome := 'Not comparable.'. |
3635 isSame := nil. |
3635 isSame := nil. |
3636 ] |
3636 ] |
3637 ] ifFalse:[ |
3637 ] ifFalse:[ |
3638 beep := true. |
3638 beep := true. |
3639 outcome := 'Not comparable.'. |
3639 outcome := 'Not comparable.'. |
3640 isSame := nil. |
3640 isSame := nil. |
3641 ] |
3641 ] |
3642 ]. |
3642 ]. |
3643 aStream close. |
3643 aStream close. |
3644 |
3644 |
3645 doShowResult ifTrue:[ |
3645 doShowResult ifTrue:[ |
3646 showDiff ifFalse:[ |
3646 showDiff ifFalse:[ |
3647 outcome := (resources string:outcome) withCRs. |
3647 outcome := (resources stringWithCRs:outcome). |
3648 beep ifTrue:[ |
3648 beep ifTrue:[ |
3649 self warn:outcome. |
3649 self warn:outcome. |
3650 ] ifFalse:[ |
3650 ] ifFalse:[ |
3651 self information:outcome. |
3651 self information:outcome. |
3652 ] |
3652 ] |
3653 "/ Transcript showCR:outcome. |
3653 "/ Transcript showCR:outcome. |
3654 ]. |
3654 ]. |
3655 ]. |
3655 ]. |
3656 ^ isSame. |
3656 ^ isSame. |
3657 |
3657 |
3658 "Created: / 24.11.1995 / 14:30:46 / cg" |
3658 "Created: / 24.11.1995 / 14:30:46 / cg" |
3659 "Modified: / 13.2.2000 / 15:04:39 / cg" |
3659 "Modified: / 13.2.2000 / 15:04:39 / cg" |