Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Scrolling diagram nodes into view
Scrolling diagram nodes into view [message #730694] Wed, 28 September 2011 21:46 Go to next message
Thomas Spall is currently offline Thomas SpallFriend
Messages: 29
Registered: July 2009
Junior Member
I would like to select a particular diagram node - respectively potentially multiple nodes - and then scroll them into the user's visible field on a best effort approach. I.e. if there is only one node or the selected nodes are conveniently close, the view is scrolled and centred on the cluster and the user indeed can see all selected nodes. Otherwise, it does something default like e.g. always scrolling to the first node.

Main question is: Does anyone know if this functionality or something similar is already existing in the GMF framework somewhere?
If not, where would be a good point to insert this or start from?

Thanks,
Thomas

[Updated on: Wed, 28 September 2011 21:46]

Report message to a moderator

Re: Scrolling diagram nodes into view [message #1032829 is a reply to message #730694] Wed, 03 April 2013 13:40 Go to previous messageGo to next message
Dan Tololoi is currently offline Dan TololoiFriend
Messages: 33
Registered: September 2012
Location: Iasi, Romania
Member

Hi Thomas,

I reached this topic also looking for some ideas. Do you have any updates?

Thanks!
Re: Scrolling diagram nodes into view [message #1033410 is a reply to message #1032829] Thu, 04 April 2013 07:56 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 697
Registered: November 2009
Senior Member
Hi,

you need two things 1) Your DiragramEditor (editor) and 2) The edit part (editPart) you want to scroll to. Then do the following:

editor.getDiagramGraphicalViewer().select(editPart);
editor.getDiagramGraphicalViewer().reveal(editPart);


Ralph
Re: Scrolling diagram nodes into view [message #1034427 is a reply to message #1033410] Fri, 05 April 2013 12:17 Go to previous message
Dan Tololoi is currently offline Dan TololoiFriend
Messages: 33
Registered: September 2012
Location: Iasi, Romania
Member

Hi Ralph,

Thanks for the reply. I managed to do in the following lines of code:

GraphicalViewer gv = (GraphicalViewer)editor.getAdapter(GraphicalViewer.class);
FigureCanvas figureCanvas = (FigureCanvas) gv.getControl();
figureCanvas.scrollTo(coordinatesRectangle.x,coordinatesRectangle.y);

where the editor is the DiagramEditor and the x and y are the new values the scroll should take place.

Hope this helps to somebody else also.
Previous Topic:recursive relation in same class
Next Topic:How to edit a label mapped by ExpressionLabelMapping?
Goto Forum:
  


Current Time: Sun Nov 23 08:57:45 GMT 2014

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

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