Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [gef-dev] dispatchMouseRelease

Randy Hudson a écrit :
Display.getCurrent().asyncExec(Runnable);



                                                                           
             Manuel SELVA                                                  
             <manuel.selva@st.                                             
             com>                                                       To 
             Sent by:                  GEF development                     
             gef-dev-bounces@e         <gef-dev@xxxxxxxxxxx>               
             clipse.org                                                 cc 
                                                                           
                                                                   Subject 
             05/04/2007 03:21          [gef-dev] dispatchMouseRelease      
             AM                                                            
                                                                           
                                                                           
             Please respond to                                             
              GEF development                                              
             <gef-dev@eclipse.                                             
                   org>                                                    
                                                                           
                                                                           




Hi all,

I posted this question in the forum without success so try to ask it
here (knowing that it is not the right place but ...).

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 diagram composite inside a mouseReleased event ?

Thanks in advance

Manuel Selva
_______________________________________________
gef-dev mailing list
gef-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/gef-dev


_______________________________________________
gef-dev mailing list
gef-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/gef-dev

  
Hi Randy and thanks for your answer,

It works, nethertheless i still have a question:

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 ?

Manuel Selva

Back to the top