Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » DispatchMouseReleased
DispatchMouseReleased [message #233774] Wed, 02 May 2007 11:47 Go to next message
Manuel Selva is currently offline Manuel SelvaFriend
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


Re: DispatchMouseReleased [message #233916 is a reply to message #233774] Fri, 04 May 2007 12:03 Go to previous messageGo to next message
Anthony Hunter is currently offline Anthony HunterFriend
Messages: 446
Registered: July 2009
Senior Member
Hi Manual,

You are going to help us a little more on this.

"dispose() the canvas that contains the diagram" == "close the graphical
editor"

Do you not want to double click on a figure to close the editor?

Cheers...
Anthony

"Manuel Selva" <manuel.selva@st.com> wrote in message
news:d5f880ea22bec662605e4a8b9a547908$1@www.eclipse.org...
> 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
>
Re: DispatchMouseReleased [message #233986 is a reply to message #233916] Wed, 09 May 2007 06:20 Go to previous message
Manuel Selva is currently offline Manuel SelvaFriend
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


Previous Topic:How to layout and repaint all EditParts?
Next Topic:GEF or GMF editor for Dynamic eCore models
Goto Forum:
  


Current Time: Mon Dec 11 04:01:30 GMT 2017

Powered by FUDForum. Page generated in 0.01699 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software