DynamicMenuContribution items are persistent... [message #1104722] |
Sun, 08 September 2013 21:48 |
Maarten Bezemer Messages: 117 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 21:48] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03065 seconds