Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Action Set vs command Hdler for main menu.
Action Set vs command Hdler for main menu. [message #555257] Thu, 26 August 2010 06:11 Go to next message
ash is currently offline ashFriend
Messages: 142
Registered: July 2010
Senior Member
Hi All,

I want implemt main menu to my application ... i am not clear weather
i can create main menu to my Application with help of
"org.eclipse.ui.menus" or "org.eclipse.ui.actionsets" extension with proper location URL .

which is the best way to implemnt this ?

Thanks
Ashok





Re: Action Set vs command Hdler for main menu. [message #555284 is a reply to message #555257] Thu, 26 August 2010 07:44 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

Hi,

Using menus and commands is far better than using actionSets.

--
Mickael Istria -- BonitaSoft S.A.
http://www.bonitasoft.com/products/downloads.php
Re: Action Set vs command Hdler for main menu. [message #555361 is a reply to message #555257] Thu, 26 August 2010 12:13 Go to previous messageGo to next message
ash is currently offline ashFriend
Messages: 142
Registered: July 2010
Senior Member
Thanks for the reply
Re: Action Set vs command Hdler for main menu. [message #555391 is a reply to message #555284] Thu, 26 August 2010 13:39 Go to previous messageGo to next message
eshvar60  is currently offline eshvar60 Friend
Messages: 51
Registered: March 2010
Member
He Mickael, would you be able to elaborate on the advantages of one over the other? I want to have a clear idea of what the benefits are of commands so I know how to take advantage of them.
Re: Action Set vs command Hdler for main menu. [message #555414 is a reply to message #555391] Thu, 26 August 2010 14:23 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

Sure,

actionSets combine too much things in one extension: a location in a menu, the code to execute and so on.
Using menu, command and handlers allows you to do the same things as an actionSet, with the following advantages:
* Handlers are simple classes that you attach to a document. You can easily re-use them and it is easier to write/compose/create inheritance between them.
* A command is an abstract definition which is a placeholder for several implementations (handlers). When you add an handler to a command, you can specify some conditions to know whether it is relevant or not, such as filtering on the selected item.
You can use it to define keyboard shortcuts, and then you just add to it some handlers. It is easy to configure.
There is an ICommandService to handle commands programmatically when necessary.
* using menus is simply about manipulating the menus and associating commands to entries.

Let's imagine you have an editor, and you want to implement an undo on it. Using command would make your undo work as the same way than the normal "Undo", you automatically get the Ctrl-Z shortcut, and all traditional menu entries will work for your undo. It would not be the case with actionSets.

In our product, we discovered after several month that using actionSets conflicted with some existing commands and caused troubles in menu activation and keyboard shortcuts (for example, Ctrl-Z was cancelling the operation from another editor...), Replacing them with Handlers for existing commands, and some other new commands made everything work well.

I hope I am clear ;) But if I am not clear enough, trust me: commands are the best way to go.

--
Mickael Istria -- BonitaSoft S.A.
http://www.bonitasoft.com/products/downloads.php
Re: Action Set vs command Hdler for main menu. [message #555418 is a reply to message #555414] Thu, 26 August 2010 14:27 Go to previous message
eshvar60  is currently offline eshvar60 Friend
Messages: 51
Registered: March 2010
Member
Hey that was a great answer, thank you very much!! This will definitely make my life easier Smile
Previous Topic:Propertytester always executed
Next Topic:RCP Product with several versions of a bundle
Goto Forum:
  


Current Time: Wed Apr 24 14:36:09 GMT 2024

Powered by FUDForum. Page generated in 0.03008 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top