Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Usage EMF models in E4 RCP(How to use the EMF adapter factory and notifications in an E4 RCP)
Usage EMF models in E4 RCP [message #1691037] Wed, 01 April 2015 19:08 Go to next message
Gernot Krause is currently offline Gernot KrauseFriend
Messages: 22
Registered: June 2014
Junior Member
Hi there!

I have an E4 RCP application that uses an EMF data model and I like to get some hints on how to use the EMF AdapterFactory in the application.

For example, should
a) every part create a new instance of an (Composed)AdapterFactory to be used in JFace viewers?
Or
b) is it better to set one instance into the application context and let it inject into each and every part?

If I would use multiple adapter factories (i.e. each part its own) what happens with notifications when one part changes an EMF object that is also displayed in another part? I know that each adapter (item provider) attached to the object is notified. But does each adapter factory create an separate item provider instance even if it has the same type as an already existing one?

If notifications are not shared between parts like that, would it be good to attach an content adapter to the root EMF model object and send the EMF notification objects to the E4 event bus (IEventBroker)?

Would appreciate any hints on this from your experience/practice.

Cheers,
Gernot.
Re: Usage EMF models in E4 RCP [message #1691065 is a reply to message #1691037] Thu, 02 April 2015 05:09 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33107
Registered: July 2009
Senior Member
Gernot,

EMF-specific comments below.

On 01/04/2015 9:08 PM, Gernot Krause wrote:
> Hi there!
>
> I have an E4 RCP application that uses an EMF data model and I like to
> get some hints on how to use the EMF AdapterFactory in the application.
>
> For example, should
> a) every part create a new instance of an (Composed)AdapterFactory to
> be used in JFace viewers?
That's not necessary.
> Or
> b) is it better to set one instance into the application context and
> let it inject into each and every part?
Yes, probably better.
>
> If I would use multiple adapter factories (i.e. each part its own)
> what happens with notifications when one part changes an EMF object
> that is also displayed in another part?
The changes are to the EObject and each adapter is notified.
> I know that each adapter (item provider) attached to the object is
> notified. But does each adapter factory create an separate item
> provider instance even if it has the same type as an already existing
> one?
Yes there would be multiple adapters, but note that adapters are (at
least by default) singletons, so n objects of type T will have a single
TItemProviderAdapter. So it's not as if you'll always end up with n * m
adapters, where m is the number of factory instances/views.
>
> If notifications are not shared between parts like that, would it be
> good to attach an content adapter to the root EMF model object and
> send the EMF notification objects to the E4 event bus (IEventBroker)?
The item provider adapters generally interact directly with the view to
update it, so no need to try to implement that again.
>
> Would appreciate any hints on this from your experience/practice.
>
> Cheers,
> Gernot.
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:change Context for @Inject
Next Topic:Problem with IEventBroker
Goto Forum:
  


Current Time: Tue Mar 19 08:40:30 GMT 2024

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

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

Back to the top