Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to choose between two Reference based links with the same target feature?
How to choose between two Reference based links with the same target feature? [message #189957] Thu, 29 May 2008 09:23 Go to next message
Salva is currently offline SalvaFriend
Messages: 29
Registered: July 2009
Junior Member
Hi,

I have the ecore metamodel of the image below:

<a href="http://img140.imageshack.us/my.php?image=defaultfq3.gif"
target="_blank"><img
src="http://img140.imageshack.us/img140/2780/defaultfq3.th.gif" border="0"
alt="Free Image Hosting at www.ImageShack.us" /></a><br /><br /><a
href=" http://img604.imageshack.us/content.php?page=blogpost&fi les=img140/2780/defaultfq3.gif"
title="QuickPost"><img src="http://imageshack.us/img/butansn.png"
alt="QuickPost" border="0"></a>

I want to model ExtendedElementA and ExtendedElementB as phantom nodes so
I've set up two LinkMappings with target set to extendedElement. Each link
has a different graphical representation.

Then, when I create in the model either ExtendedElementA or
ExtendedElementB, in the diagram the two links are shown.

¿How can I avoid this behavior? I can't use a constraint on the link
because there isn't domain model element and a LinkContraint only prevent
the creation on the diagram. ¿Any idea?

Thanks in advance.
Re: How to choose between two Reference based links with the same target feature? [message #190042 is a reply to message #189957] Thu, 29 May 2008 11:54 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Salva,

Try using target link constraints specifying that target of the link should
be .oclIsTypeOf(ExtendedElementA) /...B

-----------------
Alex Shatalin
Re: How to choose between two Reference based links with the same target feature [message #190130 is a reply to message #190042] Thu, 29 May 2008 14:40 Go to previous messageGo to next message
Salva is currently offline SalvaFriend
Messages: 29
Registered: July 2009
Junior Member
Hi, Alex

Using Link Constraint setting TargetEnd Constraint like you say only
prevent the creation of the links using the diagram but if I close and
open again the diagram
I can see again the two links.

Best wishes!

pd: If someone want to reproduce the issue there is a mistake in my image,
there isn't specialization of ExtendedElement to Model Element.
Re: How to choose between two Reference based links with the same target feature [message #190455 is a reply to message #190130] Mon, 02 June 2008 07:29 Go to previous messageGo to next message
Salva is currently offline SalvaFriend
Messages: 29
Registered: July 2009
Junior Member
¿Any idea of how to avoid this behaviour? ¿Maybe modifying generated code?

I prefer not to modify generated code but if it's the only way to solve
the problem I'll try it.
Re: How to choose between two Reference based links with the same target feature [message #190462 is a reply to message #190455] Mon, 02 June 2008 09:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jan.herriger.gmx.de

The easiest way should be to modify link constraints inside
xxxBaseItemSemanticEditPolicy, I think. Or add a Java constraint. Both
means to have non-generated code.

Salva Martínez schrieb:
> ¿Any idea of how to avoid this behaviour? ¿Maybe modifying generated code?
> I prefer not to modify generated code but if it's the only way to solve
> the problem I'll try it.
>
Re: How to choose between two Reference based links with the same target feature [message #190502 is a reply to message #190130] Mon, 02 June 2008 11:23 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Salva,

> prevent the creation of the links using the diagram but if I close and
> open again the diagram I can see again the two links.
Looks like a bug with links update process... You can debug *CanonicalEditPolicy
generated for your diagram element (or *DiagramUpdater) to see the reason
of next link presence. These two classes i suppose is a correct place for
entering corrections to prevent second link from creation while diagram openning.
The best solution is: find the reason of the problem, correct it, patch code
generation templates in accordance + submitt corresponding request + patch
to GMF.

-----------------
Alex Shatalin
Re: How to choose between two Reference based links with the same target feature [message #191663 is a reply to message #190502] Mon, 09 June 2008 11:09 Go to previous messageGo to next message
Salva is currently offline SalvaFriend
Messages: 29
Registered: July 2009
Junior Member
Hi again,

I've been debugging *CanonicalEditPolicy and *DiagramUpdater java classes
and in the end I think that the described behaviour is not exactly a bug.

When a diagram is opened these classes looks for all the VisualID's that
must be painted in the diagram in agreement with the model information.
Bearing in mind that the two links are using the same targetfeature the
two links must be created and the only way to prevent this is through
constraints.
The bad point is that althought normal constraints are checked by the
diagramUpdater, the linkConstraints only are evaluated at visual creation
time.

To avoid this misbehavior we need to have linkConstraints evaluated by the
DiagramUpdater ¿Why linkConstraint are only evaluated at visual creation
time? ¿Any idea?


Cheers!

Salva.
Re: How to choose between two Reference based links with the same target feature [message #191710 is a reply to message #191663] Mon, 09 June 2008 12:26 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Salva,

Looks like corresponding constraints will be checked only for type-based
links and will not for reference-based (phantom)... Please, submitt a request
for it.

-----------------
Alex Shatalin
Re: How to choose between two Reference based links with the same target feature [message #191808 is a reply to message #191710] Tue, 10 June 2008 08:59 Go to previous message
Salva is currently offline SalvaFriend
Messages: 29
Registered: July 2009
Junior Member
Done! I've sent the request yet:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=236387

Regards,

Salva.
Previous Topic:Reuse of diagram menu contribution classes
Next Topic:Getting an ecore output
Goto Forum:
  


Current Time: Thu Apr 25 16:45:21 GMT 2024

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

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

Back to the top