Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Popup submenu
Popup submenu [message #512792] Sun, 07 February 2010 18:21 Go to next message
Jan Krakora is currently offline Jan KrakoraFriend
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
Hi,

I've a problem with creating sub-menu in a pop-up menu. I've created a command extension point, which represents a simply button. In the createPartControl() method of my own View I have a code like this:

MenuManager menuManager = new MenuManager();
Menu menu = menuManager.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(menu);
getSite().registerContextMenu(menuManager, viewer);


Now, it shows pop-up menu with the push button defined in command extension point. It's fine. But there comes my problem. I have a ContributionItem object which represents a Menu object with 3 radio buttons. I would like to insert this object in the menu above, and futhermore in it's own submenu like this:

CommandButton
Zoom menu    > radioButton 1
               radioButton 2
               radioButton 3


How can I do it?

Thanks
Re: Popup submenu [message #518392 is a reply to message #512792] Wed, 03 March 2010 23:23 Go to previous message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 418
Registered: July 2009
Senior Member
Hi Stranger,

Use the org.eclipse.ui.menus extension point to add a menu into your context
menu. Then add commands to your menu like you did before but take a look at
the style which can be defined it the menus extension point as well. Set the
style to radio.

id="add.item"
point="org.eclipse.ui.menus">
<menuContribution
locationURI="popup:org.eclipse.ui.popup.any?after=additions ">
<command
commandId="someorg.someid.someCommand"
icon="icons/anything.gif"
id="someorg.someid.BasicCmdItem"
label="Simple Item"
style="radio"
mnemonic="S">
</command>
</menuContribution>
</extension>

--

Best Regards,
Wim Jongman
-- Computers make very fast, very accurate mistakes.
(Eclipse Old Skool Quote Service)
> Hi,
>
> I've a problem with creating sub-menu in a pop-up menu. I've created a
command extension point, which represents a simply button. In the
createPartControl() method of my own View I have a code like this:
>
>
> MenuManager menuManager = new MenuManager();
> Menu menu = menuManager.createContextMenu(viewer.getControl());
> viewer.getControl().setMenu(menu);
> getSite().registerContextMenu(menuManager, viewer);
>
>
> Now, it shows pop-up menu with the push button defined in command extension
point. It's fine. But there comes my problem. I have a ContributionItem
object which represents a Menu object with 3 radio buttons. I would like to
insert this object in the menu above, and futhermore in it's own submenu like
this:
>
>
> CommandButton
> Zoom menu > radioButton 1
> radioButton 2
> radioButton 3
>
>
> How can I do it?
>
> Thanks
Previous Topic:RCP app installed as an OSGI bundle
Next Topic:Property Sheet View
Goto Forum:
  


Current Time: Fri Nov 28 13:52:14 GMT 2014

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

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