Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Issue with EMF editors and multiple genmodels/plugins (ChildCreationExtenders)
Issue with EMF editors and multiple genmodels/plugins (ChildCreationExtenders) [message #722087] Sun, 04 September 2011 11:31 Go to next message
jakob is currently offline jakobFriend
Messages: 5
Registered: July 2011
Junior Member
Edit: The two following posts better describe the actual example that I'm having problems with.

Hello,

First, excuse the URLs in the post. I havn't posted enough messages on this forum to be able to use links and images in my posts. Therefore, to see the images, manually insert www. in front of the URL.

I have an issue with EMF, when I try to generate code from different .genmodels to different plugins, and then try to generate editors which work with all the generated plugins.

I can get it to work in some cases, but there seems to be some bugs which make it impossible to do the way I want to.

First, let me describe an example that works. I have the following genmodel (based on an .ecore-model):
student.dtu.dk/~s062399/coreworks.PNG

This an abstract Element class, and a Folder, which is an Element, and can contain a list of Elements. When I generate code from this, I get as expected an editor, where I can create folders within folders.

I have set the property Extensible Provider Factory to true, so that I can extend this model in other models.

I then have another genmodel, which defines another type of Element (an Item):
student.dtu.dk/~s062399/specworks.png
As you can see, I have set Child Creation Extenders to true, so when I generate the model and edit for this genmodel, I get the ability to also create Items within Folders in my editor.

So far, so good.

The issue comes when I move the Folder into a package of its own. The first genmodel then becomes this:
student.dtu.dk/~s062399/coreworksnot.PNG

The second genmodel (with items) is not changed.

Now, when I generate all the code and start the application, in the generated editor, I can only create folders, and not Items.

I don't know if this is related to bug 274884 (bugs.eclipse.org/bugs/show_bug.cgi?id=274884), but I cannot get the workaround described in that bugreport to work.

Has anyone experienced this or something similar, and come up with a solution? Any help or comments would be much appreciated.

[Updated on: Sun, 04 September 2011 12:11]

Report message to a moderator

Re: Issue with EMF editors and multiple genmodels/plugins (ChildCreationExtenders) [message #722092 is a reply to message #722087] Sun, 04 September 2011 12:06 Go to previous messageGo to next message
jakob is currently offline jakobFriend
Messages: 5
Registered: July 2011
Junior Member
Correction to my above post. I can get that example to work, but if I make the example a bit more advanced, I can no longer get it to work.

The situation where I can not get the editor to allow creation of Items is when the core genmodel is this:

EPackage Core
{
  EPackage Folder
  {
    EClass Folder -> Group
  }
  EPackage Element
  {
    EPackage Group
    {
      EClass Group -> Element
      {
        EReference contents -> [0..*] Element
      }
    }
    EClass Element
  }
}


and my extension genmodel is like this:

EPackage Specification
{
  EClass Item -> Element
}

Re: Issue with EMF editors and multiple genmodels/plugins (ChildCreationExtenders) [message #722094 is a reply to message #722092] Sun, 04 September 2011 12:09 Go to previous messageGo to next message
jakob is currently offline jakobFriend
Messages: 5
Registered: July 2011
Junior Member
To clarify what I have tried to do to get it to work:

All packages in the core.genmodel have the Extensible Provider Factory = true. The Specification package in specification.genmodel has Child Creation Extenders = true. I have modified specification.genmodel to set the usedPackages as follows:
usedGenPackages="core.genmodel#//core core.genmodel#//element core.genmodel#//group core.genmodel#//folder"


Generating everything from scratch (model, edit and editor for core, model and edit for specification) gives an editor where I can only create Folders inside Folders, and not Items.
Re: Issue with EMF editors and multiple genmodels/plugins (ChildCreationExtenders) [message #722143 is a reply to message #722087] Sun, 04 September 2011 16:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
I'd need an example that I didn't need to create from a description.
I.e., minimally the Ecore files involved. It wouldn't suprise me if the
issue is caused purely by nested packages; I very much dislike them
(syntactic rat poison) because there's always yet another problem
specific to them. Can you reproduce the problem without nested packages
involved? If not, I suggest you use that approach instead.


On 04/09/2011 4:31 AM, jakob wrote:
> Hello,
>
> First, excuse the URLs in the post. I havn't posted enough messages on
> this forum to be able to use links and images in my posts. Therefore,
> to see the images, manually insert www. in front of the URL.
>
> I have an issue with EMF, when I try to generate code from different
> .genmodels to different plugins, and then try to generate editors
> which work with all the generated plugins.
>
> I can get it to work in some cases, but there seems to be some bugs
> which make it impossible to do the way I want to.
>
> First, let me describe an example that works. I have the following
> genmodel (based on an .ecore-model):
> student.dtu.dk/~s062399/coreworks.PNG
>
> This an abstract Element class, and a Folder, which is an Element, and
> can contain a list of Elements. When I generate code from this, I get
> as expected an editor, where I can create folders within folders.
>
> I have set the property Extensible Provider Factory to true, so that I
> can extend this model in other models.
>
> I then have another genmodel, which defines another type of Element
> (an Item):
> student.dtu.dk/~s062399/specworks.png
> As you can see, I have set Child Creation Extenders to true, so when I
> generate the model and edit for this genmodel, I get the ability to
> also create Items within Folders in my editor.
>
> So far, so good.
>
> The issue comes when I move the Folder into a package of its own. The
> first genmodel then becomes this:
> student.dtu.dk/~s062399/coreworksnot.PNG
>
> The second genmodel (with items) is not changed.
>
> Now, when I generate all the code and start the application, in the
> generated editor, I can only create folders, and not Items.
>
> I don't know if this is related to bug 274884
> (bugs.eclipse.org/bugs/show_bug.cgi?id=274884), but I cannot get the
> workaround described in that bugreport to work.
>
> Has anyone experienced this or something similar, and come up with a
> solution? Any help or comments would be much appreciated.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Issue with EMF editors and multiple genmodels/plugins (ChildCreationExtenders) [message #722145 is a reply to message #722143] Sun, 04 September 2011 17:23 Go to previous messageGo to next message
jakob is currently offline jakobFriend
Messages: 5
Registered: July 2011
Junior Member
Thank you for your response, Ed.

Attached is a zip with two .ecore models and the two .genmodels created from these.
I have removed nested packages, so in the core model, it's three packages on the same level, one containing abstract class Element, one containing abstract class Group (supertype Element, and has a reference to Element) and one containing class Folder (supertype Group).

In the second model (specification.ecore), it's just a class Item (supertype Element), which is the one to be included in the editor.


A thing to note is that if Folder and Group are in the same package, it works, but if they are in different packages, it doesn't. No matter if they are in the same package or not, in the provider adapter factory for the Item-class, a GroupChildCreationExtender is created. I'm wondering if this is the problem, since Group is the abstract class, and Folder is the class being instantiated in the editor.
  • Attachment: model.zip
    (Size: 2.22KB, Downloaded 134 times)
Re: Issue with EMF editors and multiple genmodels/plugins (ChildCreationExtenders) [message #722738 is a reply to message #722145] Tue, 06 September 2011 15:29 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
The second declaration (for the folder package) is missing form the
plugin.xml for the extender.<br>
<br>
<small>&nbsp;&nbsp; &lt;extension
point="org.eclipse.emf.edit.childCreationExtenders"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;extender<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uri="group"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
class="specification.provider.SpecificationItemProviderAdapterFactory$GroupChildCreationExtender"/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;extender<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uri="folder"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
class="specification.provider.SpecificationItemProviderAdapterFactory$GroupChildCreationExtender"/&gt;<br>
&nbsp;&nbsp; &lt;/extension&gt;</small><br>
<br>
Please open a bugzilla with your example and as a workaround add
that declaration manually.<br>
<br>
<br>
On 04/09/2011 10:23 AM, jakob wrote:
<blockquote cite="mid:j40bhh$22i$1@news.eclipse.org" type="cite">
<pre wrap="">Thank you for your response, Ed.

Attached is a zip with two .ecore models and the two .genmodels created from these.
I have removed nested packages, so in the core model, it's three packages on the same level, one containing abstract class Element, one containing abstract class Group (supertype Element, and has a reference to Element) and one containing class Folder (supertype Group).

In the second model (specification.ecore), it's just a class Item (supertype Element), which is the one to be included in the editor.


A thing to note is that if Folder and Group are in the same package, it works, but if they are in different packages, it doesn't. No matter if they are in the same package or not, in the provider adapter factory for the Item-class, a GroupChildCreationExtender is created. I'm wondering if this is the problem, since Group is the abstract class, and Folder is the class being instantiated in the editor.
</pre>
</blockquote>
</body>
</html>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Setting Lazy = true?
Next Topic:EAnnotation not saved
Goto Forum:
  


Current Time: Thu Apr 25 12:12:43 GMT 2024

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

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

Back to the top