Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Using generated itemproviders from another plugin
Using generated itemproviders from another plugin [message #430934] Thu, 18 June 2009 10:07 Go to next message
Conor O'Mahony is currently offline Conor O'MahonyFriend
Messages: 108
Registered: July 2009
Senior Member
Hi,

I have an EMF model in one plugin, and the ecore is referencing another ecore in a different plugin,
i.e.
TypeA has a containment reference to TypeB which is in a different model.

plugin 1 (ecore 1)
TypeA
name: String
comment: String
...
references: TypeB(0..n)
....

plugin 2 (ecore 2)
TypeB
name: String
etc...


When I generate the model and edit code I can use it in my RCP application and can generate
instances of the model with instances of TypeB contained within an instance of TypeA.

However it does not automatically use the generated ItemProvider for TypeB - I have changed the
genmodel for TypeB to not show certain properties, but when looking at an instance of TypeB
contained in TypeA from within my application, all the properties are shown and are editable -
What is the best way for hooking in the ItemProvider for TypeB? do i need to modify the generated
code from ecore1 to manually reference the ItemProvider in plugin2? Or is there a better way of
doing all this?

Many thanks for your help,
Conor
Re: Using generated itemproviders from another plugin [message #430935 is a reply to message #430934] Thu, 18 June 2009 11:07 Go to previous message
Conor O'Mahony is currently offline Conor O'MahonyFriend
Messages: 108
Registered: July 2009
Senior Member
Hi,

Sorry I've found the answer for this,

I needed to add the 2nd model's ItemProviderAdapterFactory to the ComposedAdapterFactory used by the
application.

....
factories.add(new Model2ItemProviderAdapterFactory());
....
adapterFactory = new ComposedAdapterFactory(factories);

Regards,
Conor

Conor O'Mahony wrote:
> Hi,
>
> I have an EMF model in one plugin, and the ecore is referencing another
> ecore in a different plugin,
> i.e.
> TypeA has a containment reference to TypeB which is in a different model.
>
> plugin 1 (ecore 1)
> TypeA
> name: String
> comment: String
> ...
> references: TypeB(0..n)
> ....
>
> plugin 2 (ecore 2)
> TypeB
> name: String
> etc...
>
>
> When I generate the model and edit code I can use it in my RCP
> application and can generate instances of the model with instances of
> TypeB contained within an instance of TypeA.
>
> However it does not automatically use the generated ItemProvider for
> TypeB - I have changed the genmodel for TypeB to not show certain
> properties, but when looking at an instance of TypeB contained in TypeA
> from within my application, all the properties are shown and are editable -
> What is the best way for hooking in the ItemProvider for TypeB? do i
> need to modify the generated code from ecore1 to manually reference the
> ItemProvider in plugin2? Or is there a better way of doing all this?
>
> Many thanks for your help,
> Conor
Previous Topic:Reference from one model to another?
Next Topic:Default values for elements of simple types
Goto Forum:
  


Current Time: Fri Apr 26 01:04:12 GMT 2024

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

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

Back to the top