Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » One Connection - Two Labels(Is this possible? If yes: How?)
One Connection - Two Labels [message #643974] Wed, 08 December 2010 16:06 Go to next message
Patrick  is currently offline Patrick
Messages: 10
Registered: December 2010
Junior Member
Hello Smile

I am trying to attach two labels to a connection, but just one is displayed. I've tried several things now and I am wondering if this is actually possible?

Attached are the snippets which i thought should describe this.
Thanks!!

gmfgraph:

[...] 
<descriptors
        name="RelationConnectorFigure">
      <actualFigure
          xsi:type="gmfgraph:PolylineConnection"
          name="RelationConnectorFigure">
        <children
            xsi:type="gmfgraph:Label"
            name="ConnectorRole"/>
        <children
            xsi:type="gmfgraph:Label"
            name="RelationConnectorCardinality"
            text=""/>
      </actualFigure>
      <accessors
          figure="//@figures.0/@descriptors.2/@actualFigure/@children.1"/>
      <accessors
          figure="//@figures.0/@descriptors.2/@actualFigure/@children.0"/>
    </descriptors>[...]

  <connections
      name="RelationConnector"
      figure="RelationConnectorFigure"/>
  <labels
      name="RelationConnectorCardinality"
      figure="RelationConnectorFigure"
      elementIcon="false"
      accessor="//@figures.0/@descriptors.2/@accessors.0"/>
  <labels
      name="ConnectorRole"
      figure="RelationConnectorFigure"
      elementIcon="false"
      accessor="//@figures.0/@descriptors.2/@accessors.1"/>
</gmfgraph:Canvas>
[...]


gmfmap:
[...]
<links>
    <domainMetaElement
        href="entityrelation.ecore#//RelationConnector"/>
    <labelMappings
        xsi:type="gmfmap:FeatureLabelMapping"
        viewPattern="[{0};{1}]{3}"
        editPattern="[{0};{1}]">
      <diagramLabel
          href="entityrelation.gmfgraph#RelationConnectorCardinality"/>
      <features
          href="entityrelation.ecore#//RelationConnector/cardinalityLowerBound"/>
      <features
          href="entityrelation.ecore#//RelationConnector/cardinalityUpperBound"/>
      <editableFeatures
          href="entityrelation.ecore#//RelationConnector/cardinalityLowerBound"/>
      <editableFeatures
          href="entityrelation.ecore#//RelationConnector/cardinalityUpperBound"/>
    </labelMappings>
    <labelMappings
        xsi:type="gmfmap:FeatureLabelMapping"
        editorPattern="">
      <features
          href="entityrelation.ecore#//RelationConnector/connectorRole"/>
      <editableFeatures
          href="entityrelation.ecore#//RelationConnector/connectorRole"/>
    </labelMappings>
    <containmentFeature
        href="entityrelation.ecore#//Relation/connectors"/>
    <tool
        xsi:type="gmftool:CreationTool"
        href="entityrelation.gmftool#//@palette/@tools.1/@tools.0"/>
    <diagramLink
        href="entityrelation.gmfgraph#RelationConnector"/>
    <sourceMetaFeature
        xsi:type="ecore:EReference"
        href="entityrelation.ecore#//RelationConnector/connectedRelation"/>
    <linkMetaFeature
        xsi:type="ecore:EReference"
        href="entityrelation.ecore#//RelationConnector/connectedEntity"/>
  </links>
[...]
Re: One Connection - Two Labels [message #643986 is a reply to message #643974] Wed, 08 December 2010 17:49 Go to previous messageGo to next message
Michael Golubev is currently offline Michael Golubev
Messages: 373
Registered: July 2009
Senior Member
Hello,

This is definitely possible, U2T associatoins has 7 different labels each Smile

Just use separate figure descriptors for labels instead of child labels and the accessors, like below:
  <figures
      name="AssociationsGallery"
implementationBundle="org.eclipse.uml2.diagram.common">
    <descriptors
        name="Association_label_name">
      <actualFigure
          xsi:type="gmfgraph:Label"
          name="Association_label_name"/>
    </descriptors>
    <descriptors
        name="Association_label_sourceRole">
      <actualFigure
          xsi:type="gmfgraph:Label"
          name="Association_label_sourceRole"/>
    </descriptors>
    ... 5 labels skipped 
    <descriptors
        name="AssociationClass2RhombConnectorFigure">
      <actualFigure
          xsi:type="gmfgraph:PolylineConnection"
          name="AssociationClass2RhombConnectorFigure"
          lineKind="LINE_DASH"/>
    </descriptors>
  </figures>


Everything else would be the same as in your samples.

Regards,
Michael
icon14.gif  Re: One Connection - Two Labels [message #645502 is a reply to message #643986] Fri, 17 December 2010 09:07 Go to previous message
Patrick  is currently offline Patrick
Messages: 10
Registered: December 2010
Junior Member
Thanks alot Smile

I've had a wrong idea of the child relation. Now everything works fine.
Previous Topic:Manipulate gmf diagram in a non eclipse environment
Next Topic:Question about diagram partitioning and synchronization
Goto Forum:
  


Current Time: Sat Aug 23 01:51:22 EDT 2014

Powered by FUDForum. Page generated in 0.07620 seconds