I want to achieve the same goal. I want to add a new group in the any
popup menu (popup menu activated on a package explorer/project explorer
resource). In that group, one command is to choose a compilation target,
basically you choose an element from a sub menu. From an existing Eclipse
Plug In, the CDT popup menu
Build Configurations -> Set Active -> 1 Target Choice #1
-> 2 Target Choice #2
-> N Target Choice #N
is exactly what I would like to reproduce.
I'm using the org.eclipse.ui.menus extension. Here's my plugin.xml for
this extension:
How can I had my menu so it appears at the very end of the any popup menu?
My locationURI is:
locationURI="popup:org.eclipse.ui.popup.any?after=group.properties".
For the moment, my menu shows just before the properties menu but I want
to show it as the last element of the any popup menu. I tried with
?after=additions or ?after=group.additions but it didn't worked.
How can I had a dynamic sub menu?
For the moment my class under the dynamic element (aDynamicSubMenuClass
extending CompoundContributionItem) works well. I extended the
IContributionItem[] getContributionItems() method and I'm able to generate
the sub menu under the "aLabel" menu. Here's a simplified version of the
getContributionItems() method:
IContributionItem[] array = new IContributionItem[aCertainLength];
for (int i=0; i<aCertainLength; i++)
{
array[i] = new CommandContributionItem(
PlatformUI.getWorkbench(),
aName,
"org.eclipse.ui.help.aboutAction",
null,
null,
null,
null,
aName,
null,
null,
CommandContributionItem.STYLE_RADIO
);
}
return array
What's not working properly is that the subMenu items aren't shown as
radio button but simply as push button. Also, I don't know what commandId
to insert in my subMenu item (CommandContributionItem) as no command is
intended to be called when a CommandContributionItem is selected. I
temporarly put the existing org.eclipse.ui.help.aboutAction just to be
able to show my subMenu.
Hope I'd been clear. If not don't hesitate to tell me because I'm not the
only one that would benefit from a constructive answer.