swt error opening a dialog [message #466353] |
Sun, 08 January 2006 09:00 |
Eclipse User |
|
|
|
Originally posted by: marguu.libero.it
Opening a dialog in order to let the user insert his own values for an
element, I obtain this error:
org.eclipse.swt.SWTException: Failed to execute runnable
(java.lang.NullPointerException)
at org.eclipse.swt.SWT.error(SWT.java:2942)
at org.eclipse.swt.SWT.error(SWT.java:2865)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:126)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3057)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2716)
at
genericUMLDiagramEditor.dialogs.ContainerPropertiesInputDial og.open(ContainerPropertiesInputDialog.java:125)
I use this code in the open method:
public String open() {
// Create the dialog window
Shell shell = new Shell(getParent(), getStyle());
shell.setText(getText());
createContents(shell);
shell.setSize(400,370);
shell.setLocation(200,200);
shell.open();
Display display = getParent().getDisplay();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
// Return the entered value, or null
return input1;
}
I don't understand where is the problem; I use this structure in other
classes in my project and all work fine. Thanks
|
|
|
|
Re: swt error opening a dialog [message #466376 is a reply to message #466355] |
Mon, 09 January 2006 20:42 |
Eclipse User |
|
|
|
Originally posted by: marguu.libero.it
but I don't lunch a sync (or async) runnable, symply opern the dialog (and
all my variable aren't null)
0:-(
Haris Peco wrote:
> you try open dialog in non-ui thread (probably) - your display
> is null - try with Display.getDefault().syncExec(...)
> or in rcp PlatformUI.getWorkbench().getDisplay().sync(...)
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03143 seconds