Ticket #6186: do_not_ask_delete.patch

File do_not_ask_delete.patch, 4.7 KB (added by bilbo, 15 years ago)

The patch

  • src/org/openstreetmap/josm/actions/JoinAreasAction.java

     
    4141import org.openstreetmap.josm.data.osm.RelationMember;
    4242import org.openstreetmap.josm.data.osm.TagCollection;
    4343import org.openstreetmap.josm.data.osm.Way;
     44import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;
    4445import org.openstreetmap.josm.gui.conflict.tags.CombinePrimitiveResolverDialog;
    4546import org.openstreetmap.josm.gui.conflict.tags.TagConflictResolutionUtil;
    4647import org.openstreetmap.josm.tools.Geometry;
     
    330331
    331332            allNodes.addAll(way.getNodes());
    332333        }
    333 
    334334        // TODO: Only display this warning when nodes outside dataSourceArea are deleted
    335335        Area dataSourceArea = Main.main.getCurrentDataSet().getDataSourceArea();
    336336        if (dataSourceArea != null) {
    337337            for (Node node : allNodes) {
    338338                if (!dataSourceArea.contains(node.getCoor())) {
    339                     int option = JOptionPane.showConfirmDialog(Main.parent,
    340                             trn("The selected way has nodes outside of the downloaded data region.",
     339                    boolean option = ConditionalOptionPaneUtil.showConfirmationDialog(
     340                                 "delete_outside_nodes",Main.parent,
     341                                trn("The selected way has nodes outside of the downloaded data region.",
    341342                                    "The selected ways have nodes outside of the downloaded data region.",
    342343                                    ways.size()) + "\n"
    343344                                    + tr("This can lead to nodes being deleted accidentally.") + "\n"
    344345                                    + tr("Are you really sure to continue?"),
    345346                                    tr("Please abort if you are not sure"), JOptionPane.YES_NO_OPTION,
    346                                     JOptionPane.WARNING_MESSAGE);
     347                                    JOptionPane.WARNING_MESSAGE,JOptionPane.YES_OPTION);
    347348
    348                     if (option != JOptionPane.YES_OPTION) return;
     349                    if (!option) return;
    349350                    break;
    350351                }
    351352            }
  • src/org/openstreetmap/josm/actions/SimplifyWayAction.java

     
    2727import org.openstreetmap.josm.data.osm.Node;
    2828import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2929import org.openstreetmap.josm.data.osm.Way;
     30import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;
    3031import org.openstreetmap.josm.gui.HelpAwareOptionPane;
    3132import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec;
    3233import org.openstreetmap.josm.gui.help.HelpUtil;
     
    6162    }
    6263
    6364    protected boolean confirmWayWithNodesOutsideBoundingBox() {
    64         ButtonSpec[] options = new ButtonSpec[] {
    65                 new ButtonSpec(
    66                         tr("Yes, delete nodes"),
    67                         ImageProvider.get("ok"),
    68                         tr("Delete nodes outside of downloaded data regions"),
    69                         null
    70                 ),
    71                 new ButtonSpec(
    72                         tr("No, abort"),
    73                         ImageProvider.get("cancel"),
    74                         tr("Cancel operation"),
    75                         null
    76                 )
    77         };
    78         int ret = HelpAwareOptionPane.showOptionDialog(
    79                 Main.parent,
     65        return ConditionalOptionPaneUtil.showConfirmationDialog(
     66                "delete_outside_nodes",Main.parent,
    8067                "<html>"
    8168                + trn("The selected way has nodes outside of the downloaded data region.",
    8269                        "The selected ways have nodes outside of the downloaded data region.",
     
    8774                        + tr("Do you want to delete them anyway?")
    8875                        + "</html>",
    8976                        tr("Delete nodes outside of data regions?"),
    90                         JOptionPane.WARNING_MESSAGE,
    91                         null, // no special icon
    92                         options,
    93                         options[0],
    94                         HelpUtil.ht("/Action/SimplifyWay#ConfirmDeleteNodesOutsideBoundingBoxes")
    95         );
    96         return ret == 0;
     77                        JOptionPane.YES_NO_OPTION,
     78                        JOptionPane.WARNING_MESSAGE,JOptionPane.YES_OPTION);
    9779    }
    9880
    9981    protected void alertSelectAtLeastOneWay() {