MethodBrowser sort?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

MethodBrowser sort?

jWarrior
I am bringing up a new MethodBrowser and I want the
sort to be class then selector rather than selector. How
do I do this?

Thanks.


Reply | Threaded
Open this post in threaded view
|

Re: MethodBrowser sort?

Chris Uppal-3
Clicking on the column header should do it.

    -- chris

"Donald MacQueen" <[hidden email]> wrote in message
news:9p4d8v$3cg$[hidden email]...
> I am bringing up a new MethodBrowser and I want the
> sort to be class then selector rather than selector. How
> do I do this?
>
> Thanks.
>
>


Reply | Threaded
Open this post in threaded view
|

Re: MethodBrowser sort?

Ian Bartholomew-5
In reply to this post by jWarrior
Donald,

> I am bringing up a new MethodBrowser and I want the
> sort to be class then selector rather than selector. How
> do I do this?

I depends on how you are bringing up the MethodBrowser.

If you are using the CHB menus then one way to modify the behaviour
would be to alter the image so that the MethodBrowserShell sorts in the way
you want, but _all_ the time. The easiest way is to add the following to the
end of the MethodBrowserShell>>onViewOpened method

self browser beSorted: [:a :b |
    a methodClass = b methodClass
        ifTrue: [a selector < b selector]
        ifFalse: [a methodClass name < b methodClass name]]

If you are programmatically invoking the MethodBrowser (and therefore have a
reference to it) then the following variation of the above should work on a
per-occasion basis, avoiding the need to modify the base image.

methods := SmalltalkSystem current changedMethods.
browserShell := SmalltalkSystem current browseMethods: methods.
browserShell browser beSorted: [:a :b |
    a methodClass = b methodClass
        ifTrue: [a selector < b selector]
        ifFalse: [a methodClass name < b methodClass name]]

In both cases you are just setting the initial sort order of the list so if
you resort using the column headers then you lose this sort order. If that
is not acceptable then you will probably have to resort to changing the
sortblock for the MethodBrowser's classes ListViewColumn (using the
ViewComposer) and manually resorting after the browser is opened by clicking
on the header. At the moment this just sorts on the class' name so changing
the #sortBlock aspect (plus a couple of other tweaks) to the above will give
the class/selector sort sequence required.

Ian


Reply | Threaded
Open this post in threaded view
|

Re: MethodBrowser sort?

jWarrior
"Ian Bartholomew" <[hidden email]> wrote in message
news:9p4kgl$g4194$[hidden email]...
> Donald,
>
> > I am bringing up a new MethodBrowser and I want the
> > sort to be class then selector rather than selector. How
> > do I do this?
> If you are programmatically invoking the MethodBrowser (and therefore have
a
> reference to it) then the following variation of the above should work on
a
> per-occasion basis, avoiding the need to modify the base image.
>
> methods := SmalltalkSystem current changedMethods.
> browserShell := SmalltalkSystem current browseMethods: methods.
> browserShell browser beSorted: [:a :b |
>     a methodClass = b methodClass
>         ifTrue: [a selector < b selector]
>         ifFalse: [a methodClass name < b methodClass name]]

that's what i wanted. i overlooked the browser method; that's what happens
when you do One Last Thing Late at Night.

Thanks, Ian.

>
> In both cases you are just setting the initial sort order of the list so
if
> you resort using the column headers then you lose this sort order. If that
> is not acceptable then you will probably have to resort to changing the
> sortblock for the MethodBrowser's classes ListViewColumn (using the
> ViewComposer) and manually resorting after the browser is opened by
clicking
> on the header. At the moment this just sorts on the class' name so
changing
> the #sortBlock aspect (plus a couple of other tweaks) to the above will
give

> the class/selector sort sequence required.
>
> Ian
>
>
>
>
>
>
>
>