jtulach@312: package org.apidesign.exceptions.trycatchredo.api; jtulach@312: jtulach@312: import java.io.IOException; jtulach@312: import javax.swing.JOptionPane; jtulach@312: jtulach@312: /** Specialized I/O exception to request some kind of user confirmation. jtulach@312: * A code that needs to ask user shall not attempt to open a dialog itself, jtulach@312: * rather it shall emit this exception and let its callers show the dialog jtulach@312: * at appropriate time. jtulach@312: * jtulach@312: * @author Jaroslav Tulach jtulach@312: * @since 2.0 jtulach@312: */ jtulach@312: public abstract class UserQuestionException extends IOException { jtulach@312: /** Description of the dialog to show to the user. Whoever catches jtulach@312: * this exception shall use {@link #getQuestionPane()}.{@link JOptionPane#createDialog(java.lang.String)} jtulach@312: * to construct and display the dialog. jtulach@312: * jtulach@312: * @return the pane to display to user jtulach@312: */ jtulach@312: public abstract JOptionPane getQuestionPane(); jtulach@312: /** When the user confirms (or rejects) message presented by the jtulach@312: * {@link #getQuestionPane()} dialog, the exception shall be notified jtulach@312: * by calling this method with {@link JOptionPane#getValue()} option. jtulach@312: * jtulach@312: * @param option the option selected by the user jtulach@312: */ jtulach@312: public abstract void confirm(Object option); jtulach@312: }