Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » EEF ComposedAdapterFactory
EEF ComposedAdapterFactory [message #513141] Tue, 09 February 2010 03:11 Go to next message
Miles Parker is currently offline Miles ParkerFriend
Messages: 1341
Registered: July 2009
Senior Member
It looks like the EEF **PropertiesEditionPartForms are not using the same strategy as the EMF generated editors to create the adapter factories? Looking at the source it looks like one is just created and then never modified. That means that I'm not getting the right label providers for references. If I hack it into "CreateMyObjectFlatComboViewer" like so:

owner = new EObjectFlatComboViewer(parent, true);
((ComposedAdapterFactory) adapterFactory).addAdapterFactory(new ResourceItemProviderAdapterFactory());
((ComposedAdapterFactory) adapterFactory).addAdapterFactory(new MyModelProviderAdapterFactory());
((ComposedAdapterFactory) adapterFactory).addAdapterFactory(new MyModelSubPackageItemProviderAdapterFactory());
....
((ComposedAdapterFactory) adapterFactory).addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
owner.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));

Then that does work, but obviously that's not very satisfactory. Smile Is there a pattern that I'm missing here?

thanks,

Miles
Re: EEF ComposedAdapterFactory [message #513176 is a reply to message #513141] Tue, 09 February 2010 09:14 Go to previous messageGo to next message
Goulwen Le Fur is currently offline Goulwen Le FurFriend
Messages: 125
Registered: July 2009
Senior Member
Hi Miles,

Thanks for your very interesting feedback. You're right about our
strategy for AdapterFactories. This isn't very satisfactory. We plan to
make a real improvment in the views (it includes the way to defines
adapter factories) but before that, we have a really important thing to
do: create Non-regression Tests.

We currently work on creating these tests and I hope we will finish this
week.

We will begin this phase of refund after.

Now I will check the bugs you open on EEF ;)

--
Goulwen Le Fur - goulwen.lefur@obeo.fr

Miles Parker a écrit :
> It looks like the EEF **PropertiesEditionPartForms are not using the
> same strategy as the EMF generated editors to create the adapter
> factories? Looking at the source it looks like one is just created and
> then never modified. That means that I'm not getting the right label
> providers for references. If I hack it into
> "CreateMyObjectFlatComboViewer" like so:
>
> owner = new EObjectFlatComboViewer(parent, true);
> ((ComposedAdapterFactory) adapterFactory).addAdapterFactory(new
> ResourceItemProviderAdapterFactory());
> ((ComposedAdapterFactory) adapterFactory).addAdapterFactory(new
> MyModelProviderAdapterFactory());
> ((ComposedAdapterFactory) adapterFactory).addAdapterFactory(new
> MyModelSubPackageItemProviderAdapterFactory());
> ...
> ((ComposedAdapterFactory) adapterFactory).addAdapterFactory(new
> ReflectiveItemProviderAdapterFactory());
> owner.setLabelProvider(new
> AdapterFactoryLabelProvider(adapterFactory));
>
> Then that does work, but obviously that's not very satisfactory. :) Is
> there a pattern that I'm missing here?
>
> thanks,
>
> Miles
Re: EEF ComposedAdapterFactory [message #513209 is a reply to message #513176] Tue, 09 February 2010 11:41 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010109000000030207010608
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Goulwen,

Note that creating the factory instance with

new
ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Reg istry.INSTANCE);

ensures that any register item provider adapter factory is automatically
used.


Goulwen Le Fur wrote:
> Hi Miles,
>
> Thanks for your very interesting feedback. You're right about our
> strategy for AdapterFactories. This isn't very satisfactory. We plan
> to make a real improvment in the views (it includes the way to defines
> adapter factories) but before that, we have a really important thing
> to do: create Non-regression Tests.
>
> We currently work on creating these tests and I hope we will finish
> this week.
>
> We will begin this phase of refund after.
>
> Now I will check the bugs you open on EEF ;)
>

--------------010109000000030207010608
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Goulwen,<br>
<br>
Note that creating the factory instance with<br>
<blockquote>&nbsp;new
ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Reg istry.INSTANCE); <br>
</blockquote>
ensures that any register item provider adapter factory is
automatically used.<br>
<br>
<br>
Goulwen Le Fur wrote:
<blockquote cite="mid:hkr91n$t9b$1@build.eclipse.org" type="cite">Hi
Miles,
<br>
<br>
Thanks for your very interesting feedback. You're right about our
strategy for AdapterFactories. This isn't very satisfactory. We plan to
make a real improvment in the views (it includes the way to defines
adapter factories) but before that, we have a really important thing to
do: create Non-regression Tests.
<br>
<br>
We currently work on creating these tests and I hope we will finish
this week.
<br>
<br>
We will begin this phase of refund after.
<br>
<br>
Now I will check the bugs you open on EEF&nbsp; ;)
<br>
<br>
</blockquote>
</body>
</html>

--------------010109000000030207010608--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EEF ComposedAdapterFactory [message #513247 is a reply to message #513209] Tue, 09 February 2010 08:58 Go to previous messageGo to next message
Goulwen Le Fur is currently offline Goulwen Le FurFriend
Messages: 125
Registered: July 2009
Senior Member
Yes Ed, I think it's what is done but I think that the need of Miles is
to override the default behavior (i.e. the behaviour of the registered
adapter factory). And for the moment, it's not very easy to do that in
EEF :)

Thx

--
Goulwen

