[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] Re: Radio Context Menu in View

Thanks for the quick reply Paul. According to your answers:

Paul Webster wrote:

The menu contributions are applied after any programmatic actions (Properties is added by the Package Explorer) but before any action contributions (like popupMenus). If the Properties action had an ID you could place yourself after it, but I wasn't able to find an ID for that action. There are enhancements to the locationURI to include some other options (append maybe, or after/before) but they won't be available until 3.4.

For the MenuContribution/locationURI field, by analysing every section, the first one is obviously good (popup), the second one (org.eclipse.ui.popup.any) seems to be ID to use to add a contribution for the popup menu shown under the default package explorer/ CDT project explorer view. As you mentionned, the after/before option is already included as part of the locationURI field in 3.3 (the third section or query section). By using the constants' values from the interface org.eclipse.search.ui.IContextMenuConstants, you can add your contribution precisely at the desired location. In my case, popup:org.eclipse.ui.popup.any?after=group.properties is good except for the query section I'm not able to set properly. As mentionned in my initial post, tried the group.additions but didn't worked. Remember that I want to add my menu contribution at the VERY END of the menu.


I copied your example and the menu items are shown as radio buttons ... just none of them are selected.

When I populate the IContributionItem array so the getContributionItems() returns it, to what class do I cast a CommandContributionItem to access the setSelected(boolean) since they are of style STYLE_RADIO.


When you select a menu item, you have to do something ... even if it is just update your model with the currently selected target.

Use the commandId that will execute that action. One "way" of providing the effect you want is to have the command take an optional parameter. Selecting the menu item executes the command with the "target" parameter. In your handler, you would then update whatever model you have to the correct "target" and then you can "refresh" your command UI elements (your handler implements IElementUpdater). You can then update each UI element as to whether or not it is checked.

I don't know yet how to link a "command" Extension with my org.eclipse.ui.menus extension. Also, you mention the notion of handler. I'm lost. Should I add an org.eclipse.ui.commands extension and set the defaultHandler field to a custom built class that implements IHandler and IElementUpdater? How do I link all these extensions together? Do you have a plugin.xml code snippet you could provide?


Thanks in advance,

Guillaume Boivin