Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Link Constraints and shared tool element
Link Constraints and shared tool element [message #237247] Wed, 22 July 2009 16:10 Go to next message
RefuX Zanzeebarr is currently offline RefuX Zanzeebarr
Messages: 51
Registered: July 2009
Member
I am linking from Class A to Class C
Class C has an attribute called: type.
type can be: ONE or TWO.
Class B is the element used to map from A to C.

So the instances would look something like A->B->C
Where A is a diagram box, B is the line, and C is another diagram box.
Depending on Class C's type, I want to use a different line figure.

I have two Link Mappings, both using B as the element.
The first link mapping has a Link Constraint on the Target: self.type = ONE
The second link mapping has a Link Constraint on the Target: self.type =
TWO.

Both of these link mappings use the same 'Tool' item - this is where I
think the problem lies.

My tool palette has just one link creating element called: "create link".

I draw a link from A to C using this "create link" element, if C's type
is ONE I get the line I want, if C's type is TWO I don't get any lines
at all.
I'm guessing GMF only tries the first link mapping and if it doesn't
meet the constraints, it stops, it doesn't try the next link mapping.

Any thoughts? I'm guessing this is so convoluted I'm the first person to
do this :)
Re: Link Constraints and shared tool element [message #237259 is a reply to message #237247] Wed, 22 July 2009 17:49 Go to previous messageGo to next message
RefuX Zanzeebarr is currently offline RefuX Zanzeebarr
Messages: 51
Registered: July 2009
Member
RefuX wrote:
> I am linking from Class A to Class C
> Class C has an attribute called: type.
> type can be: ONE or TWO.
> Class B is the element used to map from A to C.
>
> So the instances would look something like A->B->C
> Where A is a diagram box, B is the line, and C is another diagram box.
> Depending on Class C's type, I want to use a different line figure.
>
> I have two Link Mappings, both using B as the element.
> The first link mapping has a Link Constraint on the Target: self.type = ONE
> The second link mapping has a Link Constraint on the Target: self.type =
> TWO.
>
> Both of these link mappings use the same 'Tool' item - this is where I
> think the problem lies.
>
> My tool palette has just one link creating element called: "create link".
>
> I draw a link from A to C using this "create link" element, if C's type
> is ONE I get the line I want, if C's type is TWO I don't get any lines
> at all.
> I'm guessing GMF only tries the first link mapping and if it doesn't
> meet the constraints, it stops, it doesn't try the next link mapping.
>
> Any thoughts? I'm guessing this is so convoluted I'm the first person to
> do this :)

Actually this works! I just needed to define not only a Link Constraint
but also a Constraint, since that helped it pick up the correct edit
part (Since they have the same type).
Re: Link Constraints and shared tool element [message #1060503 is a reply to message #237259] Sat, 25 May 2013 14:12 Go to previous message
Philip de Kock is currently offline Philip de Kock
Messages: 1
Registered: May 2013
Junior Member
Hi Refux,

Do you possibly have an example of the constraint you used?

I'm experiencing the same issue.

B inherits from A -> Link mapping
C inherits from B -> Link mapping

When creating Link mapping for B, all is well. Adding the Link Mapping for C and link on diagram does not show. When new element is dragged onto editor the wrong link is created (B).

Any help would be appreciated.

Thank you,
Philip
Previous Topic:GMF delete node problem
Next Topic:PolylineConnection color when focused
Goto Forum:
  


Current Time: Wed Oct 01 14:21:17 GMT 2014

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

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