Yes in calypso and friends. On Tue, Apr 11, 2017 at 7:38 PM, Esteban A. Maringolo <emaringolo@gmail.com> wrote:
Nice work, I like the approach.
Did you inspire your work in how Dolphin and VAST implements menu creation, command execution, and so on? I find your solution similar to how Dolphin implements it, where even each Presenter is even queried about each command by using a command query and routing solution.
Will you use this in the context of Calypso and friends?
Regards!
Esteban A. Maringolo
2017-04-11 11:49 GMT-03:00 Denis Kudriashov <dionisiydk@gmail.com>:
Hi.
I am glad to announce Commander library which implements command pattern based on first class objects. In Commander every application action is implemented as separate class with #execute method and all state required for execution.
Commands are reusable objects and applications provide various ways to access them: shortcuts, context menu, buttons, etc.. This information is attached to command classes as activator objects. Currently there are three types of activators:
- CmdShortcutCommandActivator - CmdContextMenuCommandActivator - CmdDragAndDropCommandActivator
Activators are declared in command class side methods marked with pragma #commandActivator. For example following method will allow RenamePackageCommand to be executed by shortcut in possible system browser:
RenamePackageCommand class>>packageBrowserShortcutActivator
<commandActivator> ^CmdShortcutCommandActivator by: $r meta for: PackageBrowserContext
And for context menu it will be:
RenamePackageCommand class>>packageBrowserMenuActivator <commandActivator> ^CmdContextMenuCommandActivator byRootGroupItemFor: PackageBrowserContext
Activators are always declared with application context where they can be applied (PackageBrowserContext in example). Application should provide such contexts with information about application state. Every widget can bring own context to interact with application as separate tool. For example system browser shows multiple panes which provide package context, class context and method context. And depending on context browser shows different menu and provides different shortcuts.
For more details look at my blog http://dionisiydk.blogspot.fr/2017/04/commander-command- pattern-library.html and read docs here.
Best regards, Denis