Ed Merks a écrit :
> Goulwen,
>
> Note that creating the factory instance with
>
> new
> ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Reg istry.INSTANCE);
>
> ensures that any register item provider adapter factory is automatically
> used.
>
>
> Goulwen Le Fur wrote:
>> Hi Miles,
>>
>> Thanks for your very interesting feedback. You're right about our
>> strategy for AdapterFactories. This isn't very satisfactory. We plan
>> to make a real improvment in the views (it includes the way to defines
>> adapter factories) but before that, we have a really important thing
>> to do: create Non-regression Tests.
>>
>> We currently work on creating these tests and I hope we will finish
>> this week.
>>
>> We will begin this phase of refund after.
>>
>> Now I will check the bugs you open on EEF ;)
>>
Re: EEF ComposedAdapterFactory [message #513375 is a reply to message #513247] Tue, 09 February 2010 21:46 Go to previous messageGo to next message
Miles Parker is currently offline Miles ParkerFriend
Messages: 1341
Registered: July 2009
Senior Member

Ed, Goulwen,

Yes, and in general one of the really nice things about the EMF generated stuff is how it follows the EMF model hierarchy so that you can selectively override behavior for the whole set. A couple of years back there was a feature request completed that allows users to specify the common base class for the ItemProviders. All really nice for overrding generic behavior and something to take a look at perhaps for EEF.

But actually this brings up something I've been curious about for some time now, and it might be an idiosyncrasy / mistake in how I have things set up. But I'm wondering then why the EMF generated editor for example does:

    protected void initializeEditingDomain() {
        // Create an adapter factory that yields item providers.
        //
        adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);

        adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
        adapterFactory.addAdapterFactory(new MainPackageItemProviderAdapterFactory());
        adapterFactory.addAdapterFactory(new SubPackage1 ItemProviderAdapterFactory());
        adapterFactory.addAdapterFactory(new SubPackage1 ItemProviderAdapterFactory());
        adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());



When I take those out of the editor, it fails to find any of the adapters. So perhaps they haven't been registered correctly? But then why is this code generated?

And sorry for all those bug reports! It's because I love EEF that I file them. Smile

cheers,

Miles


Goulwen Le Fur wrote on Tue, 09 February 2010 03:58
Yes Ed, I think it's what is done but I think that the need of Miles is
to override the default behavior (i.e. the behaviour of the registered
adapter factory). And for the moment, it's not very easy to do that in
EEF Smile

Thx

--
Goulwen

Ed Merks a écrit :
> Goulwen,
>
> Note that creating the factory instance with
>
> new
> ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Reg istry.INSTANCE);
>
> ensures that any register item provider adapter factory is automatically
> used.
>
>
> Goulwen Le Fur wrote:
>> Hi Miles,
>>
>> Thanks for your very interesting feedback. You're right about our
>> strategy for AdapterFactories. This isn't very satisfactory. We plan
>> to make a real improvment in the views (it includes the way to defines
>> adapter factories) but before that, we have a really important thing
>> to do: create Non-regression Tests.
>>
>> We currently work on creating these tests and I hope we will finish
>> this week.
>>
>> We will begin this phase of refund after.
>>
>> Now I will check the bugs you open on EEF Wink
>>

