提交 4f7db504 编写于 作者: S serge-rider

#2963 Confirmation+Warning default button is "Cancel"

上级 f2ca82ba
......@@ -88,7 +88,7 @@ public class ConfirmationDialog extends MessageDialogWithToggle {
message,
imageKind,
getButtonLabels(kind),
0,
getDefaultIndex(kind, imageKind),
toggleMessage,
toggleState);
dialog.setPrefStore(new PreferenceStoreDelegate(prefStore));
......@@ -115,6 +115,29 @@ public class ConfirmationDialog extends MessageDialogWithToggle {
}
}
public static int getDefaultIndex(int kind, int imageKind) {
switch (kind) {
case ERROR:
case INFORMATION:
case WARNING:
return 0;
case CONFIRM:
if (imageKind == WARNING) {
return 1;
} else {
return 0;
}
case QUESTION:
return 1;
case QUESTION_WITH_CANCEL: {
return 2;
}
default:
throw new IllegalArgumentException(
"Illegal value for kind in MessageDialog.open()"); //$NON-NLS-1$
}
}
public static boolean confirmAction(Shell shell, String id)
{
return confirmActionWithParams(shell, id);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册