Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Show/hide edge via notational model
Show/hide edge via notational model [message #677085] Tue, 07 June 2011 14:26 Go to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi all,

I have an edge which I want to show/hide via the notational mode. I look up the edge in the notational model and set visible to true/false. However, the diagram is only updated after closing and opening it again. How can I force the connections to show hide immediatly?

Ralph
Re: Show/hide edge via notational model [message #725315 is a reply to message #677085] Wed, 14 September 2011 13:54 Go to previous messageGo to next message
J.Teutsch  is currently offline J.Teutsch Friend
Messages: 7
Registered: November 2010
Junior Member
Hi Ralph,

I have the problem a little bit different. Connection with notation visible=false are not shown.

But you have to make same visible or invisible before the ShapeImpl

   // make only edges visible
    for (View edgeView : recursiveFieldInExpressLinks)
    {
      if (edgeView instanceof EdgeImpl)
      {
        SetRequest request = new SetRequest((EObject) edgeView, NotationPackage.eINSTANCE.getView_Visible(), visibilize);

        SetValueCommand cmd = new SetValueCommand(request);
        linkCommand.add(cmd);
        
      }
    }

	

My problem is, when I save a diagram with invisible EdgeImpl and reopen it, the Edges are not shown anymore. Maybe you can share your code

Kind regards J. Teutsch
Re: Show/hide edge via notational model [message #725329 is a reply to message #725315] Wed, 14 September 2011 14:14 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

I think if you modify directly the Notation model, you'll need to
refresh your editpart to get it read again the notation model and alter
the figure (visible=false) according to it.

Here is some stuff that sounds good for your use case
* ShowHideRelationshipsRequest
* RequestConstants.REQ_SHOWHIDE_RELATIONSHIPS

In case it does not work, you can mimic the mechanism to hide labels
* HideConnectionLabelsAction
* ToggleConnectionLabelsRequest
* RequestConstants.REQ_TOGGLE_CONNECTION_LABELS



On 14/09/2011 15:54, J.Teutsch wrote:
> Hi Ralph,
>
> I have the problem a little bit different. Connection with notation
> visible=false are not shown.
>
> But you have to make same visible or invisible before the ShapeImpl
>
> // make only edges visible
> for (View edgeView : recursiveFieldInExpressLinks)
> {
> if (edgeView instanceof EdgeImpl)
> {
> SetRequest request = new SetRequest((EObject) edgeView,
> NotationPackage.eINSTANCE.getView_Visible(), visibilize);
>
> SetValueCommand cmd = new SetValueCommand(request);
> linkCommand.add(cmd);
> }
> }
>
> My problem is, when I save a diagram with invisible EdgeImpl and reopen
> it, the Edges are not shown anymore. Maybe you can share your code
>
> Kind regards J. Teutsch


--
http://mickaelistria.wordpress.com
http://twitter.com/#!/mickaelistria
http://www.petalslink.com
Re: Show/hide edge via notational model [message #725917 is a reply to message #725329] Fri, 16 September 2011 07:37 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi,

I debugged the performRequest(new Request(RequestConstants.REQ_SHOWHIDE_RELATIONSHIPS)); on my editpart that is connected to the connections that I want to show/hide. This does not work as internally the getTargetEditPart(Request request) method returns null. However this seems to be right as the connections not in the EditPart registry after setting their visible value to true. I opened Bug 353744 on this problem but nothing seems to happen since a while.

Ralph
Re: Show/hide edge via notational model [message #726730 is a reply to message #725917] Mon, 19 September 2011 11:27 Go to previous messageGo to next message
Christian Smietana is currently offline Christian SmietanaFriend
Messages: 14
Registered: February 2011
Junior Member
Try executing the RequestConstants.REQ_REFRESH request on the diagram edit part, this has solved all my update problems.
Re: Show/hide edge via notational model [message #727476 is a reply to message #726730] Wed, 21 September 2011 12:07 Go to previous message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi,

I have executed the following which does not help further:

EditPart parent = getParent();
while (parent != null && ! (parent instanceof DiagramEditPart)){
 parent = parent.getParent();
}
if (parent instanceof DiagramEditPart)
 parent.performRequest(new Request(RequestConstants.REQ_REFRESH));


Ralph
Previous Topic:Change port node location whenever it is dragged and dropped on to the component node in GMF Editor
Next Topic:Cant delete diagram element
Goto Forum:
  


Current Time: Thu Mar 28 10:25:51 GMT 2024

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

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

Back to the top