Bug 399765

Summary: Make getGraphItem(IFigure figure) public
Product: [Tools] GEF Reporter: Shai Bentin <shai>
Component: GEF-Legacy ZestAssignee: gef-inbox <gef-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: grec.georgian, steeg
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Shai Bentin CLA 2013-02-01 17:56:38 EST
In order to support some hover functionality over the nodes and connections I need to know the GraphItem under the mouse. It seems that exposing the 'GraphItem getGraphItem(IFigure figure)' as public will allow me to do so efficiently.
Comment 1 Fabian Steeg CLA 2013-02-23 19:39:37 EST
I assume what you need is more than a popup when hovering over nodes or connections? These could be set with GraphNode#setTooltip and GraphConnection#setTooltip.

Or would something using 'ZestStyles.NODES_HIDE_TEXT | ZestStyles.NODES_FISHEYE' be useful for you (see http://git.eclipse.org/c/gef/org.eclipse.gef4.git/tree/org.eclipse.gef4.zest.examples/src/org/eclipse/gef4/zest/examples/swt/GraphSnippet6.java)?

If these don't work for you, could you provide a little snippet of what exactly you would like to do? I'm just trying to see if there is a different solution to your issue, since any public API we release cannot be changed or removed easily later, so we try to expose as little as possible.
Comment 2 Georgian Grec CLA 2013-03-14 10:26:46 EDT
Hello guys.

So I'm having almost the same problem with grabbing a graph item.

My method, called getItem, receives a DropTargetEvent, and does the following:

1. Gets and IFigure with graph.getFigureAt(event.x, event.y)
2. Uses reflection to get a GraphItem using graph.getGraphItem(IFigure)

All in all, what I want to do is get a GraphItem knowing its position on the graph. Can anyone suggest me a more 'clean' alternative to what I've done?