Summary: | Consuming a mouse release event in a figure's MouseListener has no effect | ||
---|---|---|---|
Product: | [Tools] GEF | Reporter: | Tom Crockett <Thomas.M.Crockett> |
Component: | GEF-Legacy Draw2d | Assignee: | gef-inbox <gef-inbox> |
Status: | NEW --- | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | heiko.boettger, nyssen |
Version: | unspecified | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: |
Changing OS from Mac OS to Mac OS X as per bug 185991 Bug #242909 seems to be closely related to this. I think it will make sense to investigate both together. |
SWTEventDispatcher.dispatchMouseReleased() looks like this: public void dispatchMouseReleased(org.eclipse.swt.events.MouseEvent me) { receive(me); if (mouseTarget != null) { mouseTarget.handleMouseReleased(currentEvent); } releaseCapture(); receive(me); } Because of that call to releaseCapture(), it doesn't matter if you call consume() on the event inside handleMouseReleased. In the GEF subclass, DomainEventDispatcher, it looks like this: public void dispatchMouseReleased(org.eclipse.swt.events.MouseEvent me) { if (!editorCaptured) { > super.dispatchMouseReleased(me); > if (draw2dBusy()) > return; } if (okToDispatch()) { setRouteEventsToEditor(false); domain.mouseUp(me, viewer); updateFigureUnderCursor(me); } } draw2dBusy() never returns true after a mouse release, so the method will always continue and get propagated to the GraphicalEditor. If I have a figure on top of the graphical editor which is supposed to intercept all events, I don't want that to happen.