views:

3343

answers:

3

Hi,

What are differences between Actions and Commands in the context of Eclipse RCP? I know that they both contribute to the menu entries, but which one is better? And why?

Of all the online resources I read, I could not get a firm understanding of the differences between both. I have not actually tried to use them, but just wanted to understand them to start with from higher level point of view.

Thanks

+14  A: 
VonC
+4  A: 

Just adding to VonC's excellent answer, commands might be a little overkill if your application is relatively small. They are relatively harder to setup, and they shine the most when you have multiple perspectives, editors and views.

For something simple, I would go with actions.

Mario Ortegón
Agreed (+1). But I have always found Command "cleaner" in a way ;)
VonC
Specially because applications tend to grow.... I started out with actions but now I am using commands, because of the keybindings
Mario Ortegón
I don't think, its a good idea to start with Actions, as Mario Ortegón said, applications tend to grow... And migrating Actions to Commands can be really painful. - But yes, Actions are easier to setup.
Zoltán Ujhelyi
A: 

And remember that Action may be deprecated on later version of Eclipse. I'd suggest you to use Command from the beginning.

nanda
Do you mean I can completely abandone Action in my code?
solotim