Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EAnnotation#getContents() and Ecore editor
EAnnotation#getContents() and Ecore editor [message #1410301] Wed, 20 August 2014 11:13 Go to next message
Paweł Doleciński is currently offline Paweł DolecińskiFriend
Messages: 44
Registered: January 2014
Member
Hi,

I found in several places that Ed recommends using getContents and getReferences methods from EAnnotation if something more sophisticated than string to string map is needed. And this is exactly what I need. I've got a Configuration EClass with plenty of subclasses to allow strong-typed model decoration.

While I can add references using Property panel, the problem occurs with adding Configuration instances to the contents attribute.

I would like to be able to create a new dynamic instance of Configuration EClass as a child of EAnnotation. Right now the existence of EAnnotation#contents feature is hidden in editor unless such an instance is already there.

Any ideas?
In my opinion would be nice to have "Create dynamic instance" as a child of EAnnotation already in Sample Ecore Model Editor, but maybe I am wrong and do not know something. I could also add this kind of extension in my plug-ins but I do not know if this is doable without extending the editor itself.

Cheers
Paweł
Re: EAnnotation#getContents() and Ecore editor [message #1410308 is a reply to message #1410301] Wed, 20 August 2014 11:34 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30352
Registered: July 2009
Senior Member
Paweł,

Comments below.

On 20/08/2014 1:13 PM, Paweł Doleciński wrote:
> Hi,
>
> I found in several places that Ed recommends using getContents and
> getReferences methods from EAnnotation if something more sophisticated
> than string to string map is needed. And this is exactly what I need.
> I've got a Configuration EClass with plenty of subclasses to allow
> strong-typed model decoration.
>
> While I can add references using Property panel, the problem occurs
> with adding Configuration instances to the contents attribute.
"the problem"?
> I would like to be able to create a new dynamic instance of
> Configuration EClass as a child of EAnnotation. Right now the
> existence of EAnnotation#contents feature is hidden in editor unless
> such an instance is already there.
Yes, because all possible objects from all registered models could be
added, so the menu would be completely unusable.
>
> Any ideas?
> In my opinion would be nice to have "Create dynamic instance" as a
> child of EAnnotation already in Sample Ecore Model Editor, but maybe I
> am wrong and do not know something. I could also add this kind of
> extension in my plug-ins but I do not know if this is doable without
> extending the editor itself.
You can certainly contribute object contribution actions (or do so via
commands and handlers). I would probably just live with drag and drop
support. If you have a resource with "template instances" for what you
need to create, you can drag and drop them into the Ecore editor...
>
> Cheers
> Paweł
>
Re: EAnnotation#getContents() and Ecore editor [message #1410318 is a reply to message #1410308] Wed, 20 August 2014 12:04 Go to previous messageGo to next message
Paweł Doleciński is currently offline Paweł DolecińskiFriend
Messages: 44
Registered: January 2014
Member
Hi Ed,

thanks for reply.

Drag and drop together with "template instances" resource is what I do currently and in a long term this is not an option. It is possible to develop models with custom configurations so that every plug-in with subset of configuration would need to provide such a template.
So that I've got a composite configuration and I am using "child creation extenders" in genmodel. In the end what I need is to create new EAnnatotion having composite configuration in it already. And for that I will go with menu contribution and it is completely fine.

Anyway, I think it would be nice to have "Add new dynamic instance" in EAnnation context menu. For sure having a menu with all possible objects from registered models would be unusable, but a dialog with filter could be a viable solution.

Cheers
Paweł

Re: EAnnotation#getContents() and Ecore editor [message #1410326 is a reply to message #1410318] Wed, 20 August 2014 12:39 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30352
Registered: July 2009
Senior Member
Paweł,

I think with registered menu contributions one can provide very focused
actions/commands that help create fully configured annotations with
contained objects of whatever sort (perhaps even bringing up a wizard to
populate the information), ensuring that it's creating something fully
appropriate for the selected object. Doing this in some generic way,
i.e., offering hundreds or even thousands of possible types of child
object can't possibility compete with a carefully designed solution...


On 20/08/2014 2:04 PM, Paweł Doleciński wrote:
> Hi Ed,
>
> thanks for reply.
>
> Drag and drop together with "template instances" resource is what I do
> currently and in a long term this is not an option. It is possible to
> develop models with custom configurations so that every plug-in with
> subset of configuration would need to provide such a template. So that
> I've got a composite configuration and I am using "child creation
> extenders" in genmodel. In the end what I need is to create new
> EAnnatotion having composite configuration in it already. And for that
> I will go with menu contribution and it is completely fine.
>
> Anyway, I think it would be nice to have "Add new dynamic instance" in
> EAnnation context menu. For sure having a menu with all possible
> objects from registered models would be unusable, but a dialog with
> filter could be a viable solution.
> Cheers
> Paweł
>
>
Re: EAnnotation#getContents() and Ecore editor [message #1410332 is a reply to message #1410326] Wed, 20 August 2014 12:52 Go to previous message
Paweł Doleciński is currently offline Paweł DolecińskiFriend
Messages: 44
Registered: January 2014
Member
Ed,

alright, I have to admit you are completely right about this.

Thanks for help and suggestions.
Previous Topic:How to use from an Android application features implemented in EMF project?
Next Topic:[Compare] How to customize EMF compare mechanism - Match Phase?
Goto Forum:
  


Current Time: Mon Aug 19 13:12:23 GMT 2019

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

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

Back to the top