Changeset 2233 in josm for trunk


Ignore:
Timestamp:
2009-10-03T14:17:06+02:00 (15 years ago)
Author:
Gubaer
Message:

fixed #3605: Display a confirmation dialog when >10 objects from the server are selected for Ctrl+I/H instead of silently only opening 10

File:
1 edited

Legend:

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

    r2044 r2233  
    7777    }
    7878
     79    protected boolean confirmLaunchMultiple(int numPrimitives) {
     80        String msg  = tr(
     81                "You''re about to launch {0} browser windows.<br>"
     82                + "This may both clutter your screen with browser windows<br>"
     83                + "and take some time to finish.", numPrimitives);
     84        msg = "<html>" + msg + "</html>";
     85        String [] options = new String [] {
     86                tr("Continue"),
     87                tr("Cancel")
     88        };
     89        int ret = JOptionPane.showOptionDialog(
     90                Main.parent,
     91                msg,
     92                tr("Warning"),
     93                JOptionPane.YES_NO_OPTION,
     94                JOptionPane.WARNING_MESSAGE,
     95                null,
     96                options,
     97                options[0]
     98        );
     99        return ret == JOptionPane.YES_OPTION;
     100    }
     101
    79102    protected void launchInfoBrowsersForSelectedPrimitives() {
    80103        ArrayList<OsmPrimitive> primitivesToShow = new ArrayList<OsmPrimitive>(getCurrentDataSet().getSelected());
     
    102125        //
    103126        int max = Math.min(10, primitivesToShow.size());
    104         if (max < primitivesToShow.size()) {
    105             System.out.println(tr("WARNING: launching browser windows for the first {0} of {1} selected primitives only", 10, primitivesToShow.size()));
    106         }
     127        if (primitivesToShow.size() > max && ! confirmLaunchMultiple(primitivesToShow.size()))
     128            return;
    107129        for(int i = 0; i < max; i++) {
    108130            launchBrowser(createInfoUrl(primitivesToShow.get(i)));
Note: See TracChangeset for help on using the changeset viewer.