ECore2GMF.eol: How to access/change node in GmfMap [message #497055] |
Thu, 12 November 2009 06:45  |
Eclipse User |
|
|
|
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 #499128 is a reply to message #497055] |
Thu, 19 November 2009 19:50  |
Eclipse User |
|
|
|
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 07:01  |
Eclipse User |
|
|
|
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 18:53  |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.04076 seconds