e4 dynamic menu contributions not work? [message #1128400] |
Mon, 07 October 2013 16:51 |
Dennis Lee Messages: 32 Registered: September 2013 |
Member |
|
|
I tried to add dynamic menu items following this article:
www.descher.at/descher-vu/2012/12/dynamic-menu-contributions
Hear is my code to add menu:
public class TestMenuHandler {
@AboutToShow
public void aboutToShow(List<MMenuElement> items) {
for(int i=0 ; i< 5; i++) {
MDirectMenuItem menuItem = MMenuFactory.INSTANCE.createDirectMenuItem();
menuItem.setLabel("Test menu " + i);
menuItem.setElementId("test.dynamicmenucontribution"+ i);
menuItem.setContributorURI("platform:/plugin/testApp.menu.test");
menuItem.setContributionURI("bundleclass://testApp/test.TestHandler");
items.add(menuItem);
}
}
}
There is nothing added to the menu. No error message.
I added DynamicMenuContribution to the menu and I tried from SWT e4 application and same code worked.
And this is handler for the menu, but I don't think it is matter at this stage:
public class TestHandler {
@Execute
public void canExecute(MDirectMenuItem menuItem) {
System.out.println(menuItem.getElementId());
}
}
Thanks in advance
[Updated on: Mon, 07 October 2013 17:17] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05817 seconds