Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsContributing adapter factories via extensions.
https://www.eclipse.org/forums/index.php/mv/msg/365683/890895/#msg_890895
I'm extending a model using extension points as from Ed's article on BlogSpot:
"creating-children-you-didnt-know"
It works and my extension plugins can contribute new objects to the model.
The problem I'm having is with their label providers.
They don't seem to have any effect and the label contributions falls back on the ReflectiveItemProviderAdapterFactory.
After some debugging I think the problem might be with this extension point:
org.eclipse.emf.edit.itemProviderAdapterFactories
This is where my plugins contribute their item provider adapter factory.
And this is where the code it's supposed to use them:
ComposedAdapterFactory.getFactoryForTypes(Collection<?>) line: 241
- if (adapterFactoryDescriptorRegistry != null) ...
when it looks for a factory for my contributed types it doesn't find it in the main plugins ComposedAdapterFactory (which is OKs) but then it should go and look in the adapter factory descriptor registry where my plugins have (should have) registered their item provider adapter factory.
Instead the adapterFactoryDescriptorRegistry is always null.
Would anyone have a suggestion?
I'd like to debug the extension point but I can't think of a good way to do it.
I've put a break point on EMFEditPlugin at ComposedAdapterFactory.Descriptor.Registry getComposedAdapterFactoryDescriptorRegistry() but this is never called.
Note: it's only called by another EMF plugin which has an EMF editor. Specifically when creating the ComposedAdapterFactory:
adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
but this has nothing to do with this problem.
Thanks for any help.
Frank]]>Frank Goldwin2012-06-23T11:04:59-00:00Re: Contributing adapter factories via extensions.
https://www.eclipse.org/forums/index.php/mv/msg/365683/891184/#msg_891184
Did you create your composed adapter factory with the registry as that
other editor does? It doesn't sound like you have and that's definitely
necessary.
On 23/06/2012 1:05 PM, Frank Goldwin wrote:
> Hi,
>
> I'm extending a model using extension points as from Ed's article on
> BlogSpot:
> "creating-children-you-didnt-know"
>
> It works and my extension plugins can contribute new objects to the
> model.
> The problem I'm having is with their label providers.
> They don't seem to have any effect and the label contributions falls
> back on the ReflectiveItemProviderAdapterFactory.
>
> After some debugging I think the problem might be with this extension
> point:
> org.eclipse.emf.edit.itemProviderAdapterFactories
>
> This is where my plugins contribute their item provider adapter factory.
> And this is where the code it's supposed to use them:
> ComposedAdapterFactory.getFactoryForTypes(Collection<?>) line: 241
> - if (adapterFactoryDescriptorRegistry != null) ...
>
> when it looks for a factory for my contributed types it doesn't find
> it in the main plugins ComposedAdapterFactory (which is OKs) but then
> it should go and look in the adapter factory descriptor registry where
> my plugins have (should have) registered their item provider adapter
> factory.
>
> Instead the adapterFactoryDescriptorRegistry is always null.
>
> Would anyone have a suggestion?
> I'd like to debug the extension point but I can't think of a good way
> to do it.
> I've put a break point on EMFEditPlugin at
> ComposedAdapterFactory.Descriptor.Registry
> getComposedAdapterFactoryDescriptorRegistry() but this is never called.
>
> Note: it's only called by another EMF plugin which has an EMF editor.
> Specifically when creating the ComposedAdapterFactory:
> adapterFactory = new
> ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
>
> but this has nothing to do with this problem.
>
> Thanks for any help.
>
> Frank]]>Ed Merks2012-06-24T08:03:32-00:00Re: Contributing adapter factories via extensions.
https://www.eclipse.org/forums/index.php/mv/msg/365683/891483/#msg_891483
I'm putting here what I had and how I've fixed it for others to see.
Thank you!
Before:
// Create an adapter factory that yields item providers.
List factories = new ArrayList();
factories.add(new ResourceItemProviderAdapterFactory());
factories.add(new PlatformItemProviderAdapterFactory());
factories.add(new ReflectiveItemProviderAdapterFactory());
adapterFactory = new ComposedAdapterFactory(factories);
After:
// Create an adapter factory that yields item providers.
adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
// List factories = new ArrayList();
adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new PlatformItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());]]>Frank Goldwin2012-06-25T04:52:04-00:00