|
Re: No Display.getCurrent() when opening Swing Component [message #160707 is a reply to message #160645] |
Mon, 06 December 2004 23:33 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
Can you post the stack trace?
Thanks.
"Florian Georg" <FGeorg@gmx.de> wrote in message
news:cp2dju$ras$1@www.eclipse.org...
> (already posted to eclipse.platform.swt - they sent me to this group)
>
> Hello,
>
> I have a (SWT based) GEF/draw2d application which opens a JFrame on
> button click (pure Swing, not SWT_AWT !)
> Beside from strange effects like deadlocks when using the Clipboard if
> the JFrame is opened modal, I've got one somehow fundamental error:
>
> The JFrame is opened, causing some visuals "from behind" to be marked as
> invalid. The asynchronous (GEF-) repaint manager triggers something like
> a repaint event with "Display.getCurrent().asyncExec(....)", which
> results in a NullPointerException...
> Is there no current display, if some Swing component has the focus ?
> It sound plausible, as the current thread is no SWT ui-thread anymore...
> but how can I work around this issue?
> Changing the call into "Display.getDefault()" is no solution, as the
> code is part of the GEF.
>
> Any ideas ?
>
> Thanks in advance
> Florian
|
|
|
|
Re: No Display.getCurrent() when opening Swing Component [message #160766 is a reply to message #160734] |
Tue, 07 December 2004 12:49 |
|
Florian Georg schrieb:
> Here's the stacktrace.
>>> It sound plausible, as the current thread is no SWT ui-thread anymore...
>>> but how can I work around this issue?
>>> Changing the call into "Display.getDefault()" is no solution, as the
>>> code is part of the GEF.
Your are right, the current thread is the AWT event thread and not the
SWT thread. You just need to ensure that you are updating your figures
inside the SWT thread.
Use Display#syncExec/asyncExec(Runnable) when posintg events to the UI
(eg. when calling FlowNodeEditPart#updateControlBar).
Cu, Gunnar
|
|
|
Powered by
FUDForum. Page generated in 0.04170 seconds