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 |
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 <[hidden email]> 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 > > > |
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" <[hidden email]> 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 <[hidden email]> 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 |
In reply to this post by Hannes Hirzel
Hi, just fyi, I added this to the filter menu last year.
1) browse senders of the message 2) in the top pane of message browser, Shift+Yellow button, menu appears 3) select "filter message list..." (type "f" - "i" - "l"). 4) select "methods in package..." (type "p" - "a" - "c" - "k") 5) select the package from which you only want to see senders from - Chris On Sat, Sep 4, 2010 at 1:39 AM, Hannes Hirzel <[hidden email]> 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 <[hidden email]> 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 >> >> >> > > |
Free forum by Nabble | Edit this page |