Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [EOL, Ecore2GMF.eol] How duplicate GmfMap!NodeMapping?
icon5.gif  [EOL, Ecore2GMF.eol] How duplicate GmfMap!NodeMapping? [message #512656] Fri, 05 February 2010 15:06 Go to next message
Alvaro Jimenez Rielo is currently offline Alvaro Jimenez Rielo
Messages: 41
Registered: July 2009
Location: Rey Juan Carlos Universit...
Member
Hello everyone!

I'm developing a GMF editor using EuGENia (Ecore2GMF.eol) and I need to duplicate some complex NodeMapping (they include compartments, childreferences and labels).

I have already read this post about it: http://www.eclipse.org/forums/index.php?t=msg&th=125673& amp; amp;start=0&

but I have some NodeMappings that are very complex to copy their elements one-by-one,so: Are there another option to duplicate a GmfMap!NodeMapping (or either element)?


Thanks,
Álvaro Jiménez Rielo
Student (Rey Juan Carlos University - Madrid)

[Updated on: Fri, 05 February 2010 15:44]

Report message to a moderator

Re: [EOL, Ecore2GMF.eol] How duplicate GmfMap!NodeMapping? [message #512668 is a reply to message #512656] Fri, 05 February 2010 18:04 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
Hi Alvaro,

Are you creating these NodeMappings programmatically? If so, you may
want to define an operation for each one of them so that you can call
them multiple times. e.g.

operation createNodeMapping() : GmfMap!NodeMapping {
var nm : new GmfMap!NodeMapping;
...
// Populate the node mapping here
...
return nm;
}

Would that be an option?

Cheers,
Dimitris

ajimenezr wrote:
> Hello everyone!
>
> I'm developing a GMF editor using EuGENia (Ecore2GMF.eol). I need to
> duplicate some complex NodeMapping (they include compartments,
> childreferences and labels).
> I have already read this post about it:
> http://www.eclipse.org/forums/index.php?t=msg&th=125673& amp;start=0&
>
> but I have some NodeMappings that are very complex to copy their
> elements one-by-one,so: Are there another option to duplicate a
> GmfMap!NodeMapping (or either element)?
>
>
> Thanks, Álvaro Jiménez Rielo
> Student (Rey Juan Carlos University - Madrid)
Re: [EOL, Ecore2GMF.eol] How duplicate GmfMap!NodeMapping? [message #512672 is a reply to message #512668] Fri, 05 February 2010 19:25 Go to previous messageGo to next message
Alvaro Jimenez Rielo is currently offline Alvaro Jimenez Rielo
Messages: 41
Registered: July 2009
Location: Rey Juan Carlos Universit...
Member
Hi Dimitrios,

Could be a great option Very Happy .
Now, I have created programmatically (using EOL) these NodeMappings,
so I will put the code in operations like you say.

Anyway, I think that EOL should allow cloning model elements
because there are a lot of them that it have been created from
Ecore's annotation and not using code. Perhaps in the future?


Thanks,

Álvaro Jiménez Rielo
Student (Rey Juan Carlos University - Madrid)

[Updated on: Fri, 05 February 2010 19:33]

Report message to a moderator

Re: [EOL, Ecore2GMF.eol] How duplicate GmfMap!NodeMapping? [message #512681 is a reply to message #512672] Fri, 05 February 2010 22:22 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
Hi Alvaro,

I think you're right. I'll put it in my todo list for 0.8.9.

Cheers,
Dimitris

ajimenezr wrote:
> Hi Dimitrios,
>
> Could be a great option :d . Now, I have created programmatically
> (using EOL) these NodeMappings, so I will put the code in operations
> like you say.
>
> Anyway, I think that EOL should allow cloning model elements because
> there are a lot of them that it have been created from Ecore's
> annotation and not using code. Perhaps in the future?
>
>
> Thanks,
> Álvaro Jiménez Rielo
> Student (Rey Juan Carlos University - Madrid)
Re: [EOL, Ecore2GMF.eol] How duplicate GmfMap!NodeMapping? [message #512690 is a reply to message #512681] Sat, 06 February 2010 04:59 Go to previous messageGo to next message
Alvaro Jimenez Rielo is currently offline Alvaro Jimenez Rielo
Messages: 41
Registered: July 2009
Location: Rey Juan Carlos Universit...
Member
Hi Dimitris,

Yesterday, I didn't see the code and I though that the NodeMappings were created
programmatically, but it's not.
These NodeMappings are created from Ecore
(by "Generate GMF tool, graph and map models" ) and modified programmatically
so I can´t do what you said in the previous post. Sad


Cheers,
Álvaro
Re: [EOL, Ecore2GMF.eol] How duplicate GmfMap!NodeMapping? [message #512691 is a reply to message #512690] Sat, 06 February 2010 05:58 Go to previous messageGo to next message
Alvaro Jimenez Rielo is currently offline Alvaro Jimenez Rielo
Messages: 41
Registered: July 2009
Location: Rey Juan Carlos Universit...
Member
I have already solved this problem using this operation:

operation createFunctionMapping(option:String):GmfMap!NodeMapping{

var FunctionModel=ECore!EClass.all.selectOne(n|n.name='Function' );
var FunctionMapping;
if(option=='1'){
--get NodeMapping created from Ecore
FunctionMapping = GmfMap!NodeMapping.selectOne(n|n.domainMetaElement.name='Fun ction');
}else{
--create New NodeMapping
}

--Rest of code...

return FunctionMapping;
}

Álvaro

[Updated on: Sat, 06 February 2010 06:00]

Report message to a moderator

Re: [EOL, Ecore2GMF.eol] How duplicate GmfMap!NodeMapping? [message #512743 is a reply to message #512691] Sat, 06 February 2010 20:01 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
Hi Alvaro,

Great! Thanks for the update.

Cheers,
Dimitris

ajimenezr wrote:
> I have already solved this problem using this operation:
>
> operation createFunctionMapping(option:String):GmfMap!NodeMapping{
>
> var FunctionModel=ECore!EClass.all.selectOne(n|n.name='Function' );
> var FunctionMapping;
> if(option=='1'){
> --get NodeMapping created from Ecore
> FunctionMapping =
> GmfMap!NodeMapping.selectOne(n|n.domainMetaElement.name='Fun ction');
> }else{
> --create New NodeMapping
> }
>
> --Rest of code...
>
> return FunctionMapping;
> }
>
>
Re: [EOL, Ecore2GMF.eol] How duplicate GmfMap!NodeMapping? [message #512940 is a reply to message #512681] Mon, 08 February 2010 07:01 Go to previous message
Steffen Zschaler is currently offline Steffen Zschaler
Messages: 228
Registered: July 2009
Senior Member
Hi,

Can't you write a generic clone function that takes two EObjects that
are instances of the same EClass and uses the EClass to traverse all
features and copy their contents from EObject 1 to EObject 2?

Steffen

On 06/02/2010 03:22, Dimitris Kolovos wrote:
> Hi Alvaro,
>
> I think you're right. I'll put it in my todo list for 0.8.9.
>
> Cheers,
> Dimitris
>
> ajimenezr wrote:
>> Hi Dimitrios,
>>
>> Could be a great option :d . Now, I have created programmatically
>> (using EOL) these NodeMappings, so I will put the code in operations
>> like you say.
>>
>> Anyway, I think that EOL should allow cloning model elements because
>> there are a lot of them that it have been created from Ecore's
>> annotation and not using code. Perhaps in the future?
>>
>>
>> Thanks,
>> Álvaro Jiménez Rielo
>> Student (Rey Juan Carlos University - Madrid)
Re: [EOL, Ecore2GMF.eol] How duplicate GmfMap!NodeMapping? [message #585768 is a reply to message #512668] Fri, 05 February 2010 19:25 Go to previous message
Alvaro Jimenez Rielo is currently offline Alvaro Jimenez Rielo
Messages: 41
Registered: July 2009
Location: Rey Juan Carlos Universit...
Member
Hi Dimitrios,

Could be a great option :d . Now, I have created programmatically (using EOL) these NodeMappings, so I will put the code in operations like you say.

Anyway, I think that EOL should allow cloning model elements because there are a lot of them that it have been created from Ecore's annotation and not using code. Perhaps in the future?


Thanks,

Álvaro Jiménez Rielo
Student (Rey Juan Carlos University - Madrid)
Re: [EOL, Ecore2GMF.eol] How duplicate GmfMap!NodeMapping? [message #585779 is a reply to message #585768] Fri, 05 February 2010 22:22 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
Hi Alvaro,

I think you're right. I'll put it in my todo list for 0.8.9.

Cheers,
Dimitris

ajimenezr wrote:
> Hi Dimitrios,
>
> Could be a great option :d . Now, I have created programmatically
> (using EOL) these NodeMappings, so I will put the code in operations
> like you say.
>
> Anyway, I think that EOL should allow cloning model elements because
> there are a lot of them that it have been created from Ecore's
> annotation and not using code. Perhaps in the future?
>
>
> Thanks,
> Álvaro Jiménez Rielo
> Student (Rey Juan Carlos University - Madrid)
Re: [EOL, Ecore2GMF.eol] How duplicate GmfMap!NodeMapping? [message #585792 is a reply to message #512681] Sat, 06 February 2010 04:59 Go to previous message
Alvaro Jimenez Rielo is currently offline Alvaro Jimenez Rielo
Messages: 41
Registered: July 2009
Location: Rey Juan Carlos Universit...
Member
Hi Dimitris,

Yesterday, I didn't see the code and I though that the NodeMappings were created
programmatically, but it's not.
These NodeMappings are created from Ecore
(by "Generate GMF tool, graph and map models" ) and modified programmatically
so I can´t do what you said in the previous post. :(


Cheers,
Álvaro
Re: [EOL, Ecore2GMF.eol] How duplicate GmfMap!NodeMapping? [message #585806 is a reply to message #585792] Sat, 06 February 2010 05:59 Go to previous message
Alvaro Jimenez Rielo is currently offline Alvaro Jimenez Rielo
Messages: 41
Registered: July 2009
Location: Rey Juan Carlos Universit...
Member
I have already solved this problem using this operation:

operation createFunctionMapping(option:String):GmfMap!NodeMapping{

var FunctionModel=ECore!EClass.all.selectOne(n|n.name='Function' );
var FunctionMapping;
if(option=='1'){
--get NodeMapping created from Ecore
FunctionMapping = GmfMap!NodeMapping.selectOne(n|n.domainMetaElement.name='Fun ction');
}else{
--create New NodeMapping
}

--Rest of code...

return FunctionMapping;
}
Re: [EOL, Ecore2GMF.eol] How duplicate GmfMap!NodeMapping? [message #585827 is a reply to message #585806] Sat, 06 February 2010 20:01 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
Hi Alvaro,

Great! Thanks for the update.

Cheers,
Dimitris

ajimenezr wrote:
> I have already solved this problem using this operation:
>
> operation createFunctionMapping(option:String):GmfMap!NodeMapping{
>
> var FunctionModel=ECore!EClass.all.selectOne(n|n.name='Function' );
> var FunctionMapping;
> if(option=='1'){
> --get NodeMapping created from Ecore
> FunctionMapping =
> GmfMap!NodeMapping.selectOne(n|n.domainMetaElement.name='Fun ction');
> }else{
> --create New NodeMapping
> }
>
> --Rest of code...
>
> return FunctionMapping;
> }
>
>
Re: [EOL, Ecore2GMF.eol] How duplicate GmfMap!NodeMapping? [message #585893 is a reply to message #512681] Mon, 08 February 2010 07:01 Go to previous message
Steffen Zschaler is currently offline Steffen Zschaler
Messages: 228
Registered: July 2009
Senior Member
Hi,

Can't you write a generic clone function that takes two EObjects that
are instances of the same EClass and uses the EClass to traverse all
features and copy their contents from EObject 1 to EObject 2?

Steffen

On 06/02/2010 03:22, Dimitris Kolovos wrote:
> Hi Alvaro,
>
> I think you're right. I'll put it in my todo list for 0.8.9.
>
> Cheers,
> Dimitris
>
> ajimenezr wrote:
>> Hi Dimitrios,
>>
>> Could be a great option :d . Now, I have created programmatically
>> (using EOL) these NodeMappings, so I will put the code in operations
>> like you say.
>>
>> Anyway, I think that EOL should allow cloning model elements because
>> there are a lot of them that it have been created from Ecore's
>> annotation and not using code. Perhaps in the future?
>>
>>
>> Thanks,
>> Álvaro Jiménez Rielo
>> Student (Rey Juan Carlos University - Madrid)
Previous Topic:[EUGENIA] Different types of diagrams like UML2 Tools
Next Topic:problem with creation of phantom nodes
Goto Forum:
  


Current Time: Sat Aug 23 09:26:35 EDT 2014

Powered by FUDForum. Page generated in 0.02578 seconds