[squeak-dev] Browse all senders within class categories [snippet]

Edgar J. De Cleene edgardec2005 at gmail.com
Sat Sep 4 09:13:06 UTC 2010


Make a button on Browser.
I have a local senders (browse calls only in the class) in some images,
could name this package senders or category senders


On 9/4/10 3:39 AM, "Hannes Hirzel" <hannes.hirzel at gmail.com> wrote:

> This is very helpful as it allows to browse only in the package I am working
> in.
> The question is - where do we put this hint so that we will find it again.
> 
> --Hannes
> 
> On 9/3/10, Ross Boylan <RossBoylan at stanfordalumni.org> wrote:
>> In case this is useful to others, here's some code I've been using to
>> find all senders of message within a given category.
>> It's implemented on SystemDictionary.
>> 
>> browseCallsOn: aLiteral category: aCategory
>> "Show all senders of aLiteral in classes with category prefix aCategory"
>> "Smalltalk browseCallsOn: #fork category: 'OSProcess'."
>> "This omits some refinements as seen in, e.g.,  #allCallsOn:"
>> |myClasses  myMethods|
>> 
>> myClasses := OrderedCollection new.
>> (Utilities classCategoriesStartingWith: aCategory) do: [:cat |
>> myClasses addAll: (SystemOrganization listAtCategoryNamed: cat).
>> ].
>> myClasses := myClasses collect: [:c | self classNamed: c].
>> myClasses addAll: (myClasses collect: [:c | c class "we want class methods
>> as well as instance methods"]).
>> myMethods := OrderedCollection new.
>> myClasses do: [:myClass |
>> ( myClass whichSelectorsReferTo: aLiteral) do: [:sel |
>> myMethods add: (
>> MethodReference new
>> setStandardClass: myClass
>> methodSymbol: sel
>> ).
>> ].
>> ].
>> self browseMessageList: myMethods
>> name: 'senders of ', aLiteral asString, ' in ',  aCategory asString, '
>> package'
>> autoSelect: aLiteral.
>> 
>> 
>> 
>> 
>> I ran this in Cuis 2.6, though I think it should work in other images.
>> Note that Cuis lacks PackageInfo, which Levente Uzonyi used in a
>> 2010-04-12 posting that provides something similar in spirit.
>> 
>> I suspect this is too special purpose to be added to the standard image.
>> If you use it in a workspace or as a method off Utilies, change self to
>> Smalltalk.
>> 
>> Comments welcome.
>> 
>> Ross Boylan





More information about the Squeak-dev mailing list