# HG changeset patch # User Martin Scholl # Date 1368611870 -7200 # Node ID 7fb24e25c7cd9f90672b3969655a3266ef4f10af # Parent 01f57d488189e78a80390dc225915f3ef0f8bd2d added operation to set custom button texts for the wizard's default buttons so that users may provide custom option texts more suitable for their individual workflow diff -r 01f57d488189 -r 7fb24e25c7cd openide.dialogs/src/org/openide/WizardDescriptor.java --- a/openide.dialogs/src/org/openide/WizardDescriptor.java Wed May 15 07:06:57 2013 +0000 +++ b/openide.dialogs/src/org/openide/WizardDescriptor.java Wed May 15 11:57:50 2013 +0200 @@ -560,6 +560,45 @@ public void setClosingOptions(Object[] options) { super.setClosingOptions(convertOptions(options)); } + + /** + * Setter for the button texts of this WizardDescriptor instance. Currently supported options are:
+ * + * + *
+ *
+ * + * For more info on the possible options regarding the new text see + * {@link Mnemonics#setLocalizedText(javax.swing.AbstractButton, java.lang.String) }. + * + * @param option the button type whose text shall be set + * @param text the text for the button + * + * @throws IllegalArgumentException if the provided option is not supported + * + * @see Mnemonics#setLocalizedText(javax.swing.AbstractButton, java.lang.String) + */ + public void setButtonText(final Object option, final String text){ + final AbstractButton button; + if (WizardDescriptor.FINISH_OPTION.equals(option)) { + button = finishButton; + } else if (WizardDescriptor.CANCEL_OPTION.equals(option)) { + button = cancelButton; + } else if (WizardDescriptor.PREVIOUS_OPTION.equals(option)) { + button = previousButton; + } else if (WizardDescriptor.NEXT_OPTION.equals(option)) { + button = nextButton; + } else { + throw new IllegalArgumentException("unsupported option: " + option); // NOI18N + } + + Mnemonics.setLocalizedText(button, text); + } /** Converts some options. */