Changeset 2523 in josm


Ignore:
Timestamp:
2009-11-27T22:30:40+01:00 (12 years ago)
Author:
stoecker
Message:

minor cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/ConditionalOptionPaneUtil.java

    r2522 r2523  
    108108        if (!getDialogShowingEnabled(preferenceKey))
    109109            return DIALOG_DISABLED_OPTION;
    110         MessagePanel pnl = new MessagePanel(preferenceKey, message);
     110        MessagePanel pnl = new MessagePanel(false, message);
    111111        int ret = JOptionPane.showOptionDialog(parent, pnl, title, optionType, messageType, null,options,defaultOption);
    112112
     
    147147     */
    148148    static public boolean showConfirmationDialog(String preferenceKey, Component parent, Object message, String title, int optionType, int messageType, int trueOption) throws HeadlessException {
    149         if (!getDialogShowingEnabled(preferenceKey) && (getDialogReturnValue(preferenceKey) >= 0))
     149        boolean donotshow = getDialogShowingEnabled(preferenceKey);
     150        if (donotshow && (getDialogReturnValue(preferenceKey) >= 0))
    150151            return getDialogReturnValue(preferenceKey) == trueOption;
    151         MessagePanel pnl = new MessagePanel(preferenceKey, message);
     152        MessagePanel pnl = new MessagePanel(donotshow, message);
    152153        int ret = JOptionPane.showConfirmDialog(parent, pnl, title, optionType, messageType);
    153154        if ((ret >= 0) && !pnl.getDialogShowingEnabled()) {
     
    179180        if (!getDialogShowingEnabled(preferenceKey))
    180181            return;
    181         MessagePanel pnl = new MessagePanel(preferenceKey, message);
     182        MessagePanel pnl = new MessagePanel(false, message);
    182183        JOptionPane.showMessageDialog(parent, pnl, title, messageType);
    183184        if(!pnl.getDialogShowingEnabled())
     
    194195    private static class MessagePanel extends JPanel {
    195196        JCheckBox cbShowDialog;
    196         String preferenceKey;
    197 
    198         public MessagePanel(String preferenceKey, Object message) {
    199             this.preferenceKey = preferenceKey;
     197
     198        public MessagePanel(boolean donotshow, Object message) {
    200199            cbShowDialog = new JCheckBox(tr("Do not show again"));
    201             cbShowDialog.setSelected(!ConditionalOptionPaneUtil.getDialogShowingEnabled(preferenceKey));
     200            cbShowDialog.setSelected(donotshow);
    202201            setLayout(new GridBagLayout());
    203202
Note: See TracChangeset for help on using the changeset viewer.