Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Popup Menu contribution to a PartDescriptor from Plugin
Popup Menu contribution to a PartDescriptor from Plugin [message #1234641] Wed, 22 January 2014 08:05 Go to next message
Andreas Fagschlunger is currently offline Andreas Fagschlunger
Messages: 12
Registered: June 2011
Junior Member
Hallo!

Just as I thought all works fine, something doesn't. Let me basically describe my e4-App:

I have a Application which contains initially a single Part with a empty table (NatTable). In the Toolbar is a Command to setup the part. The Handler behind the Command first setups the initial Part. But when the first part is already setup, a new Part is created using the EPartService and a defined PartDescriptor (which uses the same class as the initial part).

The Part also has a (empty) Popup Menu defined. The Table of the Part is linked with this Menu over EMenuService#registerContextMenu. The Menu Items itself are provided by a second plugin over a Model Fragment which Element ID is the menu ID and which contains HandledMenuItem's.

Now the problem is, this works for the initial Part. For the Parts which are created over the EPartService using a PartDescriptor, no Popup Menu shows up on right click on the table.

What must be done that my "dynamic" Parts show up the same Popup Menu as my "static" Part? The PartDescriptor has defined a Popup Menu with the same (Menu-)ID.

Hopefully someone can help me.

Thank you!
Re: Popup Menu contribution to a PartDescriptor from Plugin [message #1234958 is a reply to message #1234641] Thu, 23 January 2014 03:11 Go to previous message
Andreas Fagschlunger is currently offline Andreas Fagschlunger
Messages: 12
Registered: June 2011
Junior Member
I have some kind of workaround for my problem. I changed my Handler to search for all MParts matching my Part-ID. I check all Parts for there setup and possible update it. But when I decide I need a new Part, I clone the Part using the cloneElement-Method of the EModelService and activate it with the EPartService.

With this method the popup menu also shows on the newly created Part.

There is still a Problem, removing the second Plugin which contains the HandledItems for the Parts results in an error for the active part and a disabled popup menu for the other parts. I also don't known what will happen if I later add a new Plugin with new HandledItems.

So still it would be nice if anyone can lead me to the right direction.
Previous Topic:Missing org.eclipse.e4.ui.model.workbench.edit
Next Topic:Minimize empty PartStack throwing Exception.
Goto Forum:
  


Current Time: Fri Aug 29 01:45:00 EDT 2014

Powered by FUDForum. Page generated in 0.01985 seconds