3

I am writing an eclipse plugin and I am using MessageDialog.openQuestion to pop up a question. The default answer is "Yes" but I want it to be "no". how do I do that?

Example

greg-449
  • 109,219
  • 232
  • 102
  • 145
Yass
  • 63
  • 4

2 Answers2

2

You can't do that using the openQuestion method. Instead you will have to construct the MessageDialog using one of the constructors:

MessageDialog dialog = new MessageDialog(shell, "title", null, "message",           
    MessageDialog.QUESTION, 1, IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL);

int buttonPressed = dialog.open();

The 1 is the index of the default button.

greg-449
  • 109,219
  • 232
  • 102
  • 145
0

Try to change the defaultIndex attribute of the MessageDialog constructor.

(Give a look at the docs)

Sterconium
  • 559
  • 4
  • 20