Re: EEF ComposedAdapterFactory [message #513377 is a reply to message #513375] Tue, 09 February 2010 21:54 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Miles,

Comments below.

Miles Parker wrote:
>
> Ed, Goulwen,
>
> Yes, and in general one of the really nice things about the EMF
> generated stuff is how it follows the EMF model hierarchy so that you
> can selectively override behavior for the whole set. A couple of years
> back there was a feature request completed that allows users to
> specify the common base class for the ItemProviders. All really nice
> for overrding generic behavior and something to take a look at perhaps
> for EEF.
>
> But actually this brings up something I've been curious about for some
> time now, and it might be an idiosyncrasy / mistake in how I have
> things set up. But I'm wondering then why the EMF generated editor for
> example does:
>
> protected void initializeEditingDomain() {
> // Create an adapter factory that yields item providers.
> //
> adapterFactory = new
> ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Reg istry.INSTANCE);
>
Support for a registry didn't always exist. It was added at some point
along the way.
>
> adapterFactory.addAdapterFactory(new
> ResourceItemProviderAdapterFactory());
This one isn't registered, so it's really needed.
> adapterFactory.addAdapterFactory(new
> MainPackageItemProviderAdapterFactory());
> adapterFactory.addAdapterFactory(new SubPackage1
> ItemProviderAdapterFactory());
> adapterFactory.addAdapterFactory(new SubPackage1
> ItemProviderAdapterFactory());
These three should be registered. Are there typos here because of
duplicates? Check the plugin.xml for the *.edit projects to verify
they're registered.
> adapterFactory.addAdapterFactory(new
> ReflectiveItemProviderAdapterFactory());
This one isn't registered either, so it's really needed.
>
>
> When I take those out of the editor, it fails to find any of the
> adapters. So perhaps they haven't been registered correctly? But then
> why is this code generated?
It could be changed to omit them but given it's a generated editor for
the package, one can assume it's always needed and add it explicitly.
>
>
> And sorry for all those bug reports! It's because I love EEF that I
> file them. :)
>
> cheers,
>
> Miles
>
>
> Goulwen Le Fur wrote on Tue, 09 February 2010 03:58
>> Yes Ed, I think it's what is done but I think that the need of Miles
>> is to override the default behavior (i.e. the behaviour of the
>> registered adapter factory). And for the moment, it's not very easy
>> to do that in EEF :)
>>
>> Thx
>>
>> --
>> Goulwen
>>
>> Ed Merks a écrit :
>> > Goulwen,
>> > > Note that creating the factory instance with
>> > > new
>> > ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Reg
>> istry.INSTANCE);
>> > > ensures that any register item provider adapter factory is
>> automatically > used.
>> > > > Goulwen Le Fur wrote:
>> >> Hi Miles,
>> >>
>> >> Thanks for your very interesting feedback. You're right about our
>> >> strategy for AdapterFactories. This isn't very satisfactory. We
>> plan >> to make a real improvment in the views (it includes the way
>> to defines >> adapter factories) but before that, we have a really
>> important thing >> to do: create Non-regression Tests.
>> >>
>> >> We currently work on creating these tests and I hope we will
>> finish >> this week.
>> >>
>> >> We will begin this phase of refund after.
>> >>
>> >> Now I will check the bugs you open on EEF ;)
>> >>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EEF ComposedAdapterFactory [message #513388 is a reply to message #513377] Tue, 09 February 2010 23:12 Go to previous messageGo to next message
Miles Parker is currently offline Miles ParkerFriend
Messages: 1341
Registered: July 2009
Senior Member

Okay, Ed thanks for clarifying. Please see my responses below.

Ed Merks wrote on Tue, 09 February 2010 16:54

Miles Parker wrote:
>
> Ed, Goulwen,
>
> Yes, and in general one of the really nice things about the EMF
> generated stuff is how it follows the EMF model hierarchy so that you
> can selectively override behavior for the whole set. A couple of years
> back there was a feature request completed that allows users to
> specify the common base class for the ItemProviders. All really nice
> for overrding generic behavior and something to take a look at perhaps
> for EEF.
>
> But actually this brings up something I've been curious about for some
> time now, and it might be an idiosyncrasy / mistake in how I have
> things set up. But I'm wondering then why the EMF generated editor for
> example does:
>
> protected void initializeEditingDomain() {
> // Create an adapter factory that yields item providers.
> //
> adapterFactory = new
> ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Reg istry.INSTANCE);
>
Support for a registry didn't always exist. It was added at some point
along the way.



Yeah, that has been my default assumption. Then, as I started building my own ItemProvider editors (super easy!) a while ago I noticed that I needed them there as well, so I got confused.

Quote:

>
> adapterFactory.addAdapterFactory(new
> ResourceItemProviderAdapterFactory());
This one isn't registered, so it's really needed.
> adapterFactory.addAdapterFactory(new
> MainPackageItemProviderAdapterFactory());
> adapterFactory.addAdapterFactory(new SubPackage1
> ItemProviderAdapterFactory());
> adapterFactory.addAdapterFactory(new SubPackage1
> ItemProviderAdapterFactory());
These three should be registered. Are there typos here because of
duplicates? Check the plugin.xml for the *.edit projects to verify
they're registered.



Sorry, screwed up in my attempt to make the example general. Here is the *actual* code in ..acore:

    protected void initializeEditingDomain() {
        // Create an adapter factory that yields item providers.
        //
        adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);

        adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
        adapterFactory.addAdapterFactory(new MetaABMItemProviderAdapterFactory());
        adapterFactory.addAdapterFactory(new MetaABMFunctionItemProviderAdapterFactory());
        adapterFactory.addAdapterFactory(new MetaABMActItemProviderAdapterFactory());
        adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
...


And this is the ..acore.edit plugin.xml

  <extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
    <factory 
       uri = "http://metaabm.org/structure" 
       class = "org.metaabm.provider.MetaABMItemProviderAdapterFactory" 
       supportedTypes = 
         "org.eclipse.emf.edit.provider.IEditingDomainItemProvider
          org.eclipse.emf.edit.provider.IStructuredItemContentProvider
          org.eclipse.emf.edit.provider.ITreeItemContentProvider
          org.eclipse.emf.edit.provider.IItemLabelProvider
          org.eclipse.emf.edit.provider.IItemPropertySource" />
  </extension>
  
  <extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
    <factory 
       uri = "http://metaabm.org/act" 
       class = "org.metaabm.act.provider.MetaABMActItemProviderAdapterFactory" 
       supportedTypes = 
         "org.eclipse.emf.edit.provider.IEditingDomainItemProvider
          org.eclipse.emf.edit.provider.IStructuredItemContentProvider
          org.eclipse.emf.edit.provider.ITreeItemContentProvider
          org.eclipse.emf.edit.provider.IItemLabelProvider
          org.eclipse.emf.edit.provider.IItemPropertySource" />
  </extension>
  
  <extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
    <factory 
       uri = "http://metaabm.org/function" 
       class = "org.metaabm.function.provider.MetaABMFunctionItemProviderAdapterFactory" 
       supportedTypes = 
         "org.eclipse.emf.edit.provider.IEditingDomainItemProvider
          org.eclipse.emf.edit.provider.IStructuredItemContentProvider
          org.eclipse.emf.edit.provider.ITreeItemContentProvider
          org.eclipse.emf.edit.provider.IItemLabelProvider
          org.eclipse.emf.edit.provider.IItemPropertySource" />
  </extension>


So on inspection that al seems correct. Now I've heavily customized the generated editor, so it's possible that I've stepped on something. OTOH, I have done a compare against a generated editor and I didn't see anything obviously messed up.

And as a BTW, I noticed a while back that the base package also has this:

    public static AdapterFactory getGenericAdapterFactory() {
        if (genericFactory == null) {
            List<AdapterFactory> factories = new ArrayList<AdapterFactory>();
            factories.add(new ResourceItemProviderAdapterFactory());
            factories.add(new MetaABMItemProviderAdapterFactory());
            factories.add(new MetaABMActItemProviderAdapterFactory());
            factories.add(new MetaABMFunctionItemProviderAdapterFactory());
            factories.add(new ReflectiveItemProviderAdapterFactory());
            genericFactory = new ComposedAdapterFactory(factories);
        }
        return genericFactory;
    }


So I've begun to try to use that so there is a single point of maintenance..

Quote:

> adapterFactory.addAdapterFactory(new
> ReflectiveItemProviderAdapterFactory());
This one isn't registered either, so it's really needed.
>
>
> When I take those out of the editor, it fails to find any of the
> adapters. So perhaps they haven't been registered correctly? But then
> why is this code generated?
It could be changed to omit them but given it's a generated editor for
the package, one can assume it's always needed and add it explicitly.



Makes sense.
Re: EEF ComposedAdapterFactory [message #513491 is a reply to message #513388] Wed, 10 February 2010 06:50 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Miles,

I don't know what this is?

public static AdapterFactory getGenericAdapterFactory() {
if (genericFactory == null) {
List<AdapterFactory> factories = new
ArrayList<AdapterFactory>();
factories.add(new ResourceItemProviderAdapterFactory());
factories.add(new MetaABMItemProviderAdapterFactory());
factories.add(new MetaABMActItemProviderAdapterFactory());
factories.add(new MetaABMFunctionItemProviderAdapterFactory());
factories.add(new ReflectiveItemProviderAdapterFactory());
genericFactory = new ComposedAdapterFactory(factories);
}
return genericFactory;
}

But note that the composed factory isn't created with the registry so
will need explicit registration.


Miles Parker wrote:
>
> Okay, Ed thanks for clarifying. Please see my responses below.
>
> Ed Merks wrote on Tue, 09 February 2010 16:54
>> Miles Parker wrote:
>> >
>> > Ed, Goulwen,
>> >
>> > Yes, and in general one of the really nice things about the EMF >
>> generated stuff is how it follows the EMF model hierarchy so that you
>> > can selectively override behavior for the whole set. A couple of
>> years > back there was a feature request completed that allows users
>> to > specify the common base class for the ItemProviders. All really
>> nice > for overrding generic behavior and something to take a look at
>> perhaps > for EEF.
>> >
>> > But actually this brings up something I've been curious about for
>> some > time now, and it might be an idiosyncrasy / mistake in how I
>> have > things set up. But I'm wondering then why the EMF generated
>> editor for > example does:
>> >
>> > protected void initializeEditingDomain() {
>> > // Create an adapter factory that yields item providers.
>> > //
>> > adapterFactory = new >
>> ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Reg
>> istry.INSTANCE); >
>> Support for a registry didn't always exist. It was added at some
>> point along the way.
>
>
> Yeah, that has been my default assumption. Then, as I started building
> my own ItemProvider editors (super easy!) a while ago I noticed that I
> needed them there as well, so I got confused.
>
> Quote:
>> >
>> > adapterFactory.addAdapterFactory(new >
>> ResourceItemProviderAdapterFactory());
>> This one isn't registered, so it's really needed.
>> > adapterFactory.addAdapterFactory(new >
>> MainPackageItemProviderAdapterFactory());
>> > adapterFactory.addAdapterFactory(new SubPackage1 >
>> ItemProviderAdapterFactory());
>> > adapterFactory.addAdapterFactory(new SubPackage1 >
>> ItemProviderAdapterFactory());
>> These three should be registered. Are there typos here because of
>> duplicates? Check the plugin.xml for the *.edit projects to verify
>> they're registered.
>
>
> Sorry, screwed up in my attempt to make the example general. Here is
> the *actual* code in ..acore:
>
>
> protected void initializeEditingDomain() {
> // Create an adapter factory that yields item providers.
> //
> adapterFactory = new
> ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Reg istry.INSTANCE);
>
>
> adapterFactory.addAdapterFactory(new
> ResourceItemProviderAdapterFactory());
> adapterFactory.addAdapterFactory(new
> MetaABMItemProviderAdapterFactory());
> adapterFactory.addAdapterFactory(new
> MetaABMFunctionItemProviderAdapterFactory());
> adapterFactory.addAdapterFactory(new
> MetaABMActItemProviderAdapterFactory());
> adapterFactory.addAdapterFactory(new
> ReflectiveItemProviderAdapterFactory());
> ..
>
>
> And this is the ..acore.edit plugin.xml
>
>
> <extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
> <factory uri = "http://metaabm.org/structure" class =
> "org.metaabm.provider.MetaABMItemProviderAdapterFactory"
> supportedTypes =
> "org.eclipse.emf.edit.provider.IEditingDomainItemProvider
> org.eclipse.emf.edit.provider.IStructuredItemContentProvider
> org.eclipse.emf.edit.provider.ITreeItemContentProvider
> org.eclipse.emf.edit.provider.IItemLabelProvider
> org.eclipse.emf.edit.provider.IItemPropertySource" />
> </extension>
>
> <extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
> <factory uri = "http://metaabm.org/act" class =
> " org.metaabm.act.provider.MetaABMActItemProviderAdapterFactor y "
> supportedTypes =
> "org.eclipse.emf.edit.provider.IEditingDomainItemProvider
> org.eclipse.emf.edit.provider.IStructuredItemContentProvider
> org.eclipse.emf.edit.provider.ITreeItemContentProvider
> org.eclipse.emf.edit.provider.IItemLabelProvider
> org.eclipse.emf.edit.provider.IItemPropertySource" />
> </extension>
>
> <extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
> <factory uri = "http://metaabm.org/function" class =
> " org.metaabm.function.provider.MetaABMFunctionItemProviderAda pterFactory "
> supportedTypes =
> "org.eclipse.emf.edit.provider.IEditingDomainItemProvider
> org.eclipse.emf.edit.provider.IStructuredItemContentProvider
> org.eclipse.emf.edit.provider.ITreeItemContentProvider
> org.eclipse.emf.edit.provider.IItemLabelProvider
> org.eclipse.emf.edit.provider.IItemPropertySource" />
> </extension>
>
>
> So on inspection that al seems correct. Now I've heavily customized
> the generated editor, so it's possible that I've stepped on something.
> OTOH, I have done a compare against a generated editor and I didn't
> see anything obviously messed up.
>
> And as a BTW, I noticed a while back that the base package also has this:
>
>
> public static AdapterFactory getGenericAdapterFactory() {
> if (genericFactory == null) {
> List<AdapterFactory> factories = new
> ArrayList<AdapterFactory>();
> factories.add(new ResourceItemProviderAdapterFactory());
> factories.add(new MetaABMItemProviderAdapterFactory());
> factories.add(new MetaABMActItemProviderAdapterFactory());
> factories.add(new
> MetaABMFunctionItemProviderAdapterFactory());
> factories.add(new ReflectiveItemProviderAdapterFactory());
> genericFactory = new ComposedAdapterFactory(factories);
> }
> return genericFactory;
> }
>
>
> So I've begun to try to use that so there is a single point of
> maintenance..
>
> Quote:
>> > adapterFactory.addAdapterFactory(new >
>> ReflectiveItemProviderAdapterFactory());
>> This one isn't registered either, so it's really needed.
>> >
>> >
>> > When I take those out of the editor, it fails to find any of the >
>> adapters. So perhaps they haven't been registered correctly? But then
>> > why is this code generated?
>> It could be changed to omit them but given it's a generated editor
>> for the package, one can assume it's always needed and add it
>> explicitly.
>
>
> Makes sense.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EEF ComposedAdapterFactory [message #513700 is a reply to message #513491] Wed, 10 February 2010 21:19 Go to previous messageGo to next message
Miles Parker is currently offline Miles ParkerFriend
Messages: 1341
Registered: July 2009
Senior Member
Ed Merks wrote on Wed, 10 February 2010 01:50
Miles,

I don't know what this is?

public static AdapterFactory getGenericAdapterFactory() {
if (genericFactory == null) {
List<AdapterFactory> factories = new
ArrayList<AdapterFactory>();
factories.add(new ResourceItemProviderAdapterFactory());
factories.add(new MetaABMItemProviderAdapterFactory());
factories.add(new MetaABMActItemProviderAdapterFactory());
factories.add(new MetaABMFunctionItemProviderAdapterFactory());
factories.add(new ReflectiveItemProviderAdapterFactory());
genericFactory = new ComposedAdapterFactory(factories);
}
return genericFactory;
}

But note that the composed factory isn't created with the registry so
will need explicit registration.




That's me being a dummy...I wrote that code myself for cases where I needed to create an adapter factor manually. The I use it to explicitly get the adapter I want, i.e.

MetaABMItemProvider labelSuggestor = (MetaABMItemProvider) MetaABMItemProviderAdapterFactory
.getGenericAdapterFactory().adapt(obj, IEditingDomainItemProvider.class);

So it's not related to this usage at all.

And I figured out the registered adapter issue as well...it was an issue on my side .. somewhere along the way, my .ecore namespace URI became mismatched from that which was exposed through the plugins. I think this is because I have one package at the base level that I map to a non-base level on the URI, it ended up being a confusing way to do things. In the next version of the metamodel I think I will have all packages as sibling nodes.
Re: EEF ComposedAdapterFactory [message #622105 is a reply to message #513176] Tue, 09 February 2010 11:41 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010109000000030207010608
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Goulwen,

Note that creating the factory instance with

new
ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Reg istry.INSTANCE);

ensures that any register item provider adapter factory is automatically
used.


Goulwen Le Fur wrote:
> Hi Miles,
>
> Thanks for your very interesting feedback. You're right about our
> strategy for AdapterFactories. This isn't very satisfactory. We plan
> to make a real improvment in the views (it includes the way to defines
> adapter factories) but before that, we have a really important thing
> to do: create Non-regression Tests.
>
> We currently work on creating these tests and I hope we will finish
> this week.
>
> We will begin this phase of refund after.
>
> Now I will check the bugs you open on EEF ;)
>

--------------010109000000030207010608
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Goulwen,<br>
<br>
Note that creating the factory instance with<br>
<blockquote>&nbsp;new
ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Reg istry.INSTANCE); <br>
</blockquote>
ensures that any register item provider adapter factory is
automatically used.<br>
<br>
<br>
Goulwen Le Fur wrote:
<blockquote cite="mid:hkr91n$t9b$1@build.eclipse.org" type="cite">Hi
Miles,
<br>
<br>
Thanks for your very interesting feedback. You're right about our
strategy for AdapterFactories. This isn't very satisfactory. We plan to
make a real improvment in the views (it includes the way to defines
adapter factories) but before that, we have a really important thing to
do: create Non-regression Tests.
<br>
<br>
We currently work on creating these tests and I hope we will finish
this week.
<br>
<br>
We will begin this phase of refund after.
<br>
<br>
Now I will check the bugs you open on EEF&nbsp; ;)
<br>
<br>
</blockquote>
</body>
</html>

