Home » Modeling » EMF » child creation extenders(multiple and nested)
child creation extenders [message #495173] |
Wed, 04 November 2009 01:04 |
Ray Kelm Messages: 20 Registered: July 2009 |
Junior Member |
|
|
I have a model which uses child creation extenders, and I was having some problems with it, so I reduced it down to the simplest form that I could, and I am still having the issue.
I have three separate model plug-in projects: test1, test2, and test3. I have left out all path info for brevity:
test1.ecore:
EPackage test1
..EClass Container
....EReference items : Item (containment=true, bounds=0..*)
..EClass Item (abstract=true, interface=true)
test2.ecore:
EPackage test2
..EClass ContainerItem -> Item
....EReference items : Item (containment=true, bounds=0..*)
Loaded resource test1.ecore
test3.ecore:
EPackage test3
..EClass OtherItem -> Item
Loaded resource test1.ecore
test1.genmodel:
..Child Creation Extenders=false
..Extensible Provider Factory=true
test2.genmodel:
..Child Creation Extenders=true
..Extensible Provider Factory=true
Referenced genmodel test1.genmodel
test3.genmodel:
..Child Creation Extenders=true
..Extensible Provider Factory=true
Referenced genmodel test1.genmodel
I then generate model, edit, and editor for test1, and model and edit for test2 and test3.
When I run the code, I create a new model file in the editor, and am able to add either ContainerItem or OtherItem in the top level container.
However, if I try to add a child to ContainerItem, the only type of item I can add is ContainerItem. It doesn't see the OtherItem definition.
Am I missing something in my configuration?
I can provide the project files if anyone is interested.
[Updated on: Wed, 04 November 2009 01:35] Report message to a moderator
|
|
| |
Re: child creation extenders [message #495351 is a reply to message #495173] |
Wed, 04 November 2009 15:39 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------090701090507020107030709
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Ray,
Does it sound like this?
https://bugs.eclipse.org/bugs/show_bug.cgi?id=274884
Try the workaround mentioned in that bug.
Ray Kelm wrote:
> I have a model which uses child creation extenders, and I was having
> some problems with it, so I reduced it down to the simplest form that
> I could, and I am still having the issue.
>
> I have three separate model plug-in projects: test1, test2, and test3.
> I have left out all path info for brevity:
>
> test1.ecore:
>
> EPackage test1
> .EClass Container
> ...EReference items : Item (containment=true, bounds=0..*)
> .EClass Item (abstract=true, interface=true)
>
> test2.ecore:
>
> EPackage test2
> .EClass ContainerItem -> Item
> ...EReference items : Item (containment=true, bounds=0..*)
> Loaded resource test1.ecore
>
> test3.ecore:
>
> EPackage test3
> .EClass OtherItem -> Item
> Loaded resource test1.ecore
>
> test1.genmodel:
>
> .Child Creation Extenders=false
> .Extensible Provider Factory=true
>
> test2.genmodel:
>
> .Child Creation Extenders=true
> .Extensible Provider Factory=true
> Referenced genmodel test1.genmodel
>
> test3.genmodel:
>
> .Child Creation Extenders=true
> .Extensible Provider Factory=true
> Referenced genmodel test1.genmodel
>
> I then generate model, edit, and editor for test1, and model and edit
> for test2 and test3.
>
> When I run the code, I create a new model file in the editor, and am
> able to add either ContainerItem or OtherItem in the top level container.
>
> However, if I try to add a child to ContainerItem, the only type of
> item I can add is ContainerItem. It doesn't see the OtherItem definition.
>
> Am I missing something in my configuration?
>
> I can provide the project files if anyone is interested.
>
--------------090701090507020107030709
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Ray,<br>
<br>
Does it sound like this?<br>
<blockquote><a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=274884">https://bugs.eclipse.org/bugs/show_bug.cgi?id=274884</a><br>
</blockquote>
Try the workaround mentioned in that bug.<br>
<br>
<br>
Ray Kelm wrote:
<blockquote cite="mid:hcqjuv$ol4$1@build.eclipse.org" type="cite">I
have a model which uses child creation extenders, and I was having some
problems with it, so I reduced it down to the simplest form that I
could, and I am still having the issue.
<br>
<br>
I have three separate model plug-in projects: test1, test2, and test3.
I have left out all path info for brevity:
<br>
<br>
test1.ecore:
<br>
<br>
EPackage test1
<br>
..EClass Container
<br>
....EReference items : Item (containment=true, bounds=0..*)
<br>
..EClass Item (abstract=true, interface=true)
<br>
<br>
test2.ecore:
<br>
<br>
EPackage test2
<br>
..EClass ContainerItem -> Item
<br>
....EReference items : Item (containment=true, bounds=0..*)
<br>
Loaded resource test1.ecore
<br>
<br>
test3.ecore:
<br>
<br>
EPackage test3
<br>
..EClass OtherItem -> Item
<br>
Loaded resource test1.ecore
<br>
<br>
test1.genmodel:
<br>
<br>
..Child Creation Extenders=false
<br>
..Extensible Provider Factory=true
<br>
<br>
test2.genmodel:
<br>
<br>
..Child Creation Extenders=true
<br>
..Extensible Provider Factory=true
<br>
Referenced genmodel test1.genmodel
<br>
<br>
test3.genmodel:
<br>
<br>
..Child Creation Extenders=true
<br>
..Extensible Provider Factory=true
<br>
Referenced genmodel test1.genmodel
<br>
<br>
I then generate model, edit, and editor for test1, and model and edit
for test2 and test3.
<br>
<br>
When I run the code, I create a new model file in the editor, and am
able to add either ContainerItem or OtherItem in the top level
container.
<br>
<br>
However, if I try to add a child to ContainerItem, the only type of
item I can add is ContainerItem. It doesn't see the OtherItem
definition.
<br>
<br>
Am I missing something in my configuration?
<br>
<br>
I can provide the project files if anyone is interested.
<br>
<br>
</blockquote>
</body>
</html>
--------------090701090507020107030709--
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| |
Re: child creation extenders [message #495478 is a reply to message #495351] |
Thu, 05 November 2009 01:56 |
Ray Kelm Messages: 20 Registered: July 2009 |
Junior Member |
|
|
I traced through the code a bit, and I think I know what is happening.
test1.ecore:
EClass Item (interface, abstract)
EClass Container
EReference items (0..*) to Item
test2.ecore:
EClass ContainerItem -> Item
EReference items (0..*) to Item
test3.ecore:
EClass OtherItem -> Item
The code responsible for returning the correct list of potential new children is In Test2ItemProviderAdapterFactory.getNewChildDescriptors().
When "Extensible Provider Factory" is true, the generated code tries to get extensions, but those that are registered against the test2 namespace.
When "Extensible Provider Factory" is false, it does not go look for extended items, merely calling ContainerItemItemProvider.collectNewChildDescriptors(), which only returns a single new child descriptor for creating a ContainerItem.
There is no place where it looks for other implementations of Item that could possibly be added as a child of ContainerItem.
I think the problem is that it dispatches on the type of the container object, rather than the type of the contained object.
So in ContainerItemItemProvider.collectNewChildDescriptors() it would need to look for extensions to the Item class, using the namespace of the EPackage that is associated with Item, rather than assuming that Item is part of the current EPackage.
So it's a bug, I think.
|
|
|
Re: child creation extenders [message #495561 is a reply to message #495478] |
Thu, 05 November 2009 11:08 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Ray,
As I mentioned in the bugzilla, I don't have time to manufacture test
cases from verbal instructions so please attach a representative example
and then I'll look at that.
Ray Kelm wrote:
> I traced through the code a bit, and I think I know what is happening.
>
> test1.ecore:
>
> EClass Item (interface, abstract)
> EClass Container
> EReference items (0..*) to Item
>
> test2.ecore:
>
> EClass ContainerItem -> Item
> EReference items (0..*) to Item
>
> test3.ecore:
>
> EClass OtherItem -> Item
>
> The code responsible for returning the correct list of potential new
> children is In Test2ItemProviderAdapterFactory.getNewChildDescriptors().
>
> When "Extensible Provider Factory" is true, the generated code tries
> to get extensions, but those that are registered against the test2
> namespace.
>
> When "Extensible Provider Factory" is false, it does not go look for
> extended items, merely calling
> ContainerItemItemProvider.collectNewChildDescriptors(), which only
> returns a single new child descriptor for creating a ContainerItem.
>
> There is no place where it looks for other implementations of Item
> that could possibly be added as a child of ContainerItem.
>
> I think the problem is that it dispatches on the type of the container
> object, rather than the type of the contained object.
>
> So in ContainerItemItemProvider.collectNewChildDescriptors() it would
> need to look for extensions to the Item class, using the namespace of
> the EPackage that is associated with Item, rather than assuming that
> Item is part of the current EPackage.
>
> So it's a bug, I think.
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Goto Forum:
Current Time: Tue Apr 23 12:17:04 GMT 2024
Powered by FUDForum. Page generated in 0.03271 seconds
|