Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Menu Contribution appears multiple times on restart
icon14.gif  Menu Contribution appears multiple times on restart [message #892450] Thu, 28 June 2012 05:16 Go to next message
Marc Leiendecker is currently offline Marc Leiendecker
Messages: 3
Registered: May 2012
Junior Member
Hello,

I have written a plugin that adds a menu item to my main plugin (via model contribution, model fragment)

When i start the application for the first time (new workspace), the new menu item is inserted correctly, but when i start the application again, the menu item gets insterted again. With each start the Item gets inserted one more time.

When i look at the "workbench.xmi", I see that with each start the menu item is inserted once more.

To reproduce my problem I attached a file containing 2 plugins and the feature containing both. When you run the product more than once without cleaning the workspace, the menu Item ist inserted multiple times.

Any help would be greatly appreciated.
Thanks
Marc

[Updated on: Thu, 28 June 2012 06:39]

Report message to a moderator

Re: Menu Contribution appears multiple times on restart [message #892451 is a reply to message #892450] Thu, 28 June 2012 05:26 Go to previous messageGo to next message
Sopot Cela is currently offline Sopot Cela
Messages: 596
Registered: December 2010
Senior Member

This may be relevant: http://www.eclipse.org/forums/index.php/t/358388/
Re: Menu Contribution appears multiple times on restart [message #892455 is a reply to message #892451] Thu, 28 June 2012 05:52 Go to previous messageGo to next message
Marc Leiendecker is currently offline Marc Leiendecker
Messages: 3
Registered: May 2012
Junior Member
Thanks for the info.
But in my case I contribute the model elements (in this case the menu item) via a static model fragment and the extension point org.eclipse.e4.worbench.model without any java code (so far)
Shouldnt the framework realize, that the model fragment is already present in the saved application model and not add it again.
Otherwise where would be the benefit of contributing to the application model via a model fragment, when i have to delete the contributed elements manually when the application exits.

Perhaps i am missing something really obvious (like some "contribute only once" setting)
Re: Menu Contribution appears multiple times on restart [message #892456 is a reply to message #892455] Thu, 28 June 2012 05:55 Go to previous messageGo to next message
Lars Vogel is currently offline Lars Vogel
Messages: 1048
Registered: July 2009
Senior Member

Are you using IDs for all your model elements? See https://bugs.eclipse.org/379216
Re: Menu Contribution appears multiple times on restart [message #892469 is a reply to message #892456] Thu, 28 June 2012 06:38 Go to previous message
Marc Leiendecker is currently offline Marc Leiendecker
Messages: 3
Registered: May 2012
Junior Member
Thank you, It works!

When i assign an ID to my menu item, it is inserted only once.
Previous Topic:e4 Target Platform
Next Topic:Add Binding Context programmatically
Goto Forum:
  


Current Time: Sat Aug 02 04:45:04 EDT 2014

Powered by FUDForum. Page generated in 0.03021 seconds