Community
Participate
Working Groups
Build ID: I20070621-1340 Steps To Reproduce: 1. Create a zest GraphViewer 2. Attach a DropTargetListener 3. Drag an object over the GraphViewer In the dropTargetListener's dragOver() and drop() methods, the event parameter (of type DropTargetEvent) doesn't have its item field set properly. This field is null, where in other jface viewers, it is set to the child element of the viewer that is being dragged/dropped over. I am using the same code snippet to reproduce this as in Bug 200732 More information: This can be worked around by examining the event.x and event.y and doing a search of the graph's nodes to determine which object is actually being hovered over. I do something like this, and call setEventItem() before I query event.item: private void setEventItem( DropTargetEvent event ) { List nodes = viewer.getGraphControl().getNodes(); for ( Object nodeObj : nodes ) { GraphNode gn = (GraphNode) nodeObj; Point location = gn.getLocation(); Dimension size = gn.getSize(); Control displayControl = null; org.eclipse.swt.graphics.Point map = gn.getDisplay().map( viewer.getControl(), displayControl, location.x, location.y ); if ( (map.x < event.x) && (map.y < event.y) && (map.x + size.width > event.x) && (map.y + size.height > event.y) ) { event.detail = DND.DROP_COPY; event.item = gn; return; } } }
Re-assigning back to inbox, as Ian is no longer active committer.