I see. But why not to let the class subscribe to what it needs?
Maybe something like:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Command subclass: #ClyShowClassRefCommand
ClyShowClassRefCommand class>>registerFor: aCommandActivator
aCommandActivator add: self for: ClyButtonToolbarGroup.
aCommandActivator add: self for: ClyBrowserContext.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
This is just a suggestion.
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
> On Apr 12, 2017, at 6:54 AM, Denis Kudriashov <[email protected]> wrote:
>
>
> 2017-04-12 0:28 GMT+02:00 Alexandre Bergel <[email protected]
> <mailto:[email protected]>>:
> I would imagine that your activatorClass can lookup the command simply as:
>
> PackageCommand allSubclasses select: [ :c | c isEnabledFor: … ]
>
> This approach restricts command implementation and queries to single
> hierarchy which is not scale.
> For example in Calypso there is ShowClassRefsCommand which is shown as
> toolbar button in both system and method browsers. But this command is in
> ClassCommand hierarchy because it operates on collection of classes.
> We can lookup both MethodCommands and ClassCommands in method browser. But
> then we will have a lot of commands which we do not need in method browser.
>
> Another example is "browse" command which is accessed by cmd+b and from
> context menu of any browser pane.
>
> Here is how they all connected to Calypso browsers:
>
> ClyShowClassRefCommand class>>systemBrowserToolbarActivator
> <commandActivator>
> ^ClyToolbarCommandActivator byItemOf: ClyButtonToolbarGroup for:
> ClyClassSystemBrowserContext
>
> ClyShowClassRefCommand class>methodBrowserToolbarActivator
> <commandActivator>
> ^ClyToolbarCommandActivator byItemOf: ClyButtonToolbarGroup for:
> ClyMethodBrowserContext
>
> ClySpawnSystemBrowserCommand class>>browserShortcutActivator
> <commandActivator>
> ^CmdShortcutCommandActivator by: $b meta for: ClyBrowserContext
>
> ClySpawnSystemBrowserCommand class>>browserMenuActivator
> <commandActivator>
> ^CmdContextMenuCommandActivator byRootGroupItemFor: ClyBrowserContext
>
> (ClyBrowserContext is superclass of any Calypso browser contexts)