|
|
Re: [Zest] How to use Drag and Drop (DND) with zest? [message #767632 is a reply to message #767620] |
Sun, 18 December 2011 14:36 |
Erdal Karaca Messages: 854 Registered: July 2009 |
Senior Member |
|
|
Sorry, I should have written that I am using GraphViewer:
I tried this:
viewer.addDropSupport(DND.DROP_LINK,
new Transfer[] { LocalTransfer.getInstance() },
new ViewerDropAdapter(viewer) {
@Override
public boolean validateDrop(Object target, int operation,
TransferData transferType) {
if (target != null) {
System.out.println(target);
}
return false;
}
@Override
public boolean performDrop(Object data) {
return true;
}
@Override
protected Object determineTarget(DropTargetEvent event) {
Graph g = viewer.getGraphControl();
Point p = g.getDisplay().map(g.getShell(), g, event.x,
event.y);
IFigure fig = g.getFigureAt(p.x, p.y);
return fig;
}
});
Problems:
- g.getFigureAt() does not seem to get the figure under mouse position at its correct location: i am not sure whether this is the right way to listen for a drag target...
- validateDrop() provides a GraphLabel, I would expect it to provide my model object...
Any hints?
|
|
|
|
Powered by
FUDForum. Page generated in 0.05762 seconds