Changeset 10656 in osm for applications


Ignore:
Timestamp:
2008-09-12T19:46:36+02:00 (16 years ago)
Author:
frederik
Message:
  • modified SimplifyWay action to ask "are you sure" when simplifying more than 10 ways at once
File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/utilsplugin/src/UtilsPlugin/SimplifyWayAction.java

    r9370 r10656  
    1111import java.util.LinkedList;
    1212import java.util.List;
     13
     14import javax.swing.JOptionPane;
    1315
    1416import org.openstreetmap.josm.Main;
     
    3537                Collection<OsmPrimitive> selection = Main.ds.getSelected();
    3638               
     39        int ways = 0;
     40                for (OsmPrimitive prim : selection) {
     41                        if (prim instanceof Way) {
     42                                ways++;
     43                        }
     44                }
     45
     46        if (ways == 0) {
     47            JOptionPane.showMessageDialog(Main.parent,
     48                tr("Please select at least one way to simplify."));
     49            return;
     50        } else if (ways > 10) {
     51            int option = JOptionPane.showConfirmDialog(Main.parent,
     52                tr("The selection contains {0} ways. Are you sure you want to simplify them all?", ways), tr("Are you sure?"), JOptionPane.YES_NO_OPTION);
     53            if (option != JOptionPane.YES_OPTION)
     54                return;
     55        }
     56
    3757                for (OsmPrimitive prim : selection) {
    3858                        if (prim instanceof Way) {
Note: See TracChangeset for help on using the changeset viewer.