Eclipse 4 dynamic menu: direct menu item or handler are not executed [message #1790045] |
Mon, 04 June 2018 08:05 |
|
Hello,
I am migrating an Eclipse RAP application to Eclipse 4 and I am facing an issue with the Dynamic Menu Contributions: I can dynamically add Direct Menu Items or Handled Menu Items, but they don't get executed when clicked.
This is basically the issue described here:
https://stackoverflow.com/questions/42627768/eclipse-rap-why-are-my-dynamic-handled-menu-items-able-to-call-canexecute-but
Just like in this post, the @CanExecute methods work (that is, the menu items are properly enabled or disabled), but the @Execute methods never get executed.
I have searched this forum and Bugzilla but did not find this issue mentioned.
Is it a known problem?
Should I book a proper bug report?
Below is some test code, so that you can check whether I am doing something wrong.
Thanks in advance for your advice!
Mathieu
@AboutToShow
public void aboutToShow(List<MMenuElement> items, MApplication app, EModelService modelService) {
System.out.println("aboutToShow: " + items);
// Direct menu item
MDirectMenuItem dynamicItem = modelService.createModelElement(MDirectMenuItem.class);
dynamicItem.setLabel("Dynamic Menu Item (" + new Date() + ")");
// dynamicItem.setContributorURI("platform:/plugin/org.argeo.suite.e4");
dynamicItem.setContributorURI("platform:/plugin/org.argeo.connect.e4");
dynamicItem.setContributionURI(
"bundleclass://org.argeo.connect.e4/org.argeo.documents.e4.parts.TestDirectMenuItem");
dynamicItem.setIconURI("platform:/plugin/org.argeo.theme.argeo2/icons/types/folder.png");
// dynamicItem.setObject(new TestDirectMenuItem());
items.add(dynamicItem);
// Handled menu item
MHandledMenuItem handledItem = modelService.createModelElement(MHandledMenuItem.class);
handledItem.setContributorURI("platform:/plugin/org.argeo.suite.e4");
List<MCommand> cmds = modelService.findElements(app, null, MCommand.class, null);
for (MCommand cmd : cmds) {
if (cmd.getElementId().equals("org.argeo.suite.e4.command.closeAll")) {
handledItem.setCommand(cmd);
break;
}
}
items.add(handledItem);
}
Argeo GmbH (Berlin) - http://www.argeo.org/
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06559 seconds