getChildrenFeatures generation in ItemProviderAdapter [message #425391] |
Mon, 24 November 2008 10:44 |
Eclipse User |
|
|
|
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 |
Ed Merks Messages: 33133 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
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: getChildrenFeatures generation in ItemProviderAdapter [message #425398 is a reply to message #425395] |
Mon, 24 November 2008 14:01 |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.02037 seconds