Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Eclipse 4 dynamic menu: direct menu item or handler are not executed
Eclipse 4 dynamic menu: direct menu item or handler are not executed [message #1790045] Mon, 04 June 2018 04:05 Go to next message
Eclipse UserFriend
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);
	}
Re: Eclipse 4 dynamic menu: direct menu item or handler are not executed [message #1790112 is a reply to message #1790045] Tue, 05 June 2018 04:58 Go to previous messageGo to next message
Eclipse UserFriend
Hi Mathieu,
please open a bugzilla and attach there a self-running project to demonstrate the issue.
Regards,
Ivan
Re: Eclipse 4 dynamic menu: direct menu item or handler are not executed [message #1790162 is a reply to message #1790112] Wed, 06 June 2018 06:48 Go to previous messageGo to next message
Eclipse UserFriend
Hello Ivan,

thanks for your quick answer!

Please find the new bug here, with a self-contained project based on the Eclipse RAP e4 template as an attachment:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=535586

Cheers,

Mathieu
Re: Eclipse 4 dynamic menu: direct menu item or handler are not executed [message #1791309 is a reply to message #1790162] Wed, 27 June 2018 23:52 Go to previous message
Eclipse UserFriend
Hi Ivan & Mathieu,

I faced the same issue and after debugging I noticed that the code of MenuManagerHideProcessor class in org.eclipse.e4.ui.workbench.renderers.swt RAP bundle was not synchronised with the latest e4 code.
Bugs have been fixed in e4 since the class has been copied to RAP repository, main changes are in the processDynamicElements() method. I actually posted about this synchronisation issue (not only for this class, but for all e4 classes in general) some time ago and I believe this is still a pending task:

https://www.eclipse.org/forums/index.php?t=msg&th=1079714&goto=1739266&#msg_1739266

Mathieu if that can help you meanwhile, what I did is that I got the org.eclipse.e4.ui.workbench.renderers.swt RAP bundle in my workspace and changed the MenuManagerHideProcessor code by the latest one in e4 git repository. I then reference my workspace bundle instead of the RAP target one in my run configuration and that works for me...

Fabrice
Previous Topic:RAP dependencies hell
Next Topic:File upload issue with RAP 3.5.0 (Photon)
Goto Forum:
  


Current Time: Mon Jul 07 23:48:24 EDT 2025

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

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

Back to the top