Changeset 8984 in josm for trunk/src


Ignore:
Timestamp:
2015-11-03T00:39:05+01:00 (9 years ago)
Author:
Don-vip
Message:

see #12038 - add non regression test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/PurgeAction.java

    r8981 r8984  
    66import java.awt.Component;
    77import java.awt.Dimension;
     8import java.awt.GraphicsEnvironment;
    89import java.awt.GridBagLayout;
    910import java.awt.Insets;
     
    202203        }
    203204
    204         ExtendedDialog confirmDlg = new ExtendedDialog(Main.parent, tr("Confirm Purging"), new String[] {tr("Purge"), tr("Cancel")});
    205         confirmDlg.setContent(buildPanel(modified), false);
    206         confirmDlg.setButtonIcons(new String[] {"ok", "cancel"});
    207 
    208         int answer = confirmDlg.showDialog().getValue();
    209         if (answer != 1)
    210             return;
    211 
    212         Main.pref.put("purge.clear_undo_redo", cbClearUndoRedo.isSelected());
     205        boolean clearUndoRedo = false;
     206
     207        if (!GraphicsEnvironment.isHeadless()) {
     208            ExtendedDialog confirmDlg = new ExtendedDialog(Main.parent, tr("Confirm Purging"),
     209                    new String[] {tr("Purge"), tr("Cancel")});
     210            confirmDlg.setContent(buildPanel(modified), false);
     211            confirmDlg.setButtonIcons(new String[] {"ok", "cancel"});
     212
     213            int answer = confirmDlg.showDialog().getValue();
     214            if (answer != 1)
     215                return;
     216
     217            clearUndoRedo = cbClearUndoRedo.isSelected();
     218            Main.pref.put("purge.clear_undo_redo", clearUndoRedo);
     219        }
    213220
    214221        Main.main.undoRedo.add(new PurgeCommand(Main.main.getEditLayer(), toPurgeChecked, makeIncomplete));
    215222
    216         if (cbClearUndoRedo.isSelected()) {
     223        if (clearUndoRedo) {
    217224            Main.main.undoRedo.clean();
    218225            getCurrentDataSet().clearSelectionHistory();
Note: See TracChangeset for help on using the changeset viewer.