Diagram nodes provide an easy way to display containment references via compartments. Is there a similar concept for connections? I managed to add a feature label to my connection but this label only displays attributes of the underlying model element. What could I do to display all the containment references of the class represented via the connection as a list of connection labels?
thanks for your answer. This is what I would like to achieve:
The two nodes represent model elements of class A. The connection represents an instance of class B. B has containment refernces to class C. I would like to display the referenced elements as connection labels (ReferencedObject1, ReferencedObject2, ReferencedObject3, ...). However, GMF only supports feature labels for connections which are not appropriate for displaying references. Does this help you?
GMF does not only allow feature labels. You can also have expression labels which calculate their value by using an OCL expression. All you need to do is to concatenate a string with the reference labels using OCL. You should take a look at using OCL's iterate statement for building up the string. If you install the OCL Example and Editors plugin you can easily test your OCL expressions with an existing model. Just open the console view. In this view open the OCL console. Select the model element you want to execute OCL on and try coding.