366 |
368 |
367 allCallsOn:aSelectorString in:aCollectionOfClasses |
369 allCallsOn:aSelectorString in:aCollectionOfClasses |
368 "return a collection of methods which send aSelector. |
370 "return a collection of methods which send aSelector. |
369 Methods from classes in aCollectionOfClasses are searched only." |
371 Methods from classes in aCollectionOfClasses are searched only." |
370 |
372 |
371 |sel searchBlock| |
373 ^ self |
|
374 allCallsOn:aSelectorString |
|
375 in:aCollectionOfClasses |
|
376 ignoreCase:false |
|
377 |
|
378 ! |
|
379 |
|
380 allCallsOn:aSelectorString in:aCollectionOfClasses ignoreCase:ignoreCase |
|
381 "return a collection of methods which send aSelector. |
|
382 Methods from classes in aCollectionOfClasses are searched only." |
|
383 |
|
384 |sel searchBlock lcString| |
372 |
385 |
373 ((aSelectorString ~= '*') |
386 ((aSelectorString ~= '*') |
374 and:[aSelectorString includesMatchCharacters]) ifTrue:[ |
387 and:[(aSelectorString includesMatchCharacters or:[ignoreCase])]) ifTrue:[ |
375 "/ a matchString - need string matching procedure |
388 "/ a matchString - need string matching procedure |
376 |
389 |
377 searchBlock := [:class :method :s | |
390 searchBlock := [:class :method :s | |
378 |src| |
391 |src| |
|
392 |
|
393 ignoreCase ifTrue:[ |
|
394 lcString := aSelectorString asLowercase. |
|
395 ] ifFalse:[ |
|
396 lcString := aSelectorString. |
|
397 ]. |
379 |
398 |
380 method isLazyMethod ifTrue:[ |
399 method isLazyMethod ifTrue:[ |
381 src := method source. |
400 src := method source. |
382 (src notNil and:[src includesMatchString:aSelectorString]) ifTrue:[ |
401 (src notNil and:[src includesMatchString:aSelectorString]) ifTrue:[ |
383 method makeRealMethod. |
402 method makeRealMethod. |
384 (method literalsDetect:[:aLiteral| |
403 (method literalsDetect:[:aLiteral| |
385 (aLiteral isMemberOf:Symbol) |
404 (aLiteral isMemberOf:Symbol) |
386 and:[aSelectorString match:aLiteral] |
405 and:[(ignoreCase and:[lcString match:aLiteral asLowercase]) |
|
406 or:[ignoreCase not and:[lcString match:aLiteral]]] |
387 ] ifNone:nil) notNil |
407 ] ifNone:nil) notNil |
388 ] ifFalse:[ |
408 ] ifFalse:[ |
389 false |
409 false |
390 ] |
410 ] |
391 ] ifFalse:[ |
411 ] ifFalse:[ |
392 (method literalsDetect:[:aLiteral| |
412 (method literalsDetect:[:aLiteral| |
393 (aLiteral isMemberOf:Symbol) |
413 (aLiteral isMemberOf:Symbol) |
394 and:[aSelectorString match:aLiteral] |
414 and:[(ignoreCase and:[lcString match:aLiteral asLowercase]) |
|
415 or:[ignoreCase not and:[lcString match:aLiteral]]] |
395 ] ifNone:nil) notNil |
416 ] ifNone:nil) notNil |
396 ] |
417 ] |
397 ]. |
418 ]. |
398 ] ifFalse:[ |
419 ] ifFalse:[ |
399 (aSelectorString = '*') ifTrue:[ |
420 (aSelectorString = '*') ifTrue:[ |
590 |
613 |
591 "Created: 10.7.1996 / 10:25:49 / cg" |
614 "Created: 10.7.1996 / 10:25:49 / cg" |
592 "Modified: 24.1.1997 / 19:49:34 / cg" |
615 "Modified: 24.1.1997 / 19:49:34 / cg" |
593 ! |
616 ! |
594 |
617 |
595 browseAllCallsOn:aSelectorString in:aCollectionOfClasses title:title |
618 browseAllCallsOn:aSelectorString in:aSetOfClasses ignoreCase:ignoreCase |
|
619 "launch a browser for all senders of aSelector" |
|
620 |
|
621 ^ self |
|
622 browseAllCallsOn:aSelectorString |
|
623 in:aSetOfClasses |
|
624 ignoreCase:ignoreCase |
|
625 title:(self classResources string:'senders of: %1' with:aSelectorString) |
|
626 |
|
627 " |
|
628 SystemBrowser browseAllCallsOn:#+ in:(Number withAllSubclasses) |
|
629 " |
|
630 |
|
631 "Created: 10.7.1996 / 10:25:49 / cg" |
|
632 "Modified: 24.1.1997 / 19:49:34 / cg" |
|
633 ! |
|
634 |
|
635 browseAllCallsOn:aSelectorString in:aCollectionOfClasses ignoreCase:ignoreCase title:title |
596 "launch a browser for all senders of aSelector in aCollectionOfClasses" |
636 "launch a browser for all senders of aSelector in aCollectionOfClasses" |
597 |
637 |
598 |browser| |
638 |browser| |
599 |
639 |
600 browser := self |
640 browser := self |
601 browseMethods:(self allCallsOn:aSelectorString in:aCollectionOfClasses) |
641 browseMethods:(self allCallsOn:aSelectorString in:aCollectionOfClasses ignoreCase:ignoreCase) |
602 title:title. |
642 title:title. |
603 |
643 |
604 browser notNil ifTrue:[ |
644 browser notNil ifTrue:[ |
605 |s| |
645 |s| |
606 |
646 |
1083 ! |
1144 ! |
1084 |
1145 |
1085 browseImplementorsOf:aSelectorString in:aSetOfClasses |
1146 browseImplementorsOf:aSelectorString in:aSetOfClasses |
1086 "launch a browser for all implementors of aSelector" |
1147 "launch a browser for all implementors of aSelector" |
1087 |
1148 |
1088 ^ self browseImplementorsOf:aSelectorString |
1149 ^ self |
1089 in:aSetOfClasses |
1150 browseImplementorsOf:aSelectorString |
1090 title:(self classResources string:'implementors of: %1' with:aSelectorString) |
1151 in:aSetOfClasses |
|
1152 title:(self classResources string:'implementors of: %1' with:aSelectorString) |
1091 |
1153 |
1092 " |
1154 " |
1093 SystemBrowser browseImplementorsOf:#+ in:(Number withAllSubclasses) |
1155 SystemBrowser browseImplementorsOf:#+ in:(Number withAllSubclasses) |
1094 " |
1156 " |
1095 |
1157 |
1096 "Created: 10.7.1996 / 10:20:59 / cg" |
1158 "Created: 10.7.1996 / 10:20:59 / cg" |
1097 "Modified: 10.7.1996 / 10:21:49 / cg" |
1159 "Modified: 10.7.1996 / 10:21:49 / cg" |
1098 ! |
1160 ! |
1099 |
1161 |
1100 browseImplementorsOf:aSelectorString in:aCollectionOfClasses title:title |
1162 browseImplementorsOf:aSelectorString in:aSetOfClasses ignoreCase:ignoreCase |
|
1163 "launch a browser for all implementors of aSelector" |
|
1164 |
|
1165 ^ self |
|
1166 browseImplementorsOf:aSelectorString |
|
1167 in:aSetOfClasses |
|
1168 ignoreCase:ignoreCase |
|
1169 title:(self classResources string:'implementors of: %1' with:aSelectorString) |
|
1170 |
|
1171 " |
|
1172 SystemBrowser browseImplementorsOf:#+ in:(Number withAllSubclasses) |
|
1173 " |
|
1174 |
|
1175 "Created: 10.7.1996 / 10:20:59 / cg" |
|
1176 "Modified: 10.7.1996 / 10:21:49 / cg" |
|
1177 |
|
1178 |
|
1179 ! |
|
1180 |
|
1181 browseImplementorsOf:aSelectorString in:aCollectionOfClasses ignoreCase:ignoreCase title:title |
1101 "launch a browser for all implementors of aSelector in |
1182 "launch a browser for all implementors of aSelector in |
1102 the classes contained in aCollectionOfClasses and its metaclasses" |
1183 the classes contained in aCollectionOfClasses and its metaclasses" |
1103 |
1184 |
1104 |list sel srchST srchJava| |
1185 |list sel srchST srchJava lcSelector| |
1105 |
1186 |
1106 list := IdentitySet new. |
1187 list := IdentitySet new. |
1107 |
1188 |
1108 ((aSelectorString ~= '*') and:[aSelectorString includesMatchCharacters]) ifTrue:[ |
1189 ((aSelectorString ~= '*') and:[aSelectorString includesMatchCharacters]) ifTrue:[ |
1109 "a matchString" |
1190 "a matchString" |
1110 |
1191 |
1111 srchST := [:aSelector :aMethod | |
1192 ignoreCase == true ifTrue:[ |
1112 (aSelectorString match:aSelector) ifTrue:[ |
1193 lcSelector := aSelectorString asLowercase. |
1113 list add:aMethod |
1194 |
1114 ] |
1195 srchST := [:aSelector :aMethod | |
1115 ]. |
1196 (lcSelector match:aSelector asLowercase) ifTrue:[ |
1116 srchJava := [:aSelector :aMethod | |
1197 list add:aMethod |
1117 (aMethod name match:aSelector) ifTrue:[ |
1198 ] |
1118 list add:aMethod |
1199 ]. |
1119 ] |
1200 srchJava := [:aSelector :aMethod | |
1120 ]. |
1201 (aSelector match:aMethod name asLowercase) ifTrue:[ |
1121 |
1202 list add:aMethod |
1122 aCollectionOfClasses do:[:aClass | |
1203 ] |
1123 |srchBlock| |
1204 ]. |
1124 |
1205 ] ifFalse:[ |
1125 aClass isObsolete ifFalse:[ |
1206 srchST := [:aSelector :aMethod | |
1126 aClass isJavaClass ifTrue:[ |
1207 (aSelectorString match:aSelector) ifTrue:[ |
1127 srchBlock := srchJava |
1208 list add:aMethod |
1128 ] ifFalse:[ |
1209 ] |
1129 srchBlock := srchST |
1210 ]. |
1130 ]. |
1211 srchJava := [:aSelector :aMethod | |
1131 aClass methodDictionary keysAndValuesDo:srchBlock. |
1212 (aSelectorString match:aMethod name) ifTrue:[ |
1132 aClass isMeta ifFalse:[ |
1213 list add:aMethod |
1133 aClass class methodDictionary keysAndValuesDo:srchBlock |
1214 ] |
1134 ] |
1215 ]. |
1135 ] |
1216 ]. |
1136 ] |
|
1137 ] ifFalse:[ |
1217 ] ifFalse:[ |
1138 "can do a faster search" |
1218 "can do a faster search" |
1139 |
1219 |
1140 sel := aSelectorString asSymbolIfInterned. |
1220 sel := aSelectorString asSymbolIfInterned. |
1141 sel isNil ifTrue:[ |
1221 sel isNil ifTrue:[ |
1142 self showNoneFound:title. |
1222 self showNoneFound:title. |
1143 ^ nil |
1223 ^ nil |
1144 ]. |
1224 ]. |
1145 |
1225 |
1146 srchJava := [:aSelector :aMethod | |
1226 ignoreCase == true ifTrue:[ |
1147 "/ allow search for signature AND |
1227 lcSelector := sel asLowercase. |
1148 "/ search for plain name |
1228 srchJava := [:aSelector :aMethod | |
1149 ((aMethod name = sel) |
1229 "/ allow search for signature AND |
1150 or:[aSelector == sel]) ifTrue:[ |
1230 "/ search for plain name |
1151 list add:aMethod |
1231 ((aMethod name asLowercase = lcSelector) |
1152 ] |
1232 or:[aSelector asLowercase = lcSelector]) ifTrue:[ |
1153 ]. |
1233 list add:aMethod |
1154 |
1234 ] |
1155 aCollectionOfClasses do:[:aClass | |
1235 ]. |
1156 |mthd| |
1236 srchST := [:aSelector :aMethod | |
1157 |
1237 (aSelector asLowercase = lcSelector) ifTrue:[ |
1158 aClass isObsolete ifFalse:[ |
1238 list add:aMethod |
1159 aClass isJavaClass ifTrue:[ |
1239 ] |
1160 aClass methodDictionary keysAndValuesDo:srchJava. |
1240 ]. |
1161 aClass isMeta ifFalse:[ |
1241 ] ifFalse:[ |
1162 aClass class methodDictionary keysAndValuesDo:srchJava |
1242 srchJava := [:aSelector :aMethod | |
1163 ] |
1243 "/ allow search for signature AND |
1164 ] ifFalse:[ |
1244 "/ search for plain name |
1165 mthd := aClass compiledMethodAt:sel ifAbsent:nil. |
1245 ((aMethod name = sel) |
1166 mthd notNil ifTrue:[ |
1246 or:[aSelector == sel]) ifTrue:[ |
1167 list add:mthd |
1247 list add:aMethod |
1168 ]. |
1248 ] |
1169 aClass isMeta ifFalse:[ |
1249 ]. |
1170 mthd := aClass class compiledMethodAt:sel ifAbsent:nil. |
1250 srchST := [:aSelector :aMethod | |
1171 mthd notNil ifTrue:[ |
1251 (aSelector == sel) ifTrue:[ |
1172 list add:mthd |
1252 list add:aMethod |
1173 ] |
1253 ] |
1174 ] |
1254 ]. |
1175 ] |
1255 ]. |
|
1256 ]. |
|
1257 |
|
1258 aCollectionOfClasses do:[:aClass | |
|
1259 |srchBlock| |
|
1260 |
|
1261 aClass isObsolete ifFalse:[ |
|
1262 aClass isJavaClass ifTrue:[ |
|
1263 srchBlock := srchJava |
|
1264 ] ifFalse:[ |
|
1265 srchBlock := srchST |
|
1266 ]. |
|
1267 aClass methodDictionary keysAndValuesDo:srchBlock. |
|
1268 aClass isMeta ifFalse:[ |
|
1269 aClass class methodDictionary keysAndValuesDo:srchBlock |
1176 ] |
1270 ] |
1177 ] |
1271 ] |
1178 ]. |
1272 ]. |
|
1273 |
1179 ^ self browseMethods:list asOrderedCollection title:title |
1274 ^ self browseMethods:list asOrderedCollection title:title |
1180 |
1275 |
1181 " |
1276 " |
1182 SystemBrowser browseImplementorsOf:#+ |
1277 SystemBrowser browseImplementorsOf:#+ |
1183 in:(Array with:Number |
1278 in:(Array with:Number |
1189 "Modified: / 4.9.1995 / 17:33:39 / claus" |
1284 "Modified: / 4.9.1995 / 17:33:39 / claus" |
1190 "Modified: / 19.6.1996 / 14:19:02 / stefan" |
1285 "Modified: / 19.6.1996 / 14:19:02 / stefan" |
1191 "Modified: / 16.10.1998 / 13:16:29 / cg" |
1286 "Modified: / 16.10.1998 / 13:16:29 / cg" |
1192 ! |
1287 ! |
1193 |
1288 |
|
1289 browseImplementorsOf:aSelectorString in:aCollectionOfClasses title:title |
|
1290 "launch a browser for all implementors of aSelector in |
|
1291 the classes contained in aCollectionOfClasses and its metaclasses" |
|
1292 |
|
1293 ^ self |
|
1294 browseImplementorsOf:aSelectorString |
|
1295 in:aCollectionOfClasses |
|
1296 ignoreCase:false |
|
1297 title:title |
|
1298 |
|
1299 ! |
|
1300 |
1194 browseImplementorsOf:aSelectorString under:aClass |
1301 browseImplementorsOf:aSelectorString under:aClass |
1195 "launch a browser for all implementors of aSelector in aClass |
1302 "launch a browser for all implementors of aSelector in aClass |
1196 and its subclasses" |
1303 and its subclasses" |
1197 |
1304 |
1198 ^ self browseImplementorsOf:aSelectorString |
1305 ^ self |
1199 in:(aClass withAllSubclasses) |
1306 browseImplementorsOf:aSelectorString |
1200 title:(self classResources string:'implementors of: %1 (in and below %2)' |
1307 in:(aClass withAllSubclasses) |
1201 with:aSelectorString |
1308 title:(self classResources |
1202 with:aClass name) |
1309 string:'implementors of: %1 (in and below %2)' |
|
1310 with:aSelectorString |
|
1311 with:aClass name) |
1203 |
1312 |
1204 " |
1313 " |
1205 SystemBrowser browseImplementorsOf:#+ under:Integer |
1314 SystemBrowser browseImplementorsOf:#+ under:Integer |
1206 " |
1315 " |
1207 |
1316 |