Ignore:
Timestamp:
24.09.2011 12:09:32 (8 months ago)
Author:
simon04
Message:

fix #3951 - user should be warned when unglue-ing two ways outside the download area

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java

    r4043 r4458  
    2424import org.openstreetmap.josm.actions.MergeNodesAction; 
    2525import org.openstreetmap.josm.command.Command; 
     26import org.openstreetmap.josm.command.DeleteCommand; 
    2627import org.openstreetmap.josm.data.coor.LatLon; 
    2728import org.openstreetmap.josm.data.osm.Hash; 
     
    390391        } 
    391392 
    392         if (checkAndConfirmOutlyingDeletes(nodes, target)) 
     393        if (DeleteCommand.checkAndConfirmOutlyingDelete(Main.main.getCurrentDataSet().getDataSourceArea(), nodes, target)) 
    393394            return MergeNodesAction.mergeNodes(Main.main.getEditLayer(), nodes, target); 
    394395 
     
    406407        return true; 
    407408    } 
    408  
    409     /** 
    410      * Check whether user is about to delete data outside of the download area. 
    411      * Request confirmation if he is. 
    412      */ 
    413     private static boolean checkAndConfirmOutlyingDeletes(LinkedHashSet<Node> del, Node ignore) { 
    414         Area a = Main.main.getCurrentDataSet().getDataSourceArea(); 
    415         if (a != null) { 
    416             for (OsmPrimitive osm : del) { 
    417                 if (osm instanceof Node && !osm.isNew() && osm != ignore) { 
    418                     Node n = (Node) osm; 
    419                     if (!a.contains(n.getCoor())) { 
    420                         JPanel msg = new JPanel(new GridBagLayout()); 
    421                         msg.add(new JLabel( 
    422                                 "<html>" + 
    423                                 // leave message in one tr() as there is a grammatical 
    424                                 // connection. 
    425                                 tr("You are about to delete nodes outside of the area you have downloaded." 
    426                                         + "<br>" 
    427                                         + "This can cause problems because other objects (that you do not see) might use them." 
    428                                         + "<br>" + "Do you really want to delete?") + "</html>")); 
    429  
    430                         return ConditionalOptionPaneUtil.showConfirmationDialog( 
    431                                 "delete_outside_nodes", 
    432                                 Main.parent, 
    433                                 msg, 
    434                                 tr("Delete confirmation"), 
    435                                 JOptionPane.YES_NO_OPTION, 
    436                                 JOptionPane.QUESTION_MESSAGE, 
    437                                 JOptionPane.YES_OPTION); 
    438                     } 
    439                 } 
    440             } 
    441         } 
    442         return true; 
    443     } 
    444409} 
Note: See TracChangeset for help on using the changeset viewer.