DispatchMouseReleased [message #233774] |
Wed, 02 May 2007 11:47 |
Manuel Selva Messages: 189 Registered: July 2009 Location: Grenoble, France |
Senior Member |
|
|
Hi all,
I am dealing with Draw2d mouse events. In my Draw2d diagram when the mouse
is released on particular figures i want to dispose() my diagram. To do
this, in my MouseListener mouseReleased() method i dispose() the canvas
that contains the diagramm.
This generates an SWT widget is disposed exception since after my
mouseReleased method has been called the SWT Event dispatcher invokes the
receive method that invokes setHoverSource and try to access to
(Control)me.getSource.
Why the dispatchMouseReleased() method calls
receive()
mouseTarget.handleMouseReleased(currentEvent);
receive() <-------- This call generates the exception ?
How can i dispose my diagramm composite inside a mouseReleased event ?
Thanks
Manuel Selva
http://manuelselva.wordpress.com/
|
|
|
|
Re: DispatchMouseReleased [message #233986 is a reply to message #233916] |
Wed, 09 May 2007 06:20 |
Manuel Selva Messages: 189 Registered: July 2009 Location: Grenoble, France |
Senior Member |
|
|
Hi Anthony,
In fact i am not dealing with GEF but only with SWT inside my own
Eclipse's view.
Randy Hudson answer to my question on the mailing list. He told me to use
Display.getCurrent.aSynchExec(). It works fine but i still have a question
(also posted on the GEF developers mailing list):
The Javadoc for asynch metho says " The caller of this method continues
Causes the run() method of the runnable to be invoked by the
user-interface thread at the next reasonable opportunity. The caller of
this method continues to run in parallel". It means, that in general, we
can't guaranty that the caller thread has reached a given point when the
run() method of runnable would be executed. I am right ?
Your solution seems to always works. Why ? In our case the caller thread
IS the UI thread, is it the reason why we can guaranty that the
dispatchMouseRelease method will be completely executed before the run( )
method of the runnable will be called ?
Thanks in advance
Manuel Selva
http://manuelselva.wordpress.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03397 seconds