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

yes. the command is just that: a classification id for a group of 
semantically related actions. you are dead on that the name, description, 
etc. was added to commands initially (solely, right now, in fact) to 
support the key bindings preference page. as i mentioned, i'd like to see 
these names and descriptions eventually being used other places as well, 
like menus and toolbars for instance. i like the wording that a command 
'identifies a common class of actions'.

as for scott's definition of 'action' (i think influenced by swing), 
scott's 'action name' is equivalent to command ids. we build the 
equivalent of swing's 'input map' by each plugin contributing keybindings 
for command ids via the commands extension point. the equivalent of 
swing's 'action map' is the workbench choosing the proper action for a 
command. (which is basically 'retargeting')

the difference between swing and this mechanism is that we will probably 
put commands on menus and toolbars rather than actions. this will decouple 
menus and toolbars from actions in a way that swing cannot. which makes me 
wonder if the word 'action' is too confusing, considering swing user's 
think of it as the thing put on the menus and toolbars themselves. perhaps 
'handler' might be a less confusing word than 'action'.?

also, back to undo/redo, i would expect that in an undo/redo mechanism, it 
is the particular action itself that would choose to place undo objects on 
an undo stack following execution. only the particular action knows how to 
undo itself. that's why i felt undo/redo was really a side topic to this 
notion of commands, but i agree the terminology is confusing here as well, 
as this 'undo object' that an action would add to an undo stack is often 
known as a 'command'.

as the commands extension point was put in in 2.1, it looks like that is 
the only use of the term that is unchangable right now. 

chris.





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

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




Sorry, I was a little confused and thought some new concept was brewing. 

To clarify, a "command" is not an interface or java type anywhere, just an 
extension point.  In fact, it is nothing but an Action descriptor ID, 
which is later used to identify a common "class" of Actions.  But, since 
the keybindings preference page needs a way to label/categorize/configure 
the keybindings, there are a few more properties for a command extension 
point. 

Perhaps "Action Class" (meaning some group of related actions) is a term 
which would help people understand commands as they are used here. 

Sorry for the mix-up.  It looks like eclipse.core has another meaning for 
Command too ;-) 

-Randy 




"Chris McLaren" <Chris_McLaren@xxxxxxxxxx> 
Sent by: platform-ui-dev-admin@xxxxxxxxxxx 
08/06/2003 02:01 PM 
Please respond to platform-ui-dev 
        
        To:        platform-ui-dev@xxxxxxxxxxx 
        cc:         
        Subject:        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


_______________________________________________
platform-ui-dev mailing list
platform-ui-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-ui-dev





Back to the top