Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Changing Link Arrows
Changing Link Arrows [message #206388] Tue, 23 September 2008 05:11 Go to next message
Eclipse UserFriend
Originally posted by: nuclearpsyche.gmail.com

Hello,
Let's suppose I have Link objects with a boolean property called
"bidirectional".
I want the link on the diagram to show arrows on both sides of the line
when that property==true and only an arrow on one side if
bidirectional==false.
Is there a way to do that assuming I have a property sheet that allows
changing the boolean value?
Thank you!

tamer
Re: Changing Link Arrows [message #206474 is a reply to message #206388] Tue, 23 September 2008 09:30 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Tamer,

You have to create two different link mappings with appropriate costraints
(bidirectional/not bidirectional) + listen to this property and call diagram
updater to replace existing link with new one on changing this property from
properties view.

-----------------
Alex Shatalin
Re: Changing Link Arrows [message #206506 is a reply to message #206388] Tue, 23 September 2008 10:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tobk42.gmx.de

In addition to Alex' sugestion -- which surely is more in the sense of
model driven engineering -- it is also possible to do some changes in
the code, which might have advantages depending on the number of
settings for a link or a node (and the possible combinations thereof).

Add a method setBidirectional(boolean) to your link's figure (normally
found in the link's edit part), adding/removing the link's second
decoration (see the code for the first decoration, to find out how to do
this). Now you have to implement the link edit part's notifyChanged
method, testing notification.getFeatureID(YourPackage.class) and calling
the setBidirectional method followed by calling refreshVisuals() on the
right feature ID.

Finally, don't forget to mark both methods "@generated NOT", so they
will not be overwritten on the next code generation.

Regards,
Tobias



Tamer schrieb:
> Hello,
> Let's suppose I have Link objects with a boolean property called
> "bidirectional".
> I want the link on the diagram to show arrows on both sides of the line
> when that property==true and only an arrow on one side if
> bidirectional==false.
> Is there a way to do that assuming I have a property sheet that allows
> changing the boolean value?
> Thank you!
>
> tamer
Re: Changing Link Arrows [message #206537 is a reply to message #206506] Tue, 23 September 2008 10:38 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello tobias,

Good point. Another way to implement alternative view mapping is to modify
generated code and sometimes it can be even more simple then my original
suggestion. :-)

-----------------
Alex Shatalin
Re: Changing Link Arrows [message #206868 is a reply to message #206474] Wed, 24 September 2008 14:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: nuclearpsyche.gmail.com

Alex,
Thank you for you suggestion!

tamer

Alex Shatalin wrote:
> Hello Tamer,
>
> You have to create two different link mappings with appropriate
> costraints (bidirectional/not bidirectional) + listen to this property
> and call diagram updater to replace existing link with new one on
> changing this property from properties view.
>
> -----------------
> Alex Shatalin
>
>
Re: Changing Link Arrows [message #206884 is a reply to message #206506] Wed, 24 September 2008 14:27 Go to previous message
Eclipse UserFriend
Originally posted by: nuclearpsyche.gmail.com

Tobias,
Thank you! I will definitely try this out.
Regards,

tamer

Tobias wrote:
> In addition to Alex' sugestion -- which surely is more in the sense of
> model driven engineering -- it is also possible to do some changes in
> the code, which might have advantages depending on the number of
> settings for a link or a node (and the possible combinations thereof).
>
> Add a method setBidirectional(boolean) to your link's figure (normally
> found in the link's edit part), adding/removing the link's second
> decoration (see the code for the first decoration, to find out how to do
> this). Now you have to implement the link edit part's notifyChanged
> method, testing notification.getFeatureID(YourPackage.class) and calling
> the setBidirectional method followed by calling refreshVisuals() on the
> right feature ID.
>
> Finally, don't forget to mark both methods "@generated NOT", so they
> will not be overwritten on the next code generation.
>
> Regards,
> Tobias
>
>
>
> Tamer schrieb:
>> Hello,
>> Let's suppose I have Link objects with a boolean property called
>> "bidirectional".
>> I want the link on the diagram to show arrows on both sides of the
>> line when that property==true and only an arrow on one side if
>> bidirectional==false.
>> Is there a way to do that assuming I have a property sheet that allows
>> changing the boolean value?
>> Thank you!
>>
>> tamer
Previous Topic:How to generate a link with multiple sources and targets
Next Topic:How can i get control of star mouse pointer drag?
Goto Forum:
  


Current Time: Tue Jan 19 06:53:34 GMT 2021

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

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

Back to the top