[Xcore] Adding new super class to all classes in an EMF model [message #1695173] |
Tue, 12 May 2015 09:26  |
Eclipse User |
|
|
|
Hi,
currently I have a problem to find an easy way to modify an existing model.
We have different defined models based on EMF (Xcore).
Now a requirement is to add to all elements of a model attributes.
Therefore we already have defined an interface containing those.
Sample:
interface SampleA
{
contains resolving MyAttribute [] myAttribute
}
Goal is that all defined classes are having these myAttribute available, if possible without explicit extending it, as the model is very large and we have to touch a lot of elements.
First idea was to add the base class and its provider to the Genmodel annotation:
@GenModel(
... rootExtendsClass="package.myclass",
providerRootExtendsClass="package.myclassprovider)
Problem with that solution is that I'm able to see the entry in the editor, but I'm not able to use it. It's greyed out.
Is there something missing or another simple way existing to achieve such a constellation?
Fallback would be to add to all elements the extend SampleA...
Regards
Daniel
|
|
|
Re: [Xcore] Adding new super class to all classes in an EMF model [message #1695175 is a reply to message #1695173] |
Tue, 12 May 2015 09:38   |
Eclipse User |
|
|
|
Daniel,
Comments below.
On 12/05/2015 3:26 PM, Daniel K. wrote:
> Hi,
> currently I have a problem to find an easy way to modify an existing
> model.
> We have different defined models based on EMF (Xcore).
> Now a requirement is to add to all elements of a model attributes.
> Therefore we already have defined an interface containing those.
> Sample:
> interface SampleA
> {
> contains resolving MyAttribute [] myAttribute
> }
>
> Goal is that all defined classes are having these myAttribute
> available, if possible without explicit extending it, as the model is
> very large and we have to touch a lot of elements.
No, this is impossible.
>
> First idea was to add the base class and its provider to the Genmodel
> annotation:
> @GenModel(
> .. rootExtendsClass="package.myclass",
> providerRootExtendsClass="package.myclassprovider)
>
> Problem with that solution is that I'm able to see the entry in the
> editor, but I'm not able to use it. It's greyed out.
Which editor? These things should be fully qualified names of classes,
but a root extends class must be a class like EObjectImpl without any
explicitly modeled features.
>
> Is there something missing or another simple way existing to achieve
> such a constellation?
No, if you want modeled features they must be explicitly known in the
Ecore model itself and hence must be explicit in the Xcore model.
> Fallback would be to add to all elements the extend SampleA...
It's the only way.
>
> Regards
> Daniel
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06577 seconds