Previously handleEvent would post the event for asynchronous handling
while handling the drag starting via Transferable requires the drag to
be started synchronously within the AWT drag start event handler.
Added syncHandleEvent to AbstractEventHandler to support this.
gitlab #112
Change-Id: I694844fbfc1be74b9f6b620afc8fc441a0ab4d31
import org.simantics.scenegraph.g2d.events.MouseEvent.MouseDoubleClickedEvent;
import org.simantics.scenegraph.g2d.events.MouseEvent.MouseDragBegin;
import org.simantics.scenegraph.g2d.events.MouseEvent.MouseMovedEvent;
-import org.simantics.scenegraph.g2d.events.NodeEventHandler;
import org.simantics.scenegraph.g2d.events.command.CommandEvent;
import org.simantics.scenegraph.g2d.events.command.Commands;
import org.simantics.scenegraph.utils.GeometryUtils;
controlPos,
getScreenPosition(e));
- handleEvent(event);
+ syncHandleEvent(event);
if (event.transferable != null) {
ds.startDrag(dge, null, event.transferable, null);
delegator.handleEvent(e);
}
+ protected void syncHandleEvent(Event e) {
+ if (queue instanceof IEventHandler)
+ ((IEventHandler) queue).handleEvent(e);
+ else if (delegator != null && EventTypes.passes(delegator, e))
+ delegator.handleEvent(e);
+ else
+ throw new UnsupportedOperationException("Cannot handle event synchronously, no handler available: " + e);
+ }
+
}