|
|
|
|
|
Re: SWT maps event to wrong control [message #1707948 is a reply to message #1707793] |
Thu, 10 September 2015 17:57 |
Eclipse User |
|
|
|
Ok, last approach that I can think of: don't open your part in the double-click but in the mouseUp event. In your double-click event, set a flag that a double-click was received. To be on the safe side, I'd do something like the following (untested) code:
private Widget doubleClickedWidget = null;
...
button.addMouseListener(new MouseListener() {
public void mouseDown(MouseEvent e) {
doubleClickedWidget = null;
}
public void mouseDoubleClick(MouseEvent e) {
doubleClickedWidget = e.widget;
}
public void mouseUp(MouseEvent e) {
// Ensure this event comes from the double-clicked widget
if(doubleClickedWidget == e.widget) {
// open part
}
}});
|
|
|
Re: SWT maps event to wrong control [message #1707949 is a reply to message #1707948] |
Thu, 10 September 2015 18:02 |
Eclipse User |
|
|
|
Oh and if the mouseUp approach doesn't work, then use timerExec(). It seems like the mouseUp event from the mouse double-click haven't been queued when the mouseDoubleClick event is raised. It's possible other events are still pending too. Using asyncExec won't help in this case as it's handled internally. Using timerExec() with a small timeout (e.g., 5ms) should be sufficient for all follow-on events to have been generated and handled.
We have a similar problem in the CSS theming support, and I suspect we'll need to use the timerExec() approach.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04138 seconds