Bug 65095 MessageDialogWithToggle returns wrong value for yes_to_all
I'm using MessageDialogWithToggle class with 4 buttons: MessageDialogWithToggle dialog = new MessageDialogWithToggle( Display.getCurrent().getActiveShell(), RSCCoreUIPlugin.getString("ConfirmDeleteDialog.title_UI_"), null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL}, 1, SUBuilderPlugin.getString("CONFIRM_DELETE_DESC"), checkbox ); The following values 2, 1, 3, 1 are being returned for YES, YES_TO_ALL, NO, CANCEL buttons respectively. The YES_TO_ALL value is wrong, according to IDialogConstants it should be YES_TO_ALL_ID = 4.
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/MessageDialogWithToggle.java
*            the message for the toggle control, or <code>null</code> for
     *            the default message
     * @param toggleState
     *            the initial state for the toggle
     *  
     */
    public MessageDialogWithToggle(Shell parentShell, String dialogTitle,
            Image image, String message, int dialogImageType,
            String[] dialogButtonLabels, int defaultIndex,
            String toggleMessage, boolean toggleState) {
        super(parentShell, dialogTitle, image, message, dialogImageType,
                dialogButtonLabels, defaultIndex);
        this.toggleMessage = toggleMessage;
        this.toggleState = toggleState;
        setButtonLabels(dialogButtonLabels);
    }
    /**
     * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
     */
    protected void buttonPressed(int buttonId) {
        super.buttonPressed(buttonId);
        if (buttonId != IDialogConstants.CANCEL_ID && toggleState
                && prefStore != null && prefKey != null) {
            if (buttonId == IDialogConstants.YES_ID) {
                prefStore.setValue(prefKey, ALWAYS);
            } else if (buttonId == IDialogConstants.NO_ID) {
                prefStore.setValue(prefKey, NEVER);
            } else if (buttonId == IDialogConstants.OK_ID) {
                prefStore.setValue(prefKey, ALWAYS);
            }