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.
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').
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.
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.nam e = "PartitioningState");
var canvasMapping := GmfMap!CanvasMapping.all.first();
nodeMapping.relatedDiagrams.add(canvasMapping);