Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Xcore] Adding new super class to all classes in an EMF model
[Xcore] Adding new super class to all classes in an EMF model [message #1695173] Tue, 12 May 2015 13:26 Go to next message
Daniel K. is currently offline Daniel K.Friend
Messages: 14
Registered: August 2014
Location: Stuttgart
Junior Member
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 13:38 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30351
Registered: July 2009
Senior Member
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
Re: [Xcore] Adding new super class to all classes in an EMF model [message #1695181 is a reply to message #1695175] Tue, 12 May 2015 13:53 Go to previous messageGo to next message
Daniel K. is currently offline Daniel K.Friend
Messages: 14
Registered: August 2014
Location: Stuttgart
Junior Member
Hi,
the standard EMF Tree Editor.
But that answers my question that if we want to add modeled features we have to add it "manually".

Thanks for the fast reply.

Regards
Daniel

[Updated on: Wed, 13 May 2015 06:21]

Report message to a moderator

Re: [Xcore] Adding new super class to all classes in an EMF model [message #1695209 is a reply to message #1695181] Tue, 12 May 2015 16:07 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6494
Registered: July 2009
Senior Member
An Ecore-Model is an EMF-Model by itself you so you load the meta model,
modify it and save it back to disk.

Tom

On 12.05.15 15:53, Daniel K. wrote:
> Hi,
> the standard EMF Tree Editor.
> But that answers my question that if we want to add modeled features we
> have to add it "manualy".
>
> Thanks for the fast reply.
>
> Regards
> Daniel
Re: [Xcore] Adding new super class to all classes in an EMF model [message #1695211 is a reply to message #1695209] Tue, 12 May 2015 16:10 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6494
Registered: July 2009
Senior Member
.... oh i missed the xcore. So you have only .xcore files?
Tom

On 12.05.15 18:07, Tom Schindl wrote:
> An Ecore-Model is an EMF-Model by itself you so you load the meta model,
> modify it and save it back to disk.
>
> Tom
>
> On 12.05.15 15:53, Daniel K. wrote:
>> Hi,
>> the standard EMF Tree Editor.
>> But that answers my question that if we want to add modeled features we
>> have to add it "manualy".
>>
>> Thanks for the fast reply.
>>
>> Regards
>> Daniel
>
Re: [Xcore] Adding new super class to all classes in an EMF model [message #1695258 is a reply to message #1695211] Wed, 13 May 2015 06:21 Go to previous message
Daniel K. is currently offline Daniel K.Friend
Messages: 14
Registered: August 2014
Location: Stuttgart
Junior Member
Hi,
yes, we defined the model itself using xcore, which is our master source.

Regards
Previous Topic:Deadlock during EPackage initialization for cyclic package interdependencies
Next Topic:storing html values in xmi
Goto Forum:
  


Current Time: Sun Aug 18 21:45:34 GMT 2019

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

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

Back to the top