You can't use the static method MessageDialog.open(bunch of parameters)
, you'll have to create the Dialog and call the non-static open()
yourself to check its return value.
MessageDialog dg = new MessageDialog(
window.getShell(),
"My title",
null,
"My question",
MessageDialog.QUESTION_WITH_CANCEL,
new String[]{
IDialogConstants.YES_LABEL,
IDialogConstants.NO_LABEL,
IDialogConstants.CANCEL_LABEL},
0
);
switch(dg.open()) {
case 0:
//yes
System.out.println("yes");
break;
case 1:
//no
System.out.println("no");
break;
case 2:
//cancel
System.out.println("cancel");
break;
}