Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » getChildrenFeatures generation in ItemProviderAdapter
getChildrenFeatures generation in ItemProviderAdapter [message #425391] Mon, 24 November 2008 10:44 Go to next message
Eclipse UserFriend
Originally posted by: swt.magellium.fr

Hello !

I have a problem when generating "edit" classes.
For containment features, a "getChildrenFeatures" method is generated,
which adds the containment features to a "childrenFeatures" member list.
But in some cases, this is not generated.

I didn't find any differences in my ecore files which could tell why it
is generated or not, so I looked at the generator source code, and found
that this method is generated when a feature is a "children" feature.
And a feature is a children feature when the following condition is true :
eReference.isContainment() &&
(getGenClass().isDocumentRoot() ?
getExtendedMetaData().getFeatureKind(eFeature) ==
ExtendedMetaData.ELEMENT_FEATURE :
!hasDelegateFeature())

I understand "eReference.isContainment()", but not the rest...
Can someone explain it to me ?

I just want to know why the "getChildrenFeatures" is not generated, or
more precisely, why "childrenFeatures" sometimes does not contain some
of the containment features...

The real problem behind this is that RemoveCommand becomes unexecutable
when the object to remove is contained (in it's container) by a feature
that is not part of this "childrenFeatures"...

Thanks in advance :)

Stephane
Re: getChildrenFeatures generation in ItemProviderAdapter [message #425395 is a reply to message #425391] Mon, 24 November 2008 13:38 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30903
Registered: July 2009
Senior Member
Stephane,

Comments below.

SWT wrote:
> Hello !
>
> I have a problem when generating "edit" classes.
> For containment features, a "getChildrenFeatures" method is generated,
> which adds the containment features to a "childrenFeatures" member list.
> But in some cases, this is not generated.
Hmmm...
>
> I didn't find any differences in my ecore files which could tell why
> it is generated or not, so I looked at the generator source code, and
> found that this method is generated when a feature is a "children"
> feature.
Note that the GenFeature's Children property must be set to true for
this, so you should look in the *.genmodel for this information.
> And a feature is a children feature when the following condition is
> true :
> eReference.isContainment() &&
> (getGenClass().isDocumentRoot() ?
> getExtendedMetaData().getFeatureKind(eFeature) ==
> ExtendedMetaData.ELEMENT_FEATURE :
> !hasDelegateFeature())
>
> I understand "eReference.isContainment()", but not the rest...
> Can someone explain it to me ?
This is just the algorithm for computing the initial state of the
GenFeature's getChildren. So containments should be children but not if
they delegate to some other feature and for document roots, only fro the
features corresponding to global elements declarations.
>
> I just want to know why the "getChildrenFeatures" is not generated, or
> more precisely, why "childrenFeatures" sometimes does not contain some
> of the containment features...
Maybe you've been changing your model? The GenFeature's Children
property doesn't change once the GenModel has been created the first time.
>
> The real problem behind this is that RemoveCommand becomes
> unexecutable when the object to remove is contained (in it's
> container) by a feature that is not part of this "childrenFeatures"...
>
> Thanks in advance :)
>
> Stephane
Re: getChildrenFeatures generation in ItemProviderAdapter [message #425398 is a reply to message #425395] Mon, 24 November 2008 14:01 Go to previous message
Eclipse UserFriend
Originally posted by: swt.magellium.fr

Ok, thank you once again Ed :)
The Children propery was set to false in the genmodel. Probably because
the feature wasn't the same when the genmodel was created (as you
supposed)...


Ed Merks wrote :
> Stephane,
>
> Comments below.
>
> SWT wrote:
>> Hello !
>>
>> I have a problem when generating "edit" classes.
>> For containment features, a "getChildrenFeatures" method is generated,
>> which adds the containment features to a "childrenFeatures" member list.
>> But in some cases, this is not generated.
> Hmmm...
>>
>> I didn't find any differences in my ecore files which could tell why
>> it is generated or not, so I looked at the generator source code, and
>> found that this method is generated when a feature is a "children"
>> feature.
> Note that the GenFeature's Children property must be set to true for
> this, so you should look in the *.genmodel for this information.
>> And a feature is a children feature when the following condition is
>> true :
>> eReference.isContainment() &&
>> (getGenClass().isDocumentRoot() ?
>> getExtendedMetaData().getFeatureKind(eFeature) ==
>> ExtendedMetaData.ELEMENT_FEATURE :
>> !hasDelegateFeature())
>>
>> I understand "eReference.isContainment()", but not the rest...
>> Can someone explain it to me ?
> This is just the algorithm for computing the initial state of the
> GenFeature's getChildren. So containments should be children but not if
> they delegate to some other feature and for document roots, only fro the
> features corresponding to global elements declarations.
>>
>> I just want to know why the "getChildrenFeatures" is not generated, or
>> more precisely, why "childrenFeatures" sometimes does not contain some
>> of the containment features...
> Maybe you've been changing your model? The GenFeature's Children
> property doesn't change once the GenModel has been created the first time.
>>
>> The real problem behind this is that RemoveCommand becomes
>> unexecutable when the object to remove is contained (in it's
>> container) by a feature that is not part of this "childrenFeatures"...
>>
>> Thanks in advance :)
>>
>> Stephane
Previous Topic:Named query problem
Next Topic:[Teneo] Trying to use the timestamp in a legacy database as the optimistic locking column
Goto Forum:
  


Current Time: Tue Feb 25 07:09:33 GMT 2020

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

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

Back to the top