Path: utzoo!attcan!uunet!husc6!bloom-beacon!mit-eddie!ll-xn!ames!pasteur!ucbvax!decwrl!nsc!voder!apple!susser From: susser@Apple.COM (Joshua Susser) Newsgroups: comp.lang.smalltalk Subject: Re: browsing by partial method name Message-ID: <11359@apple.Apple.Com> Date: 31 May 88 18:34:02 GMT References: <5376@pucc.Princeton.EDU> Reply-To: susser@apple.UUCP (Joshua Susser) Organization: Apple Computer Inc, Cupertino, CA Lines: 45 In article <5376@pucc.Princeton.EDU> FUCHS@pucc.Princeton.EDU writes: >Can someone answer this (novice) question: I would like to open a browser for >all methods whose selector contains a specified string (e.g. 'Sensor'). I >assume that the way to do this is to use browseAllSelections: and to provide >a block that evaluates to true when the selector meets this criteria, but >can someone tell me what this block should be? Thanks for any help. I don't have browseAllSelections: in my image, but I'm working in LV1, so that's not too strange. If that method is anything like the browseAllSelect: method in LV1, it won't help you, as it only has access to the CompiledMethod object, and doesn't know about the selectors. So here's my quick and dirty solution to your problem. You have to add two messages to the system, but that's what Smalltalk's all about. Joshua Susser Object Engineer susser@apple.com {sun,nsc,amdahl,decwrl}!apple!susser ---------- cut here ---------- !SystemDictionary methodsFor: 'retrieving'! allPartialImplementorsOf: aString "Answer a SortedCollection of all the methods that implement a message containing the substring aString." | aCollection match | aCollection _ SortedCollection new. match _ aString asLowercase. Cursor wait showWhile: [self allBehaviorsDo: [:class | class selectors do: [:selector | (selector asLowercase findString: match startingAt: 1) > 0 ifTrue: [aCollection add: class name, ' ', selector]]]]. ^aCollection! ! !SystemDictionary methodsFor: 'browsing'! browseAllPartialImplementorsOf: aString "Create and schedule a message browser on each method that implements a message whose selector contains the argument, aString. For example, Smalltalk browseAllPartialImplementorsOf: 'Float'." ^self browseMessageList: (self allPartialImplementorsOf: aString) name: 'Partial Implementors of ' , aString! !