Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » NullPointerException in MessageDialog: SWT cannont find the standard dialog icons
NullPointerException in MessageDialog: SWT cannont find the standard dialog icons [message #445273] Mon, 01 November 2004 13:57 Go to next message
Jos Warmer is currently offline Jos WarmerFriend
Messages: 66
Registered: July 2009
Member
Hello,

While we are moving our plugins to Eclipse 3.0.1, we get the following error when opening a MessageDialog.
A builder is running and when it tries to show the dialog SWT has trouble finding the (default)icon.

Java Code:
MessageDialog.openQuestion(parent, title, message);

Error:
See at (1) below

If alternatively ! create a MessageDialog by hand, and make sure that it does not use an icon,
(using MessageDialog.NONE) everything works fine. This code looks as follows:

final MessageDialog dialog = new MessageDialog(
parent,
title,
null, // accept the default window icon
message,
// TODO error in SWT cannot find WARNING icon
MessageDialog.NONE,
new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL},
0); // ok is the default

Display.getDefault().syncExec(new Runnable() {
public void run() {
dialog.open();
if (dialog.getReturnCode() == Window.OK) {
overwriteExisting = true;
} else {
overwriteExisting = false;
}
}
});

However, when I change the Icon to MessageDialog.QUESTION (or anything else different from NONE)
in this code I get the same error as above.

Is this a known bug in Eclipse/SWT?

Regards,

Jos Warmer

------------------------------------------------------------ ----------------------------
(1) first error
java.lang.reflect.InvocationTargetException
at org.eclipse.jface.operation.ModalContext.run(ModalContext.ja va:284)
at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(Progress MonitorDialog.java:397)
at com.klasse.octopus.codegen.ui.actions.GenerateCodeAction.run (GenerateCodeAction.java:68)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:276)
at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPl uginAction.java:206)
at org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:915)
at org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:866)
at org.eclipse.jface.action.ActionContributionItem$8.handleEven t(ActionContributionItem.java:824)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:2772)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2431)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1377)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1348)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:254)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:141)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:96)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:335)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:273)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
at org.eclipse.core.launcher.Main.run(Main.java:704)
at org.eclipse.core.launcher.Main.main(Main.java:688)
Caused by: java.lang.NullPointerException
at org.eclipse.jface.dialogs.IconAndMessageDialog.getSWTImage(I conAndMessageDialog.java:211)
at org.eclipse.jface.dialogs.IconAndMessageDialog.getQuestionIm age(IconAndMessageDialog.java:187)
at org.eclipse.jface.dialogs.MessageDialog.<init>(MessageDialog.java:135)
at org.eclipse.jface.dialogs.MessageDialog.openQuestion(Message Dialog.java:335)
at com.klasse.octopus.codegen.transformators.helpers.FileGenera tor.showWarning(FileGenerator.java:316)
at com.klasse.octopus.codegen.transformators.helpers.FileGenera tor.askAboutOverwrite(FileGenerator.java:158)

