Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » [Zest] Display SWT controls inside graph nodes
[Zest] Display SWT controls inside graph nodes [message #632164] Mon, 11 October 2010 20:18 Go to next message
Fabio M is currently offline Fabio MFriend
Messages: 25
Registered: July 2009
Junior Member
Hi everybody,

do you know if it is possible and how to display SWT controls inside a graph node using a GraphViewer?

What I would like to achieve is to display complex information and to allow user to edit it in place when a node is double clicked.

Re: [Zest] Display SWT controls inside graph nodes [message #642323 is a reply to message #632164] Tue, 30 November 2010 19:23 Go to previous message
Johan Schulz is currently offline Johan SchulzFriend
Messages: 20
Registered: November 2010
Junior Member
Hi had the same problem a few weeks ago.
To solve this i added a MouseDoubleClick listener to the graph and get a handle to the underlying data object (you can get the node under the click location from the graph and the x,y values from the event).

spawn a shell (not a dialog) at your click location which contains your edit form. I used the factory pattern to create the different edit forms based on the underlying data object.
Three hints for the shell.

  • You have to map your relative to the display coordinates ( )
  • set the SWT.NO_TRIM flag in the style attribute
  • add an mouse listener which fakes the move event, cause your shell is not movable if you have the NO_TRIM flag set. There are some snippets out for custom shells, maybe you want something other than rectangular *g*

After edit update your model, dispose the shell and refresh your graphviewer, thats all Smile

Btw there is an really nice animation library (trident) with which you can fade your shell in and out.

If you only need basic editing functionallity of existing nodes this solution works quite well.

Have fun
Previous Topic:mouse-selecting nodes
Next Topic:Stange behaviour on resolution change
Goto Forum:

Current Time: Fri May 25 19:04:48 GMT 2018

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

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

Back to the top