7199 |
7219 |
7200 self checkMethodSelected ifFalse:[^ self]. |
7220 self checkMethodSelected ifFalse:[^ self]. |
7201 |
7221 |
7202 w := currentMethod who. |
7222 w := currentMethod who. |
7203 w notNil ifTrue:[ |
7223 w notNil ifTrue:[ |
7204 cls := w methodClass. |
7224 cls := w methodClass. |
7205 cls notNil ifTrue:[ |
7225 cls notNil ifTrue:[ |
7206 cls ~~ actualClass ifTrue:[ |
7226 cls ~~ actualClass ifTrue:[ |
7207 ^ self warn:'oops - obsolete class; please reselect class ...' |
7227 ^ self warn:'oops - obsolete class; please reselect class ...' |
7208 ]. |
7228 ]. |
7209 cls isMeta ifTrue:[ |
7229 cls isMeta ifTrue:[ |
7210 cls := cls soleInstance |
7230 cls := cls soleInstance |
7211 ] ifFalse:[ |
7231 ] ifFalse:[ |
7212 cls := nil |
7232 cls := nil |
7213 ]. |
7233 ]. |
7214 cls notNil ifTrue:[ |
7234 cls notNil ifTrue:[ |
7215 sel := w methodSelector. |
7235 sel := w methodSelector. |
7216 sel notNil ifTrue:[ |
7236 sel notNil ifTrue:[ |
7217 actualClass perform:sel. |
7237 currentClass perform:sel. |
7218 ^ self |
7238 ^ self |
7219 ] |
7239 ] |
7220 ] |
7240 ] |
7221 ]. |
7241 ]. |
7222 ]. |
7242 ]. |
7223 self warn:'cannot invoke method (no class)' |
7243 self warn:'cannot invoke method (no class)' |
7224 |
7244 |
7225 "Modified: 29.4.1997 / 11:24:30 / dq" |
7245 "Modified: / 29.4.1997 / 11:24:30 / dq" |
|
7246 "Modified: / 29.10.1997 / 15:50:28 / cg" |
7226 ! |
7247 ! |
7227 |
7248 |
7228 methodLocalSuperSends |
7249 methodLocalSuperSends |
7229 "launch a browser showing super sends in current class & subclasses" |
7250 "launch a browser showing super sends in current class & subclasses" |
7230 |
7251 |
8882 |
8909 |
8883 |
8910 |
8884 (currentNamespace notNil |
8911 (currentNamespace notNil |
8885 and:[currentNamespace ~~ Smalltalk |
8912 and:[currentNamespace ~~ Smalltalk |
8886 and:[currentNamespace ~= '* all *']]) ifTrue:[ |
8913 and:[currentNamespace ~= '* all *']]) ifTrue:[ |
8887 "/ is it all empty ? |
8914 "/ is it all empty ? |
8888 currentNamespace allClasses isEmpty ifTrue:[ |
8915 currentNamespace allClasses isEmpty ifTrue:[ |
8889 labels := labels , #('-' 'remove'). |
8916 labels := labels , #('-' 'remove'). |
8890 selectors := selectors , #(nil nameSpaceRemove). |
8917 selectors := selectors , #(nil nameSpaceRemove). |
8891 ] |
8918 ] |
8892 ]. |
8919 ]. |
8893 |
8920 |
8894 ^ PopUpMenu |
8921 ^ PopUpMenu |
8895 labels:(resources array:labels) |
8922 labels:(resources array:labels) |
8896 selectors:selectors |
8923 selectors:selectors |
8897 receiver:self. |
8924 receiver:self. |
8898 |
8925 |
8899 "Created: 4.1.1997 / 23:51:38 / cg" |
8926 "Created: / 4.1.1997 / 23:51:38 / cg" |
8900 "Modified: 31.7.1997 / 22:40:33 / cg" |
8927 "Modified: / 29.10.1997 / 03:39:12 / cg" |
8901 ! |
8928 ! |
8902 |
8929 |
8903 nameSpaceNewNameSpace |
8930 nameSpaceNewNameSpace |
8904 "create a namespace-definition prototype in codeview" |
8931 "create a namespace-definition prototype in codeview" |
8905 |
8932 |
9997 |
10024 |
9998 setAcceptAndExplainActionsForMethod |
10025 setAcceptAndExplainActionsForMethod |
9999 "tell the codeView what to do on accept and explain" |
10026 "tell the codeView what to do on accept and explain" |
10000 |
10027 |
10001 codeView acceptAction:[:theCode | |
10028 codeView acceptAction:[:theCode | |
10002 |cat cls rslt| |
10029 |cat cls rslt| |
10003 |
10030 |
10004 fullProtocol ifTrue:[ |
10031 fullProtocol ifTrue:[ |
10005 cls := acceptClass |
10032 cls := acceptClass |
10006 ]. |
10033 ]. |
10007 cls isNil ifTrue:[ |
10034 cls isNil ifTrue:[ |
10008 cls := actualClass |
10035 cls := actualClass. |
10009 ]. |
10036 cls isNil ifTrue:[ |
10010 cls isNil ifTrue:[ |
10037 self warning:'oops class is gone; reselect and try again'. |
10011 self warning:'oops class is gone; reselect and try again'. |
10038 ^ self |
10012 ^ self |
10039 ]. |
10013 ]. |
10040 ]. |
10014 |
10041 |
10015 codeView cursor:Cursor execute. |
10042 codeView cursor:Cursor execute. |
10016 |
10043 |
10017 (cat := currentMethodCategory) = '* all *' ifTrue:[ |
10044 (cat := currentMethodCategory) = '* all *' ifTrue:[ |
10018 "must check from which category this code came from ... |
10045 "must check from which category this code came from ... |
10019 ... thanks to Arno for pointing this out" |
10046 ... thanks to Arno for pointing this out" |
10020 |
10047 |
10021 cat := self askForMethodCategory. |
10048 cat := self askForMethodCategory. |
10022 ]. |
10049 ]. |
10023 (cat notNil and:[cat notEmpty]) ifTrue:[ |
10050 (cat notNil and:[cat notEmpty]) ifTrue:[ |
10024 Object abortSignal catch:[ |
10051 Object abortSignal catch:[ |
10025 lockUpdates := true. |
10052 lockUpdates := true. |
10026 |
10053 |
10027 rslt := actualClass compilerClass |
10054 Class methodRedefinitionSignal handle:[:ex | |
10028 compile:theCode asString |
10055 |answer oldVsNew oldPkg newPkg| |
10029 forClass:cls |
10056 |
10030 inCategory:cat |
10057 oldVsNew := ex parameter. |
10031 notifying:codeView. |
10058 oldPkg := oldVsNew key package. |
10032 |
10059 newPkg := oldVsNew value package. |
10033 codeView modified:false. |
10060 answer := OptionBox |
10034 currentMethod := actualClass compiledMethodAt:currentSelector. |
10061 request: |
10035 self updateMethodListWithScroll:false keepSelection:(rslt == currentMethod). |
10062 ('You are about to change code from another (system-) package. |
10036 self normalLabel. |
10063 The methods original packageID was ''%1''. |
10037 ]. |
10064 If you proceed, the new code will be marked as belonging |
10038 lockUpdates := false. |
10065 to the ''%2'' package (and this warning will not be shown again). |
10039 ]. |
10066 If you proceed with ''keep'', the old packageID will be preserved. |
10040 codeView cursor:Cursor normal. |
10067 Otherwise, hit ''cancel'' to leave the code unchanged. |
|
10068 |
|
10069 PS: you can disable these checks in the launchers settings-compilation dialog.' bindWith:oldPkg with:newPkg) |
|
10070 |
|
10071 label:'Method redefinition' |
|
10072 form:(WarningBox iconBitmap) |
|
10073 buttonLabels:#('cancel' 'keep' 'continue') |
|
10074 values:#(#cancel #keep #continue) |
|
10075 default:#continue. |
|
10076 |
|
10077 (answer ~~ #cancel) ifTrue:[ |
|
10078 ex proceedWith:answer |
|
10079 ] |
|
10080 ] do:[ |
|
10081 |
|
10082 rslt := actualClass compilerClass |
|
10083 compile:theCode asString |
|
10084 forClass:cls |
|
10085 inCategory:cat |
|
10086 notifying:codeView. |
|
10087 |
|
10088 codeView modified:false. |
|
10089 currentMethod := actualClass compiledMethodAt:currentSelector. |
|
10090 self updateMethodListWithScroll:false keepSelection:(rslt == currentMethod). |
|
10091 self normalLabel. |
|
10092 ] |
|
10093 ]. |
|
10094 lockUpdates := false. |
|
10095 ]. |
|
10096 codeView cursor:Cursor normal. |
10041 ]. |
10097 ]. |
10042 |
10098 |
10043 codeView explainAction:[:theCode :theSelection | |
10099 codeView explainAction:[:theCode :theSelection | |
10044 self showExplanation:(Explainer |
10100 self showExplanation:(Explainer |
10045 explain:theSelection |
10101 explain:theSelection |
10046 in:theCode |
10102 in:theCode |
10047 forClass:actualClass) |
10103 forClass:actualClass) |
10048 ]. |
10104 ]. |
10049 |
10105 |
10050 "Modified: 19.6.1997 / 18:57:35 / cg" |
10106 "Modified: / 29.10.1997 / 15:48:35 / cg" |
10051 ! |
10107 ! |
10052 |
10108 |
10053 setDoitActionForClass |
10109 setDoitActionForClass |
10054 "tell the codeView what to do on doIt" |
10110 "tell the codeView what to do on doIt" |
10055 |
10111 |