Ticket #2905: undo-move-dialog-2.patch

File undo-move-dialog-2.patch, 2.1 KB (added by avarab@…, 16 years ago)

Improved patch

  • src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

     
    442442                        s.add(osm);
    443443                        s.addAll(((Way)osm).nodes);
    444444                    }
    445                     if(s.size() > max)
     445                    if(max != -1 && s.size() > max)
    446446                    {
    447                         if(1 != new ExtendedDialog(Main.parent, tr("Move elements"),
    448                                 tr("You did move more than {0} elements. "
     447                        int answer = new ExtendedDialog(Main.parent, tr("Move elements"),
     448                                tr("You moved more than {0} elements. "
    449449                                        + "Moving a large number of elements is often an error.\n"
    450450                                        + "Really move them?", max),
    451                                         new String[] {tr("Move them"), tr("Undo move")},
    452                                         new String[] {"reorder.png", "cancel.png"}).getValue())
    453                         {
     451                                        new String[] {tr("Move them"), tr("Undo move"), tr("Don't show this warning again")},
     452                                        new String[] {"reorder.png", "cancel.png", "dialogs/delete.png"}).getValue();
     453                        if (answer == 3) {
     454                            String msg = tr("You can re-enable this warning by deleting \"warn.move.maxelements\" in Advanced Preferences");
     455                            JOptionPane.showMessageDialog(Main.parent, msg);
     456                        } else {
     457                            /* } else { because we also want to undo
     458                             * it if someone closes the dialog (answer
     459                             * == 0), not just if they press "Undo
     460                             * move" (answer == 2) */
    454461                            Main.main.undoRedo.undo();
    455462                        }
    456463                        break;