--- a/SystemBrowser.st Tue Mar 21 12:21:47 2000 +0100
+++ b/SystemBrowser.st Tue Mar 21 12:24:17 2000 +0100
@@ -1188,93 +1188,16 @@
"launch a browser for all implementors of aSelector in
the classes contained in aCollectionOfClasses and its metaclasses"
- |list sel srchST srchJava lcSelector|
-
- list := IdentitySet new.
-
- ((aSelectorString ~= '*') and:[aSelectorString includesMatchCharacters]) ifTrue:[
- "a matchString"
-
- ignoreCase == true ifTrue:[
- lcSelector := aSelectorString asLowercase.
-
- srchST := [:aSelector :aMethod |
- (lcSelector match:aSelector asLowercase) ifTrue:[
- list add:aMethod
- ]
- ].
- srchJava := [:aSelector :aMethod |
- (aSelector match:aMethod name asLowercase) ifTrue:[
- list add:aMethod
- ]
- ].
- ] ifFalse:[
- srchST := [:aSelector :aMethod |
- (aSelectorString match:aSelector) ifTrue:[
- list add:aMethod
- ]
- ].
- srchJava := [:aSelector :aMethod |
- (aSelectorString match:aMethod name) ifTrue:[
- list add:aMethod
- ]
- ].
- ].
- ] ifFalse:[
- "can do a faster search"
-
- sel := aSelectorString asSymbolIfInterned.
- sel isNil ifTrue:[
- self showNoneFound:title.
- ^ nil
- ].
+ |list|
- ignoreCase == true ifTrue:[
- lcSelector := sel asLowercase.
- srchJava := [:aSelector :aMethod |
- "/ allow search for signature AND
- "/ search for plain name
- ((aMethod name asLowercase = lcSelector)
- or:[aSelector asLowercase = lcSelector]) ifTrue:[
- list add:aMethod
- ]
- ].
- srchST := [:aSelector :aMethod |
- (aSelector asLowercase = lcSelector) ifTrue:[
- list add:aMethod
- ]
- ].
- ] ifFalse:[
- srchJava := [:aSelector :aMethod |
- "/ allow search for signature AND
- "/ search for plain name
- ((aMethod name = sel)
- or:[aSelector == sel]) ifTrue:[
- list add:aMethod
- ]
- ].
- srchST := [:aSelector :aMethod |
- (aSelector == sel) ifTrue:[
- list add:aMethod
- ]
- ].
- ].
- ].
+ list := self
+ findImplementorsOf:aSelectorString
+ in:aCollectionOfClasses
+ ignoreCase:ignoreCase.
- aCollectionOfClasses do:[:aClass |
- |srchBlock|
-
- aClass isObsolete ifFalse:[
- aClass isJavaClass ifTrue:[
- srchBlock := srchJava
- ] ifFalse:[
- srchBlock := srchST
- ].
- aClass methodDictionary keysAndValuesDo:srchBlock.
- aClass isMeta ifFalse:[
- aClass class methodDictionary keysAndValuesDo:srchBlock
- ]
- ]
+ list size == 0 ifTrue:[
+ self showNoneFound:title.
+ ^ nil
].
^ self browseMethods:list asOrderedCollection title:title
@@ -1748,6 +1671,127 @@
^ searchBlock
"Modified: 19.6.1997 / 18:27:57 / cg"
+!
+
+findImplementorsOf:aSelectorString in:aCollectionOfClasses ignoreCase:ignoreCase
+ "search for all implementors of aSelector in
+ the classes contained in aCollectionOfClasses and its metaclasses.
+ Return a collection of methods"
+
+ |list sel srchST srchJava lcSelector|
+
+ list := IdentitySet new.
+
+ ((aSelectorString ~= '*') and:[aSelectorString includesMatchCharacters]) ifTrue:[
+ "a matchString"
+
+ ignoreCase == true ifTrue:[
+ lcSelector := aSelectorString asLowercase.
+
+ srchST := [:aSelector :aMethod |
+ (lcSelector match:aSelector asLowercase) ifTrue:[
+ list add:aMethod
+ ]
+ ].
+ srchJava := [:aSelector :aMethod |
+ (aSelector match:aMethod name asLowercase) ifTrue:[
+ list add:aMethod
+ ]
+ ].
+ ] ifFalse:[
+ srchST := [:aSelector :aMethod |
+ (aSelectorString match:aSelector) ifTrue:[
+ list add:aMethod
+ ]
+ ].
+ srchJava := [:aSelector :aMethod |
+ (aSelectorString match:aMethod name) ifTrue:[
+ list add:aMethod
+ ]
+ ].
+ ].
+ ] ifFalse:[
+ "can do a faster search"
+
+ sel := aSelectorString asSymbolIfInterned.
+ sel isNil ifTrue:[
+ ^ nil
+ ].
+
+ ignoreCase == true ifTrue:[
+ lcSelector := sel asLowercase.
+ srchJava := [:aSelector :aMethod |
+ "/ allow search for signature AND
+ "/ search for plain name
+ ((aMethod name asLowercase = lcSelector)
+ or:[aSelector asLowercase = lcSelector]) ifTrue:[
+ list add:aMethod
+ ]
+ ].
+ srchST := [:aSelector :aMethod |
+ (aSelector asLowercase = lcSelector) ifTrue:[
+ list add:aMethod
+ ]
+ ].
+ ] ifFalse:[
+ srchJava := [:aSelector :aMethod |
+ "/ allow search for signature AND
+ "/ search for plain name
+ ((aMethod name = sel)
+ or:[aSelector == sel]) ifTrue:[
+ list add:aMethod
+ ]
+ ].
+ srchST := [:aSelector :aMethod |
+ (aSelector == sel) ifTrue:[
+ list add:aMethod
+ ]
+ ].
+ ].
+ ].
+
+ aCollectionOfClasses do:[:aClass |
+ |srchBlock|
+
+ aClass isObsolete ifFalse:[
+ aClass isJavaClass ifTrue:[
+ srchBlock := srchJava
+ ] ifFalse:[
+ srchBlock := srchST
+ ].
+ aClass methodDictionary keysAndValuesDo:srchBlock.
+ aClass isMeta ifFalse:[
+ aClass class methodDictionary keysAndValuesDo:srchBlock
+ ]
+ ]
+ ].
+
+ ^ list
+
+ "
+ SystemBrowser findImplementorsOf:#+
+ in:(Array with:Number
+ with:Float
+ with:SmallInteger)
+ "
+
+!
+
+findSendersOf:aSelectorString in:aCollectionOfClasses ignoreCase:ignoreCase
+ "search for all senders of aSelector in
+ the classes contained in aCollectionOfClasses and its metaclasses.
+ Return a collection of methods"
+
+ ^ self allCallsOn:aSelectorString in:aCollectionOfClasses ignoreCase:ignoreCase
+
+ "
+ SystemBrowser findSendersOf:#+
+ in:(Array with:Number
+ with:Float
+ with:SmallInteger)
+ ignoreCase:false
+ "
+
! !
!SystemBrowser class methodsFor:'startup'!
@@ -2215,6 +2259,6 @@
!SystemBrowser class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/SystemBrowser.st,v 1.102 2000-02-22 18:40:47 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/SystemBrowser.st,v 1.103 2000-03-21 11:24:17 cg Exp $'
! !
SystemBrowser initialize!