Reputation: 41087
I have the following code.
MessageDialog dialog = new MessageDialog(new Shell(), "title", null, "message", MessageDialog.QUESTION, choices, 0); // choices is an array
It is giving NPE when I do dialog.open()
. Any clue?
Upvotes: 1
Views: 314
Reputation: 29139
You cannot create a shell like that. You need to access an existing Shell from the context where you are launching the dialog. If you have a reference to any SWT control, you can access the shell from there.
Upvotes: 5
Reputation: 45684
The normal way to use a MessageDialog is via one of the static open* methods, e.g. MessageDialog.openInformation(...)
. But your issue might be related to the shell you pass.
Upvotes: 2