2017-04-12 0:28 GMT+02:00 Alexandre Bergel <alexandre.ber...@me.com>:

> 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)

Reply via email to