12444 |
12462 |
12445 setAcceptAndExplainActionsForMethod |
12463 setAcceptAndExplainActionsForMethod |
12446 "tell the codeView what to do on accept and explain" |
12464 "tell the codeView what to do on accept and explain" |
12447 |
12465 |
12448 codeView acceptAction:[:theCode | |
12466 codeView acceptAction:[:theCode | |
12449 |cat cls rslt| |
12467 |cat cls rslt| |
12450 |
12468 |
12451 fullProtocol ifTrue:[ |
12469 fullProtocol ifTrue:[ |
12452 cls := acceptClass |
12470 cls := acceptClass |
12453 ]. |
12471 ]. |
12454 cls isNil ifTrue:[ |
12472 cls isNil ifTrue:[ |
12455 cls := actualClass. |
12473 cls := actualClass. |
12456 cls isNil ifTrue:[ |
12474 cls isNil ifTrue:[ |
12457 self warn:'oops class is gone; reselect and try again'. |
12475 self warn:'oops class is gone; reselect and try again'. |
12458 ^ self |
12476 ^ self |
12459 ]. |
12477 ]. |
12460 ]. |
12478 ]. |
12461 |
12479 |
12462 codeView cursor:Cursor execute. |
12480 codeView cursor:Cursor execute. |
12463 |
12481 |
12464 (cat := currentMethodCategory) = '* all *' ifTrue:[ |
12482 (cat := currentMethodCategory) = '* all *' ifTrue:[ |
12465 "must check from which category this code came from ... |
12483 "must check from which category this code came from ... |
12466 ... thanks to Arno for pointing this out" |
12484 ... thanks to Arno for pointing this out" |
12467 |
12485 |
12468 cat := self askForMethodCategory. |
12486 cat := self askForMethodCategory. |
12469 ]. |
12487 ]. |
12470 (cat notNil and:[cat notEmpty]) ifTrue:[ |
12488 (cat notNil and:[cat notEmpty]) ifTrue:[ |
12471 Object abortSignal catch:[ |
12489 Object abortSignal catch:[ |
12472 lockUpdates := true. |
12490 lockUpdates := true. |
12473 |
12491 |
12474 (Class methodRedefinitionSignal) handle:[:ex | |
12492 (Class methodRedefinitionSignal) handle:[:ex | |
12475 |answer oldVsNew oldPkg newPkg| |
12493 |answer oldVsNew oldPkg newPkg| |
12476 |
12494 |
12477 oldVsNew := ex parameter. |
12495 oldVsNew := ex parameter. |
12478 oldPkg := oldVsNew key package. |
12496 oldPkg := oldVsNew key package. |
12479 newPkg := oldVsNew value package. |
12497 newPkg := oldVsNew value package. |
12480 answer := OptionBox |
12498 answer := OptionBox |
12481 request: |
12499 request: |
12482 ('You are about to change a method from another (system-) package. |
12500 ('You are about to change a method from another (system-) package. |
12483 The methods original packageID was ''%1''. |
12501 The methods original packageID was ''%1''. |
12484 If you proceed, the new method will be marked as belonging |
12502 If you proceed, the new method will be marked as belonging |
12485 to the ''%2'' package (and this warning will not be shown again). |
12503 to the ''%2'' package (and this warning will not be shown again). |
12486 If you proceed with ''keep'', the new method will be installed |
12504 If you proceed with ''keep'', the new method will be installed |
12487 but the old packageID will be preserved. |
12505 but the old packageID will be preserved. |
12488 Otherwise, hit ''cancel'' to leave the code unchanged. |
12506 Otherwise, hit ''cancel'' to leave the code unchanged. |
12489 |
12507 |
12490 PS: you can disable these checks in the launchers settings-compilation dialog.' |
12508 PS: you can disable these checks in the launchers settings-compilation dialog.' |
12491 bindWith:(oldPkg asText allBold) |
12509 bindWith:(oldPkg asText allBold) |
12492 with:(newPkg asText allBold)) |
12510 with:(newPkg asText allBold)) |
12493 |
12511 |
12494 label:'Method redefinition' |
12512 label:'Method redefinition' |
12495 form:(WarningBox iconBitmap) |
12513 form:(WarningBox iconBitmap) |
12496 buttonLabels:#('cancel' 'keep' 'continue') |
12514 buttonLabels:#('cancel' 'keep' 'continue') |
12497 values:#(#cancel #keep #continue) |
12515 values:#(#cancel #keep #continue) |
12498 default:#continue. |
12516 default:#continue. |
12499 |
12517 |
12500 (answer ~~ #cancel) ifTrue:[ |
12518 (answer ~~ #cancel) ifTrue:[ |
12501 ex proceedWith:answer |
12519 ex proceedWith:answer |
12502 ] |
12520 ] |
12503 ] do:[ |
12521 ] do:[ |
12504 |
12522 |
12505 rslt := actualClass compilerClass |
12523 rslt := actualClass compilerClass |
12506 compile:theCode asString |
12524 compile:theCode asString |
12507 forClass:cls |
12525 forClass:cls |
12508 inCategory:cat |
12526 inCategory:cat |
12509 notifying:codeView. |
12527 notifying:codeView. |
12510 |
12528 |
12511 codeView modified:false. |
12529 codeView modified:false. |
12512 codeModified := false. |
12530 codeModified := false. |
12513 currentMethod := actualClass compiledMethodAt:currentSelector. |
12531 currentMethod := actualClass compiledMethodAt:currentSelector. |
12514 methodCategoryListView notNil ifTrue:[ |
12532 methodCategoryListView notNil ifTrue:[ |
12515 (methodCategoryListView list includes:cat) ifFalse:[ |
12533 (methodCategoryListView list includes:cat) ifFalse:[ |
12516 self updateMethodCategoryListWithScroll:false. |
12534 self updateMethodCategoryListWithScroll:false. |
12517 ] |
12535 ] |
12518 ]. |
12536 ]. |
12519 self updateMethodListWithScroll:false keepSelection:(rslt == currentMethod). |
12537 self updateMethodListWithScroll:false keepSelection:(rslt == currentMethod). |
12520 self normalLabel. |
12538 self normalLabel. |
12521 ] |
12539 ] |
12522 ]. |
12540 ]. |
12523 lockUpdates := false. |
12541 lockUpdates := false. |
12524 ]. |
12542 ]. |
12525 codeView cursor:Cursor normal. |
12543 codeView cursor:Cursor normal. |
12526 ]. |
12544 ]. |
12527 |
12545 |
12528 codeView explainAction:[:theCode :theSelection | |
12546 codeView explainAction:[:theCode :theSelection | |
12529 self showExplanation:(Explainer |
12547 self showExplanation:(Explainer |
12530 explain:theSelection |
12548 explain:theSelection |
12531 in:theCode |
12549 in:theCode |
12532 forClass:actualClass) |
12550 forClass:actualClass) |
12533 ]. |
12551 ]. |
|
12552 BRFormatter notNil ifTrue:[ |
|
12553 "/ use the refactoryBrowser for formatting, if present |
|
12554 codeView formatAction:[:theCode | |
|
12555 self methodFormatMethod:theCode. |
|
12556 ]. |
|
12557 ]. |
|
12558 |
12534 "/ future feature ... |
12559 "/ future feature ... |
12535 "/ codeView pointerOverWordAction:[:word :line :col | |
12560 "/ codeView pointerOverWordAction:[:word :line :col | |
12536 "/ word isAlphaNumeric ifTrue:[ |
12561 "/ word isAlphaNumeric ifTrue:[ |
12537 "/ Transcript showCR:(Explainer |
12562 "/ Transcript showCR:(Explainer |
12538 "/ explain:word |
12563 "/ explain:word |
12539 "/ in:codeView contents |
12564 "/ in:codeView contents |
12540 "/ forClass:actualClass) |
12565 "/ forClass:actualClass) |
12541 "/ ] |
12566 "/ ] |
12542 "/ ]. |
12567 "/ ]. |
12543 |
12568 |
12544 "Modified: / 16.7.1998 / 18:26:30 / cg" |
12569 "Modified: / 22.11.1999 / 11:50:43 / cg" |
12545 ! |
12570 ! |
12546 |
12571 |
12547 setDoitActionForClass |
12572 setDoitActionForClass |
12548 "tell the codeView what to do on doIt" |
12573 "tell the codeView what to do on doIt" |
12549 |
12574 |