Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Declaring customized local ItemProviders for foreign classes
Declaring customized local ItemProviders for foreign classes [message #668030] Tue, 03 May 2011 13:03 Go to next message
Daniel Strueber is currently offline Daniel StrueberFriend
Messages: 14
Registered: March 2011
Junior Member
Hi everyone,

I have two metamodels, with one of them reusing several classes from the other. Let's call them A.ecore and B.ecore where B uses classes from A.
For A, customized edit/editor projects are existing.

Now, when I generate the edit project for B, A's edit project is referenced, providing the ItemProviderAdapterFactory with its ItemProviders for all classes from the A metamodel.
This is fine as long as I don't want to have seperate customized ItemProviders for the "A" classes in the "B" edit project - which unfortunately is exactly what I want to do.

I already created my own $AClass_ItemProviders in the B.edit project and, as a first notion, added them to the BItemProviderAdapterFactory. However, when I execute the B editor, the AItemProviderAdapterFactory will be preferred when determining the proper item provider, returning the item providers from A.edit.

How can I tell EMF.Edit to prefer the BItemProviderAdapterFactory?

[Updated on: Tue, 03 May 2011 13:45]

Report message to a moderator

Re: Declaring customized local ItemProviders for foreign classes [message #668051 is a reply to message #668030] Tue, 03 May 2011 14:17 Go to previous messageGo to next message
Daniel Strueber is currently offline Daniel StrueberFriend
Messages: 14
Registered: March 2011
Junior Member
Eventually, I stumbled across a hint to the proper solution in the EMF book:

I now created a seperate AItemProviderAdapterFactory that extends the original one but overrides the to-be-replaced ItemProviders with my own ones (which themself extend the original ItemProviders).

Then, I specified this new AItemProviderAdapterFactory as the one to be added to the ComposedAdapterFactory in the BEditor class. Seems to work!
Re: Declaring customized local ItemProviders for foreign classes [message #668536 is a reply to message #668030] Fri, 06 May 2011 07:00 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
Daniel,

Comments below.

Daniel Strueber wrote:
> Hi everyone,
>
> I have two metamodels, with one of them reusing several classes from
> the other. Let's call them A.ecore and B.ecore where B uses classes
> from A. For A, customized edit/editor projects are existing.
>
> Now, when I generate the edit project for B, A's edit project is
> referenced, providing the ItemProviderFactory with its ItemProviders
> for all classes from the A metamodel.
> This is fine as long as I don't want to have seperate customized
> ItemProviders for the "A" classes in the "B" edit project - which
> unfortunately is exactly what I want to do.
>
> I already created my own $AClass_ItemProviders in the B.edit project
> and, as a first notion, added them to the BItemProviderFactory.
Hmmm. Not sure I understand that B's factory will only create adapters
for instance of B's package not for instances of A's package. You'd
need a specialized AItemProviderAdapterFactory...
> However, when I execute the B editor, the AItemProviderFactory will be
> preferred when determining the proper item provider, returning the
> item providers from A.edit.
The composed adapter factory that's used finds registered factories as
needed...
>
> How can I tell EMF.Edit to prefer the BItemProviderFactory?
You'd need a factory already in the composed adapter factory that
indicates it's the factory for package A.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Using model generated with the editor
Next Topic:Inheritance nad feature maps
Goto Forum:
  


Current Time: Tue Apr 16 23:57:26 GMT 2024

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

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

Back to the top