--------------010109000000030207010608--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EEF ComposedAdapterFactory [message #622106 is a reply to message #513209] Tue, 09 February 2010 13:40 Go to previous messageGo to next message
Goulwen Le Fur is currently offline Goulwen Le FurFriend
Messages: 125
Registered: July 2009
Senior Member
Yes Ed, I think it's what is done but I think that the need of Miles is
to override the default behavior (i.e. the behaviour of the registered
adapter factory). And for the moment, it's not very easy to do that in
EEF :)

Thx

--
Goulwen

Ed Merks a écrit :
> Goulwen,
>
> Note that creating the factory instance with
>
> new
> ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Reg istry.INSTANCE);
>
> ensures that any register item provider adapter factory is automatically
> used.
>
>
> Goulwen Le Fur wrote:
>> Hi Miles,
>>
>> Thanks for your very interesting feedback. You're right about our
>> strategy for AdapterFactories. This isn't very satisfactory. We plan
>> to make a real improvment in the views (it includes the way to defines
>> adapter factories) but before that, we have a really important thing
>> to do: create Non-regression Tests.
>>
>> We currently work on creating these tests and I hope we will finish
>> this week.
>>
>> We will begin this phase of refund after.
>>
>> Now I will check the bugs you open on EEF ;)
>>
Re: EEF ComposedAdapterFactory [message #622108 is a reply to message #622106] Tue, 09 February 2010 21:46 Go to previous messageGo to next message
Miles Parker is currently offline Miles ParkerFriend
Messages: 1341
Registered: July 2009
Senior Member
Ed, Goulwen,

Yes, and in general one of the really nice things about the EMF generated stuff is how it follows the EMF model hierarchy so that you can selectively override behavior for the whole set. A couple of years back there was a feature request completed that allows users to specify the common base class for the ItemProviders. All really nice for overrding generic behavior and something to take a look at perhaps for EEF.

But actually this brings up something I've been curious about for some time now, and it might be an idiosyncrasy / mistake in how I have things set up. But I'm wondering then why the EMF generated editor for example does:

protected void initializeEditingDomain() {
// Create an adapter factory that yields item providers.
//
adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Reg istry.INSTANCE);

adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new MainPackageItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new SubPackage1 ItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new SubPackage1 ItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());


