Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » DynamicMenuContribution items are persistent...
DynamicMenuContribution items are persistent... [message #1104722] Sun, 08 September 2013 17:48 Go to next message
Maarten Bezemer is currently offline Maarten Bezemer
Messages: 105
Registered: February 2012
Senior Member
Hello,

I have a DynamicMenuContribution item defined in the Application.e4xmi to implement a MRU list.
During development it worked nicely.

@AboutToShow
public void aboutToShow(List<MMenuElement> items, EModelService modelService) {
	final String[] mruArray = getMRUArray(preferences);
	if (mruArray == null) {
		return;
	}
	for (String mruItem : mruArray) {
		MDirectMenuItem dynamicItem = modelService
				.createModelElement(MDirectMenuItem.class);
		dynamicItem.setLabel(new File(mruItem).getName());
		dynamicItem.setContributorURI("platform:/plugin/myapp");
		dynamicItem.setContributionURI("bundleclass://myapp/myapp.handlers.OpenHandler");
		dynamicItem.setContainerData(mruItem);
		items.add(dynamicItem);
	}
	if (mruArray.length > 0) {
		items.add(modelService.createModelElement(MMenuSeparator.class));
	}
}


After I removed the clearPersistedState flag, the MRU list became persistent, and each time I restart my application, the old entries are kept and the new ones are added. And the list becomes larger and larger.

When I check the workbench.xmi file (in .metadata/.plugins/org.eclipse.e4.workbench/ ) it indeed shows all MRU menu entries.

I would have thought that the dynamic menu items are not stored between sessions? Or am I wrong? Or am I doing something wrong?

Thanks,
Maarten

[Updated on: Sun, 08 September 2013 17:48]

Report message to a moderator

Re: DynamicMenuContribution items are persistent... [message #1141938 is a reply to message #1104722] Thu, 17 October 2013 05:32 Go to previous message
Wernke zur Borg is currently offline Wernke zur Borg
Messages: 9
Registered: December 2011
Junior Member
This issue had apparently been fixed in 4.3 (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=405471) but seems to have revived from the ashes in 4.4 - I am experiencing the problem with these features in my target platform:

Eclipse e4 Rich Client Platform 1.3.0.v20130918-1640
Eclipse RCP 4.4.0.v20130918-2000

The code mentioned in the bug report (http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=3a4f5ff85b6b22a0cc0840ff539a4d0219f10b0c) is different from this release. Is it possible that the old problem was reintroduced during refactoring?
Previous Topic:TextEditor and other goodies
Next Topic:Trouble installing e4 tools in Eclipse 4.2.2 RCP-RAP
Goto Forum:
  


Current Time: Thu Apr 17 20:46:30 EDT 2014

Powered by FUDForum. Page generated in 0.02131 seconds