Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-ui-dev] Difference between Action and Command

The definitions are close. The term 'command', introduced in 2.1 as part 
of the commands extension point, is used to describe a request from a 
user. I define an 'action' as the object which executes a command.

This distinction means:

1. Commands have unique ids, names (used in menu labels, etc), 
descriptions (used in tooltips), help ids.
2. Commands can have keybindings assigned to them.
3. Commands can be bound to particular contexts.
4. Commands can have various images bound to them (for use in menus and 
toolbars)
5. Commands, via the context mechanism, decide whether or not it should be 
visible in the menus or toolbars.
6. Actions do the actual work for a command. Based on the active part, 
perspective, etc, the workbench chooses the best action to which to 
delegate the actual execution of the command.
7. The action that the workbench has chosen decides whether it is enabled 
or not ('can be executed'), and affects the enabled state where commands 
appear on menus and toolbars.
8. The action can optionally override the name, description, or help id to 
provide more specific information than the command itself usually provides 
in those places in the UI which accept these overrides, such as the menus 
and toolbars. e.g. The current action for 'Copy' might override the name 
to 'Copy Image', but should not override it to say 'Cut'. Other parts of 
the UI would always use the proper name of the command. e.g. the names and 
descriptions of the commands as presented in the keybindings UI should not 
use any overridden names or descriptions provided by the current actions, 
if any.

When I say 'command-centric' I'm thinking the following ideas:

1. That perhaps menus and toolbars should be explicitly defined in terms 
of commands. Rather than have the action specify a menu or toolbar path, 
the command should be bound to particular menus and toolbars, and the 
action should only worry about handling command execution when it is 
asked. I am currently exploring a 'menus' extension point to explicity 
define reusable and compositable menus in terms of commands.
2. Keybindings and other means of command execution (i.e. scripting..) 
should only be concerned with the command itself and not the action.

As far any naming confusion with an undo/redo mechanism, I'm not so 
concerned. Perhaps we will see that ideas are one in the same when the 
time comes to add a proper undo/redo stack to eclipse. The primary goal 
right now is to unwind some of the more tangled knots in the current 
action architecture. I am working on a 'Commands' proposal now, as well as 
perhaps as separate proposal for a 'menus' extension point which should 
help here.

Chris






Randy Hudson/Raleigh/IBM@IBMUS
Sent by: platform-ui-dev-admin@xxxxxxxxxxx
08/06/2003 01:21 PM
Please respond to platform-ui-dev

 
        To:     platform-ui-dev@xxxxxxxxxxx
        cc: 
        Subject:        [platform-ui-dev] Difference between Action and Command




In the recently announced "contexts" proposal: 
"As Eclipse moves from an action-centric model to command-centric model, 
action sets would disappear entirely" 

To me "action" and "command" are the same thing.  What is the difference 
here between a command and an action?  Where can I read more on the new 
"command" stuff? 
Won't this be confusing since the term "command" is widely used to mean a 
change which can be undone and redone?  There is also a bugzilla open 
tracking the proposal to add undo/redo to the workbench. 

-Randy




Back to the top