Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Duplicate Connections appearing in Diagram
Duplicate Connections appearing in Diagram [message #201317] Mon, 11 August 2008 09:04 Go to next message
Eclipse UserFriend
Originally posted by: sebastian.kleinschmager.sse.uni-due.de

Hi there everybody,

my situation is the following: I've got a meta-model where two elements
have a reference to each other (because a connection should be able to be
drawn starting on both ends), but only one connection between two elements
should exist, no matter if it was drawn from first to second or second to
first type.

I thought this could be done easily by using the EOpposite property in the
Meta-model, but now each time I draw a connection between two elements,
there appears a second duplicate connection between them after refreshing
the diagram (like adding any other element).

Does anyone know how to solve this?

Thanks and Greetings
Re: Duplicate Connections appearing in Diagram [message #201389 is a reply to message #201317] Mon, 11 August 2008 11:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zippo29.hotmail.fr

Hi,

If you defined 2 linkmappings in the gmfmap for your 2 connections it is
normal. The diagram checks for the existing outgoing an incoming
connections and display them.

Probably, you should have a look in the DiagramUpdater and see if you can
restrict the display to one of the two connections if one is already
displayed.

HTH
Regards
Re: Duplicate Connections appearing in Diagram [message #201404 is a reply to message #201389] Mon, 11 August 2008 12:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sebastian.kleinschmager.sse.uni-due.de

Hi again,

thanks for the reply.

Yes, I defined two Link Mappings because I wanted the user to be able to
draw the connection beginning from both element types. Is there a way to
define only one link mapping (the model should still contain both
references) but make it drawable from both element types in the diagram?
Re: Duplicate Connections appearing in Diagram [message #201411 is a reply to message #201404] Mon, 11 August 2008 13:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tobk42.gmx.de

I think you could change your metamodel in this way:
Instead of having

Class A
- ref b:B (opposite of B.a)
Class B
- ref a:A (opposite of A.b)

with both a and b having a link mapping, you could introduce a superclass:

Class C
- ref c:C (opposite of itself)
Class A extends C
Class B extends C

with a link mapping only for c. Additionally, this has the advantage
that there will be only one Edit Part for the link, instead of two,
depending on from which element it startet. For ensuring that no link
can be drawn from A to A or from B to B you can use a Link Audit.

Tobias



Sebastian K. schrieb:
> Hi again,
>
> thanks for the reply.
>
> Yes, I defined two Link Mappings because I wanted the user to be able to
> draw the connection beginning from both element types. Is there a way to
> define only one link mapping (the model should still contain both
> references) but make it drawable from both element types in the diagram?
>
>
Re: Duplicate Connections appearing in Diagram [message #201418 is a reply to message #201411] Mon, 11 August 2008 14:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sebastian.kleinschmager.sse.uni-due.de

Hi,

that is an interesting idea. I just found another way of accomplishing
this.

I deleted one of the two link mappings and in the generator model and set
the property "Incoming Creating Allowed" of the Gen Link for that
Connection to true. It now works using only one link mapping which can be
drawn from both target and source.

And the model should still contain both references because of the
EOpposite Feature.
Re: Duplicate Connections appearing in Diagram [message #201438 is a reply to message #201418] Mon, 11 August 2008 14:51 Go to previous message
Eclipse UserFriend
Originally posted by: tobk42.gmx.de

Cool, I didn't know this one. By the way, my approach had a major
drawback: You'd have to test which end of the link - source or target -
is A and which is B.

Tobias


Sebastian K. schrieb:
> Hi,
>
> that is an interesting idea. I just found another way of accomplishing
> this.
>
> I deleted one of the two link mappings and in the generator model and
> set the property "Incoming Creating Allowed" of the Gen Link for that
> Connection to true. It now works using only one link mapping which can
> be drawn from both target and source.
>
> And the model should still contain both references because of the
> EOpposite Feature.
>
Previous Topic:Diagram xml and default.xml
Next Topic:How to make GMF use EMF copy/paste
Goto Forum:
  


Current Time: Tue Apr 23 06:40:31 GMT 2024

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

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

Back to the top