Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » ECore2GMF.eol: How to access/change node in GmfMap
ECore2GMF.eol: How to access/change node in GmfMap [message #497055] Thu, 12 November 2009 11:45 Go to next message
Christoph Wienands is currently offline Christoph WienandsFriend
Messages: 55
Registered: July 2009
Member
I am currently trying to change an attribute value of a node in GmfMap. I have some trouble mapping the information given in "Polishing your GMF editor" (about gmfgraph) to the gmfmap.

I attached an image that shows the node that I am trying to address. I am confused about how to create the node matching expression. Is that based on the structure that I see in the EMF-based editor, or is it based on the physical structure in the underlying model file (in the case of gmfmap, there is a great difference in the hierarchies between what you see and what is saved). Furthermore, the node I need to select does not have an easily identifiable property, such as 'Name'. The second attached image shows the property that I need to change.

Any help is greatly appreciated.

Thanks, Christoph

PS: Once I have solved this, I will submit a feature request to enable diagram partitioning with super and subdiagrams of same type.
Re: ECore2GMF.eol: How to access/change node in GmfMap [message #497056 is a reply to message #497055] Thu, 12 November 2009 11:52 Go to previous messageGo to next message
Christoph Wienands is currently offline Christoph WienandsFriend
Messages: 55
Registered: July 2009
Member
Hmm, I just realized that my file attachments got lost. Feature seems to be broken.

So the hierarchy in gmfmap looks like this (the last node is the one I'm trying to address):
-Mapping
-Top Node Reference <states:CompartmentState/CompartmentState>
-Node Mapping <CompartmentState/CompartmentState>
-Child Reference <submachine:PartitioningState/PartitioningState>
-Node Mapping <PartitioningState/PartitioningState>

The attribute I would like to change is the 'Related Diagrams' property in the 'Misc' group. I need to set it to 'Canvas Mapping' (in the raw XML this is shown as '//@diagram').

Hope this is enough information.

Thanks, Christoph
Re: ECore2GMF.eol: How to access/change node in GmfMap [message #497059 is a reply to message #497055] Thu, 12 November 2009 11:52 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Christoph,

Unfortunately the images haven't made it. Are you using the web
interface or an NNTP client?

Cheers,
Dimitris

Christoph Wienands wrote:
> I am currently trying to change an attribute value of a node in GmfMap.
> I have some trouble mapping the information given in "Polishing your GMF
> editor" (about gmfgraph) to the gmfmap.
>
> I attached an image that shows the node that I am trying to address. I
> am confused about how to create the node matching expression. Is that
> based on the structure that I see in the EMF-based editor, or is it
> based on the physical structure in the underlying model file (in the
> case of gmfmap, there is a great difference in the hierarchies between
> what you see and what is saved). Furthermore, the node I need to select
> does not have an easily identifiable property, such as 'Name'. The
> second attached image shows the property that I need to change.
>
> Any help is greatly appreciated.
>
> Thanks, Christoph
>
> PS: Once I have solved this, I will submit a feature request to enable
> diagram partitioning with super and subdiagrams of same type.


--
Spread the word: http://www.eclipse.org/gmt/epsilon/spreadtheword
Follow Epsilon on Twitter: http://twitter.com/epsilonews
Re: ECore2GMF.eol: How to access/change node in GmfMap [message #497062 is a reply to message #497056] Thu, 12 November 2009 12:01 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Christoph,

You could use the name of the domainMetaElement of the mapping to
identify it. e.g. something like:

var partitioningStateNodeMapping =
GmfMap!NodeMapping.all.selectOne(nm|nm.domainMetaElement.nam e =
"PartitioningState");

Cheers,
Dimitris

Christoph Wienands wrote:
> Hmm, I just realized that my file attachments got lost. Feature seems to
> be broken.
>
> So the hierarchy in gmfmap looks like this (the last node is the one I'm
> trying to address):
> -Mapping
> -Top Node Reference <states:CompartmentState/CompartmentState>
> -Node Mapping <CompartmentState/CompartmentState>
> -Child Reference <submachine:PartitioningState/PartitioningState>
> -Node Mapping <PartitioningState/PartitioningState>
>
> The attribute I would like to change is the 'Related Diagrams' property
> in the 'Misc' group. I need to set it to 'Canvas Mapping' (in the raw
> XML this is shown as '//@diagram').
>
> Hope this is enough information.
>
> Thanks, Christoph


--
Spread the word: http://www.eclipse.org/gmt/epsilon/spreadtheword
Follow Epsilon on Twitter: http://twitter.com/epsilonews
Re: ECore2GMF.eol: How to access/change node in GmfMap [message #499126 is a reply to message #497062] Thu, 19 November 2009 23:53 Go to previous messageGo to next message
Christoph Wienands is currently offline Christoph WienandsFriend
Messages: 55
Registered: July 2009
Member
Hey Dimitrios,

that already got me further. So here is what I have right now:

var nodeMapping := GmfMap!NodeMapping.all.selectOne(nm|nm.domainMetaElement.name = "PartitioningState");
var canvasMapping := GmfMap!CanvasMapping.all.first();
nodeMapping.relatedDiagrams := canvasMapping;


Unfortunately, the last line crashes because the canvasMapping cannot be assigned to the nodeMapping's relatedDiagram attribute. In the gmfmap XML, this is what the output should be:

<ownedChild relatedDiagrams="//@diagram">


I confirmed that the referenced @diagram node is truly a CanvasMapping type. I also confirmed that nodeMapping.relatedDiagrams is valid (it works if I assign 'null').

Any idea about how to get the CanvasMapping into the relatedDiagrams attribute?

Thanks, Christoph

PS: If I get this working, I'll add it to the diagram partitioning enhancement request that I submitted.
Re: ECore2GMF.eol: How to access/change node in GmfMap [message #499128 is a reply to message #497055] Fri, 20 November 2009 00:50 Go to previous message
Christoph Wienands is currently offline Christoph WienandsFriend
Messages: 55
Registered: July 2009
Member
Never mind. I finally discovered the println feature in EOL and figured out that the nodeMapping.relatedDiagrams attribute is in fact an EolCollectionType object. Now don't ask me how a collection is stuffed into an XML attribute at the file level (seems counter-intuitive to me), but I finally got this code here working:

var nodeMapping := GmfMap!NodeMapping.all.selectOne(nm|nm.domainMetaElement.name = "PartitioningState");
var canvasMapping := GmfMap!CanvasMapping.all.first();
nodeMapping.relatedDiagrams.add(canvasMapping);

Christoph
Re: ECore2GMF.eol: How to access/change node in GmfMap [message #582781 is a reply to message #497056] Thu, 12 November 2009 12:01 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Christoph,

You could use the name of the domainMetaElement of the mapping to
identify it. e.g. something like:

var partitioningStateNodeMapping =
GmfMap!NodeMapping.all.selectOne(nm|nm.domainMetaElement.nam e =
"PartitioningState");

Cheers,
Dimitris

Christoph Wienands wrote:
> Hmm, I just realized that my file attachments got lost. Feature seems to
> be broken.
>
> So the hierarchy in gmfmap looks like this (the last node is the one I'm
> trying to address):
> -Mapping
> -Top Node Reference <states:CompartmentState/CompartmentState>
> -Node Mapping <CompartmentState/CompartmentState>
> -Child Reference <submachine:PartitioningState/PartitioningState>
> -Node Mapping <PartitioningState/PartitioningState>
>
> The attribute I would like to change is the 'Related Diagrams' property
> in the 'Misc' group. I need to set it to 'Canvas Mapping' (in the raw
> XML this is shown as '//@diagram').
>
> Hope this is enough information.
>
> Thanks, Christoph


--
Spread the word: http://www.eclipse.org/gmt/epsilon/spreadtheword
Follow Epsilon on Twitter: http://twitter.com/epsilonews
Re: ECore2GMF.eol: How to access/change node in GmfMap [message #583059 is a reply to message #497062] Thu, 19 November 2009 23:53 Go to previous message
Christoph Wienands is currently offline Christoph WienandsFriend
Messages: 55
Registered: July 2009
Member
Hey Dimitrios,

that already got me further. So here is what I have right now:

var nodeMapping := GmfMap!NodeMapping.all.selectOne(nm|nm.domainMetaElement.nam e = "PartitioningState");
var canvasMapping := GmfMap!CanvasMapping.all.first();
nodeMapping.relatedDiagrams := canvasMapping;

Unfortunately, the last line crashes because the canvasMapping cannot be assigned to the nodeMapping's relatedDiagram attribute. In the gmfmap XML, this is what the output should be:

<ownedChild relatedDiagrams="//@diagram">

I confirmed that the referenced @diagram node is truly a CanvasMapping type. I also confirmed that nodeMapping.relatedDiagrams is valid (it works if I assign 'null').

Any idea about how to get the CanvasMapping into the relatedDiagrams attribute?

Thanks, Christoph

PS: If I get this working, I'll add it to the diagram partitioning enhancement request that I submitted.
Previous Topic:EVL validation is working, EMF is not
Next Topic:ECore2GMF.eol: How to access/change node in GmfMap
Goto Forum:
  


Current Time: Thu Apr 25 14:42:11 GMT 2024

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

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

Back to the top