Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » PartDescriptor in Fragment
PartDescriptor in Fragment [message #1271199] Fri, 14 March 2014 13:36 Go to next message
Don Smyth is currently offline Don Smyth
Messages: 33
Registered: April 2013
Does anyone know if it is possible to use a PartDescriptor for an MPart in a ModelFragment?

When I do so and then trace the code in the ModelServiceImpl.class the only PartDescriptors I find there are the ones defined in the main Application - no descriptors from the fragment are found.

There was a post on this in 2012 and a bugzilla The bugzilla tracker defines the bug as fixed in Nov 2013 - with a patch to but I am not using SharedElementsDialog.

Any ideas?


Re: PartDescriptor in Fragment [message #1280168 is a reply to message #1271199] Sat, 29 March 2014 22:50 Go to previous messageGo to next message
Sopot Cela is currently offline Sopot Cela
Messages: 597
Registered: December 2010
Senior Member

So you can not add add it from the application model editor or you add it and the model service doesn't find it?
Re: PartDescriptor in Fragment [message #1281111 is a reply to message #1271199] Mon, 31 March 2014 11:24 Go to previous messageGo to next message
Olivier Prouvost is currently offline Olivier Prouvost
Messages: 7
Registered: August 2011
Location: TOULOUSE
Junior Member

The problem with model fragment is that you need to know the ID of your application. If you add your part descriptor in your application model and then you extract it into a fragment you will see the application ID in the model fragment. If your fragment is dedicated to a specific application it will be ok, and by extracting the fragment it should work.

May be it would be easier to use a Processor to describe it. In this case you don't need to know the application ID. Instead of choosing 'fragment' in the extension, choose 'Processor' and bind a POJO class containing an '@Execute' method that will receive the MApplication, modelService and all stuff needed :

You can then add the part descriptor using a code like this :

public void fillMyModel(MApplication application, EModelService modelService)
MPartDescriptor descriptor = modelService.createModelElement(MPartDescriptor.class);


String bundle = FrameworkUtil.getBundle(myPart.class).getSymbolicName();
descriptor.setContributionURI("bundleclass://" + bundle + "/" + myPart.class.getCanonicalName());
String contributorURI = "platform:/plugin/" + FrameworkUtil.getBundle(myPart.class).getSymbolicName();


Re: PartDescriptor in Fragment [message #1282050 is a reply to message #1281111] Tue, 01 April 2014 20:05 Go to previous messageGo to next message
Eric Moffatt is currently offline Eric Moffatt
Messages: 118
Registered: July 2009
Senior Member
This is most likely awaiting the XPath implementation for fragment processing which would allow you to explicitly define the container without having to resort to using hte id.
Re: PartDescriptor in Fragment [message #1290870 is a reply to message #1282050] Thu, 10 April 2014 14:09 Go to previous message
Don Smyth is currently offline Don Smyth
Messages: 33
Registered: April 2013
Thanks everyone,

I initially got this working by leaving all the model fragments (commands, handlers, menus) in the plugin, then registering PartDescriptors in the main Application.e4xmi that refernce the plugin view bundleclasses - not elegent but works.

After reading your posts, I tried extracting the part descriptor as a fragment -both into the main app and into the plugin. Neither worked.

I then tried creating a processor inside the plug-in. This method appears promising - I managed to get it add items to the menu in the main application, though there now seems to be an issue injecting a Composite into a POJO on @PostConstruct in views in the plugin.



Previous Topic:Remove Import menu item
Next Topic:MultiPageEditor and FormEditor replacements
Goto Forum:

Current Time: Mon Sep 22 00:31:23 GMT 2014

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

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