at com.klasse.octopus.codegen.transformators.helpers.FileGenera tor.clean(FileGenerator.java:148)
at com.klasse.octopus.codegen.transformators.helpers.FileGenera tor.write(FileGenerator.java:78)
at com.klasse.octopus.codegen.transformators.TransformationCont roller.generate(TransformationController.java:96)
at com.klasse.octopus.codegen.ui.actions.GenerateCodeAction$1.e xecute(GenerateCodeAction.java:112)
at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(Worksp aceModifyOperation.java:91)
at org.eclipse.core.internal.resources.Workspace.run(Workspace. java:1673)
at org.eclipse.ui.actions.WorkspaceModifyOperation.run(Workspac eModifyOperation.java:105)
at org.eclipse.jface.operation.ModalContext$ModalContextThread. run(ModalContext.java:101)
Re: NullPointerException in MessageDialog: SWT cannont find the standard dialog icons [message #445647 is a reply to message #445273] Mon, 08 November 2004 16:01 Go to previous message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Error seems to be in:

org.eclipse.jface.dialogs.IconAndMessageDialog.getSWTImage(I conAndMessageDialog.java:211)

Please enter a bug report against Platform UI.

"Jos Warmer" <j.warmer@klasse.nl> wrote in message
news:Xns95949835CCBCjwarmerklassenl@204.138.98.10...
> Hello,
>
> While we are moving our plugins to Eclipse 3.0.1, we get the following
> error when opening a MessageDialog.
> A builder is running and when it tries to show the dialog SWT has trouble
> finding the (default)icon.
>
> Java Code:
> MessageDialog.openQuestion(parent, title, message);
>
> Error:
> See at (1) below
>
> If alternatively ! create a MessageDialog by hand, and make sure that it
> does not use an icon,
> (using MessageDialog.NONE) everything works fine. This code looks as
> follows:
>
> final MessageDialog dialog = new MessageDialog(
> parent,
> title,
> null, // accept the default window icon
> message,
> // TODO error in SWT cannot find WARNING icon
> MessageDialog.NONE,
> new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL},
> 0); // ok is the default
>
> Display.getDefault().syncExec(new Runnable() {
> public void run() {
> dialog.open();
> if (dialog.getReturnCode() == Window.OK) {
> overwriteExisting = true;
> } else {
> overwriteExisting = false;
> }
> }
> });
>
> However, when I change the Icon to MessageDialog.QUESTION (or anything
> else different from NONE)
> in this code I get the same error as above.
>
> Is this a known bug in Eclipse/SWT?
>
> Regards,
>
> Jos Warmer
>
> ------------------------------------------------------------ ----------------------------
> (1) first error
> java.lang.reflect.InvocationTargetException
> at org.eclipse.jface.operation.ModalContext.run(ModalContext.ja va:284)
> at
> org.eclipse.jface.dialogs.ProgressMonitorDialog.run(Progress MonitorDialog.java:397)
> at
> com.klasse.octopus.codegen.ui.actions.GenerateCodeAction.run (GenerateCodeAction.java:68)
> at
> org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:276)
> at
> org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPl uginAction.java:206)
> at
> org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:915)
> at
> org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:866)
> at
> org.eclipse.jface.action.ActionContributionItem$8.handleEven t(ActionContributionItem.java:824)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :82)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:2772)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2431)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1377)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1348)
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:254)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:141)
> at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:96)
> at
> org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:335)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:273)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:129)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
> at org.eclipse.core.launcher.Main.run(Main.java:704)
> at org.eclipse.core.launcher.Main.main(Main.java:688)
> Caused by: java.lang.NullPointerException
> at
> org.eclipse.jface.dialogs.IconAndMessageDialog.getSWTImage(I conAndMessageDialog.java:211)
> at
> org.eclipse.jface.dialogs.IconAndMessageDialog.getQuestionIm age(IconAndMessageDialog.java:187)
> at org.eclipse.jface.dialogs.MessageDialog.<init>(MessageDialog.java:135)
> at
> org.eclipse.jface.dialogs.MessageDialog.openQuestion(Message Dialog.java:335)
> at
> com.klasse.octopus.codegen.transformators.helpers.FileGenera tor.showWarning(FileGenerator.java:316)
> at
> com.klasse.octopus.codegen.transformators.helpers.FileGenera tor.askAboutOverwrite(FileGenerator.java:158)
>
> at
> com.klasse.octopus.codegen.transformators.helpers.FileGenera tor.clean(FileGenerator.java:148)
> at
> com.klasse.octopus.codegen.transformators.helpers.FileGenera tor.write(FileGenerator.java:78)
> at
> com.klasse.octopus.codegen.transformators.TransformationCont roller.generate(TransformationController.java:96)
> at
> com.klasse.octopus.codegen.ui.actions.GenerateCodeAction$1.e xecute(GenerateCodeAction.java:112)
> at
> org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(Worksp aceModifyOperation.java:91)
> at org.eclipse.core.internal.resources.Workspace.run(Workspace. java:1673)
> at
> org.eclipse.ui.actions.WorkspaceModifyOperation.run(Workspac eModifyOperation.java:105)
> at
> org.eclipse.jface.operation.ModalContext$ModalContextThread. run(ModalContext.java:101)
>
Previous Topic:Borderless Buttons
Next Topic:Use of Keyboard Shortcuts
Goto Forum:
  


Current Time: Wed Oct 28 12:06:56 GMT 2020

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

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

Back to the top