Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 08:05 Go to next message
Mathieu Baudier is currently offline Mathieu BaudierFriend
Messages: 7
Registered: December 2010
Location: Berlin
Junior Member

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/
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 08:58 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2289
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
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 10:48 Go to previous messageGo to next message
Mathieu Baudier is currently offline Mathieu BaudierFriend
Messages: 7
Registered: December 2010
Location: Berlin
Junior Member

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


Argeo GmbH (Berlin) - http://www.argeo.org/
Re: Eclipse 4 dynamic menu: direct menu item or handler are not executed [message #1791309 is a reply to message #1790162] Thu, 28 June 2018 03:52 Go to previous message
Fabrice Teichteil Koenigsbuch is currently offline Fabrice Teichteil KoenigsbuchFriend
Messages: 8
Registered: September 2017
Junior Member
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: Sat Nov 17 02:58:07 GMT 2018

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

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

Back to the top