When I take those out of the editor, it fails to find any of the adapters. So perhaps they haven't been registered correctly? But then why is this code generated?

And sorry for all those bug reports! It's because I love EEF that I file them. :)

cheers,

Miles


Goulwen Le Fur wrote on Tue, 09 February 2010 03:58
> Yes Ed, I think it's what is done but I think that the need of Miles is
> to override the default behavior (i.e. the behaviour of the registered
> adapter factory). And for the moment, it's not very easy to do that in
> EEF :)
>
> Thx
>
> --
> Goulwen
>
> Ed Merks a écrit :
> > Goulwen,
> >
> > Note that creating the factory instance with
> >
> > new
> > ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Reg istry.INSTANCE);
> >
> > ensures that any register item provider adapter factory is automatically
> > used.
> >
> >
> > Goulwen Le Fur wrote:
> >> Hi Miles,
> >>
> >> Thanks for your very interesting feedback. You're right about our
> >> strategy for AdapterFactories. This isn't very satisfactory. We plan
> >> to make a real improvment in the views (it includes the way to defines
> >> adapter factories) but before that, we have a really important thing
> >> to do: create Non-regression Tests.
> >>
> >> We currently work on creating these tests and I hope we will finish
> >> this week.
> >>
> >> We will begin this phase of refund after.
> >>
> >> Now I will check the bugs you open on EEF ;)
> >>
Re: EEF ComposedAdapterFactory [message #622109 is a reply to message #513375] Tue, 09 February 2010 21:54 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Miles,

Comments below.

Miles Parker wrote:
>
> Ed, Goulwen,
>
> Yes, and in general one of the really nice things about the EMF
> generated stuff is how it follows the EMF model hierarchy so that you
> can selectively override behavior for the whole set. A couple of years
> back there was a feature request completed that allows users to
> specify the common base class for the ItemProviders. All really nice
> for overrding generic behavior and something to take a look at perhaps
> for EEF.
>
> But actually this brings up something I've been curious about for some
> time now, and it might be an idiosyncrasy / mistake in how I have
> things set up. But I'm wondering then why the EMF generated editor for
> example does:
>
> protected void initializeEditingDomain() {
> // Create an adapter factory that yields item providers.
> //
> adapterFactory = new
> ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Reg istry.INSTANCE);
>
Support for a registry didn't always exist. It was added at some point
along the way.
>
> adapterFactory.addAdapterFactory(new
> ResourceItemProviderAdapterFactory());
This one isn't registered, so it's really needed.
> adapterFactory.addAdapterFactory(new
> MainPackageItemProviderAdapterFactory());
> adapterFactory.addAdapterFactory(new SubPackage1
> ItemProviderAdapterFactory());
> adapterFactory.addAdapterFactory(new SubPackage1
> ItemProviderAdapterFactory());
These three should be registered. Are there typos here because of
duplicates? Check the plugin.xml for the *.edit projects to verify
they're registered.
> adapterFactory.addAdapterFactory(new
> ReflectiveItemProviderAdapterFactory());
This one isn't registered either, so it's really needed.
>
>
> When I take those out of the editor, it fails to find any of the
> adapters. So perhaps they haven't been registered correctly? But then
> why is this code generated?
It could be changed to omit them but given it's a generated editor for
the package, one can assume it's always needed and add it explicitly.
>
>
> And sorry for all those bug reports! It's because I love EEF that I
> file them. :)
>
> cheers,
>
> Miles
>
>
> Goulwen Le Fur wrote on Tue, 09 February 2010 03:58
>> Yes Ed, I think it's what is done but I think that the need of Miles
>> is to override the default behavior (i.e. the behaviour of the
>> registered adapter factory). And for the moment, it's not very easy
>> to do that in EEF :)
>>
>> Thx
>>
>> --
>> Goulwen
>>
>> Ed Merks a écrit :
>> > Goulwen,
>> > > Note that creating the factory instance with
>> > > new
>> > ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Reg
>> istry.INSTANCE);
>> > > ensures that any register item provider adapter factory is
>> automatically > used.
>> > > > Goulwen Le Fur wrote:
>> >> Hi Miles,
>> >>
>> >> Thanks for your very interesting feedback. You're right about our
>> >> strategy for AdapterFactories. This isn't very satisfactory. We
>> plan >> to make a real improvment in the views (it includes the way
>> to defines >> adapter factories) but before that, we have a really
>> important thing >> to do: create Non-regression Tests.
>> >>
>> >> We currently work on creating these tests and I hope we will
>> finish >> this week.
>> >>
>> >> We will begin this phase of refund after.
>> >>
>> >> Now I will check the bugs you open on EEF ;)
>> >>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EEF ComposedAdapterFactory [message #622110 is a reply to message #513377] Tue, 09 February 2010 23:12 Go to previous messageGo to next message
Miles Parker is currently offline Miles ParkerFriend
Messages: 1341
Registered: July 2009
Senior Member
Okay, Ed thanks for clarifying. Please see my responses below.

Ed Merks wrote on Tue, 09 February 2010 16:54
> Miles Parker wrote:
> >
> > Ed, Goulwen,
> >
> > Yes, and in general one of the really nice things about the EMF
> > generated stuff is how it follows the EMF model hierarchy so that you
> > can selectively override behavior for the whole set. A couple of years
> > back there was a feature request completed that allows users to
> > specify the common base class for the ItemProviders. All really nice
> > for overrding generic behavior and something to take a look at perhaps
> > for EEF.
> >
> > But actually this brings up something I've been curious about for some
> > time now, and it might be an idiosyncrasy / mistake in how I have
> > things set up. But I'm wondering then why the EMF generated editor for
> > example does:
> >
> > protected void initializeEditingDomain() {
> > // Create an adapter factory that yields item providers.
> > //
> > adapterFactory = new
> > ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Reg istry.INSTANCE);
> >
> Support for a registry didn't always exist. It was added at some point
> along the way.


Yeah, that has been my default assumption. Then, as I started building my own ItemProvider editors (super easy!) a while ago I noticed that I needed them there as well, so I got confused.

Quote:
> >
> > adapterFactory.addAdapterFactory(new
> > ResourceItemProviderAdapterFactory());
> This one isn't registered, so it's really needed.
> > adapterFactory.addAdapterFactory(new
> > MainPackageItemProviderAdapterFactory());
> > adapterFactory.addAdapterFactory(new SubPackage1
> > ItemProviderAdapterFactory());
> > adapterFactory.addAdapterFactory(new SubPackage1
> > ItemProviderAdapterFactory());
> These three should be registered. Are there typos here because of
> duplicates? Check the plugin.xml for the *.edit projects to verify
> they're registered.


Sorry, screwed up in my attempt to make the example general. Here is the *actual* code in ..acore:


protected void initializeEditingDomain() {
// Create an adapter factory that yields item providers.
//
adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Reg istry.INSTANCE);

adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new MetaABMItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new MetaABMFunctionItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new MetaABMActItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
...


And this is the ..acore.edit plugin.xml


<extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
<factory
uri = "http://metaabm.org/structure"
class = "org.metaabm.provider.MetaABMItemProviderAdapterFactory"
supportedTypes =
"org.eclipse.emf.edit.provider.IEditingDomainItemProvider
org.eclipse.emf.edit.provider.IStructuredItemContentProvider
org.eclipse.emf.edit.provider.ITreeItemContentProvider
org.eclipse.emf.edit.provider.IItemLabelProvider
org.eclipse.emf.edit.provider.IItemPropertySource" />
</extension>

<extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
<factory
uri = "http://metaabm.org/act"
class = " org.metaabm.act.provider.MetaABMActItemProviderAdapterFactor y "
supportedTypes =
"org.eclipse.emf.edit.provider.IEditingDomainItemProvider
org.eclipse.emf.edit.provider.IStructuredItemContentProvider
org.eclipse.emf.edit.provider.ITreeItemContentProvider
org.eclipse.emf.edit.provider.IItemLabelProvider
org.eclipse.emf.edit.provider.IItemPropertySource" />
</extension>

<extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
<factory
uri = "http://metaabm.org/function"
class = " org.metaabm.function.provider.MetaABMFunctionItemProviderAda pterFactory "
supportedTypes =
"org.eclipse.emf.edit.provider.IEditingDomainItemProvider
org.eclipse.emf.edit.provider.IStructuredItemContentProvider
org.eclipse.emf.edit.provider.ITreeItemContentProvider
org.eclipse.emf.edit.provider.IItemLabelProvider
org.eclipse.emf.edit.provider.IItemPropertySource" />
</extension>


So on inspection that al seems correct. Now I've heavily customized the generated editor, so it's possible that I've stepped on something. OTOH, I have done a compare against a generated editor and I didn't see anything obviously messed up.

And as a BTW, I noticed a while back that the base package also has this:


public static AdapterFactory getGenericAdapterFactory() {
if (genericFactory == null) {
List<AdapterFactory> factories = new ArrayList<AdapterFactory>();
factories.add(new ResourceItemProviderAdapterFactory());
factories.add(new MetaABMItemProviderAdapterFactory());
factories.add(new MetaABMActItemProviderAdapterFactory());
factories.add(new MetaABMFunctionItemProviderAdapterFactory());
factories.add(new ReflectiveItemProviderAdapterFactory());
genericFactory = new ComposedAdapterFactory(factories);
}
return genericFactory;
}


So I've begun to try to use that so there is a single point of maintenance..

Quote:
> > adapterFactory.addAdapterFactory(new
> > ReflectiveItemProviderAdapterFactory());
> This one isn't registered either, so it's really needed.
> >
> >
> > When I take those out of the editor, it fails to find any of the
> > adapters. So perhaps they haven't been registered correctly? But then
> > why is this code generated?
> It could be changed to omit them but given it's a generated editor for
> the package, one can assume it's always needed and add it explicitly.


Makes sense.
Re: EEF ComposedAdapterFactory [message #622111 is a reply to message #513388] Wed, 10 February 2010 11:37 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Miles,

I don't know what this is?

public static AdapterFactory getGenericAdapterFactory() {
if (genericFactory == null) {
List<AdapterFactory> factories = new
ArrayList<AdapterFactory>();
factories.add(new ResourceItemProviderAdapterFactory());
factories.add(new MetaABMItemProviderAdapterFactory());
factories.add(new MetaABMActItemProviderAdapterFactory());
factories.add(new MetaABMFunctionItemProviderAdapterFactory());
factories.add(new ReflectiveItemProviderAdapterFactory());
genericFactory = new ComposedAdapterFactory(factories);
}
return genericFactory;
}

But note that the composed factory isn't created with the registry so
will need explicit registration.


Miles Parker wrote:
>
> Okay, Ed thanks for clarifying. Please see my responses below.
>
> Ed Merks wrote on Tue, 09 February 2010 16:54
>> Miles Parker wrote:
>> >
>> > Ed, Goulwen,
>> >
>> > Yes, and in general one of the really nice things about the EMF >
>> generated stuff is how it follows the EMF model hierarchy so that you
>> > can selectively override behavior for the whole set. A couple of
>> years > back there was a feature request completed that allows users
>> to > specify the common base class for the ItemProviders. All really
>> nice > for overrding generic behavior and something to take a look at
>> perhaps > for EEF.
>> >
>> > But actually this brings up something I've been curious about for
>> some > time now, and it might be an idiosyncrasy / mistake in how I
>> have > things set up. But I'm wondering then why the EMF generated
>> editor for > example does:
>> >
>> > protected void initializeEditingDomain() {
>> > // Create an adapter factory that yields item providers.
>> > //
>> > adapterFactory = new >
>> ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Reg
>> istry.INSTANCE); >
>> Support for a registry didn't always exist. It was added at some
>> point along the way.
>
>
> Yeah, that has been my default assumption. Then, as I started building
> my own ItemProvider editors (super easy!) a while ago I noticed that I
> needed them there as well, so I got confused.
>
> Quote:
>> >
>> > adapterFactory.addAdapterFactory(new >
>> ResourceItemProviderAdapterFactory());
>> This one isn't registered, so it's really needed.
>> > adapterFactory.addAdapterFactory(new >
>> MainPackageItemProviderAdapterFactory());
>> > adapterFactory.addAdapterFactory(new SubPackage1 >
>> ItemProviderAdapterFactory());
>> > adapterFactory.addAdapterFactory(new SubPackage1 >
>> ItemProviderAdapterFactory());
>> These three should be registered. Are there typos here because of
>> duplicates? Check the plugin.xml for the *.edit projects to verify
>> they're registered.
>
>
> Sorry, screwed up in my attempt to make the example general. Here is
> the *actual* code in ..acore:
>
>
> protected void initializeEditingDomain() {
> // Create an adapter factory that yields item providers.
> //
> adapterFactory = new
> ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Reg istry.INSTANCE);
>
>
> adapterFactory.addAdapterFactory(new
> ResourceItemProviderAdapterFactory());
> adapterFactory.addAdapterFactory(new
> MetaABMItemProviderAdapterFactory());
> adapterFactory.addAdapterFactory(new
> MetaABMFunctionItemProviderAdapterFactory());
> adapterFactory.addAdapterFactory(new
> MetaABMActItemProviderAdapterFactory());
> adapterFactory.addAdapterFactory(new
> ReflectiveItemProviderAdapterFactory());
> ..
>
>
> And this is the ..acore.edit plugin.xml
>
>
> <extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
> <factory uri = "http://metaabm.org/structure" class =
> "org.metaabm.provider.MetaABMItemProviderAdapterFactory"
> supportedTypes =
> "org.eclipse.emf.edit.provider.IEditingDomainItemProvider
> org.eclipse.emf.edit.provider.IStructuredItemContentProvider
> org.eclipse.emf.edit.provider.ITreeItemContentProvider
> org.eclipse.emf.edit.provider.IItemLabelProvider
> org.eclipse.emf.edit.provider.IItemPropertySource" />
> </extension>
>
> <extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
> <factory uri = "http://metaabm.org/act" class =
> " org.metaabm.act.provider.MetaABMActItemProviderAdapterFactor y "
> supportedTypes =
> "org.eclipse.emf.edit.provider.IEditingDomainItemProvider
> org.eclipse.emf.edit.provider.IStructuredItemContentProvider
> org.eclipse.emf.edit.provider.ITreeItemContentProvider
> org.eclipse.emf.edit.provider.IItemLabelProvider
> org.eclipse.emf.edit.provider.IItemPropertySource" />
> </extension>
>
> <extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
> <factory uri = "http://metaabm.org/function" class =
> " org.metaabm.function.provider.MetaABMFunctionItemProviderAda pterFactory "
> supportedTypes =
> "org.eclipse.emf.edit.provider.IEditingDomainItemProvider
> org.eclipse.emf.edit.provider.IStructuredItemContentProvider
> org.eclipse.emf.edit.provider.ITreeItemContentProvider
> org.eclipse.emf.edit.provider.IItemLabelProvider
> org.eclipse.emf.edit.provider.IItemPropertySource" />
> </extension>
>
>
> So on inspection that al seems correct. Now I've heavily customized
> the generated editor, so it's possible that I've stepped on something.
> OTOH, I have done a compare against a generated editor and I didn't
> see anything obviously messed up.
>
> And as a BTW, I noticed a while back that the base package also has this:
>
>
> public static AdapterFactory getGenericAdapterFactory() {
> if (genericFactory == null) {
> List<AdapterFactory> factories = new
> ArrayList<AdapterFactory>();
> factories.add(new ResourceItemProviderAdapterFactory());
> factories.add(new MetaABMItemProviderAdapterFactory());
> factories.add(new MetaABMActItemProviderAdapterFactory());
> factories.add(new
> MetaABMFunctionItemProviderAdapterFactory());
> factories.add(new ReflectiveItemProviderAdapterFactory());
> genericFactory = new ComposedAdapterFactory(factories);
> }
> return genericFactory;
> }
>
>
> So I've begun to try to use that so there is a single point of
> maintenance..
>
> Quote:
>> > adapterFactory.addAdapterFactory(new >
>> ReflectiveItemProviderAdapterFactory());
>> This one isn't registered either, so it's really needed.
>> >
>> >
>> > When I take those out of the editor, it fails to find any of the >
>> adapters. So perhaps they haven't been registered correctly? But then
>> > why is this code generated?
>> It could be changed to omit them but given it's a generated editor
>> for the package, one can assume it's always needed and add it
>> explicitly.
>
>
> Makes sense.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EEF ComposedAdapterFactory [message #622116 is a reply to message #622111] Wed, 10 February 2010 21:19 Go to previous message
Miles Parker is currently offline Miles ParkerFriend
Messages: 1341
Registered: July 2009
Senior Member
Ed Merks wrote on Wed, 10 February 2010 01:50
> Miles,
>
> I don't know what this is?
>
> public static AdapterFactory getGenericAdapterFactory() {
> if (genericFactory == null) {
> List<AdapterFactory> factories = new
> ArrayList<AdapterFactory>();
> factories.add(new ResourceItemProviderAdapterFactory());
> factories.add(new MetaABMItemProviderAdapterFactory());
> factories.add(new MetaABMActItemProviderAdapterFactory());
> factories.add(new MetaABMFunctionItemProviderAdapterFactory());
> factories.add(new ReflectiveItemProviderAdapterFactory());
> genericFactory = new ComposedAdapterFactory(factories);
> }
> return genericFactory;
> }
>
> But note that the composed factory isn't created with the registry so
> will need explicit registration.


That's me being a dummy...I wrote that code myself for cases where I needed to create an adapter factor manually. The I use it to explicitly get the adapter I want, i.e.

MetaABMItemProvider labelSuggestor = (MetaABMItemProvider) MetaABMItemProviderAdapterFactory
.getGenericAdapterFactory().adapt(obj, IEditingDomainItemProvider.class);

So it's not related to this usage at all.

And I figured out the registered adapter issue as well...it was an issue on my side .. somewhere along the way, my .ecore namespace URI became mismatched from that which was exposed through the plugins. I think this is because I have one package at the base level that I map to a non-base level on the URI, it ended up being a confusing way to do things. In the next version of the metamodel I think I will have all packages as sibling nodes.
Previous Topic:[Announce] Eclipse/OMG Symposium 2010
Next Topic:[EEF] Forms vs. property editing
Goto Forum:
  


Current Time: Tue Apr 23 14:16:43 GMT 2024

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

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

Back to the top