Changeset 34221 in osm for applications


Ignore:
Timestamp:
2018-05-27T03:45:50+02:00 (6 years ago)
Author:
donvip
Message:

fix #josm16094 - abort "open custom url" action when dialog is canceled

Location:
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/ChooseURLAction.java

    r33676 r34221  
    3838    }
    3939
    40     public static void showConfigDialog(final boolean fast) {
     40    public static int showConfigDialog(final boolean fast) {
    4141        JPanel all = new JPanel(new GridBagLayout());
    4242
     
    7878        all.add(check1, GBC.eop().fill(GBC.HORIZONTAL).insets(5, 5, 0, 0));
    7979
    80 
    81         dialog.setContent(all, false);
    82         dialog.setButtonIcons(new String[] {"ok.png", "cancel.png"});
    83         dialog.setDefaultButton(1);
    84         dialog.showDialog();
     80        int ret = dialog.setContent(all, false)
     81              .setButtonIcons(new String[] {"ok", "cancel"})
     82              .setDefaultButton(1)
     83              .showDialog()
     84              .getValue();
    8585
    8686        int idx = list1.getSelectedIndex();
    87         if (dialog.getValue() == 1 && idx >= 0) {
     87        if (ret == 1 && idx >= 0) {
    8888            URLList.select(vals[idx]);
    8989            Main.pref.putBoolean("utilsplugin2.askurl", check1.isSelected());
    9090        }
     91        return ret;
    9192    }
    9293}
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/OpenPageAction.java

    r33991 r34221  
    5050        }
    5151
    52         if (Main.pref.getBoolean("utilsplugin2.askurl", false) == true)
    53             ChooseURLAction.showConfigDialog(true);
     52        if (Main.pref.getBoolean("utilsplugin2.askurl", false) && 1 != ChooseURLAction.showConfigDialog(true)) {
     53            return;
     54        }
    5455
    5556        MapView mv = MainApplication.getMap().mapView;
Note: See TracChangeset for help on using the changeset viewer.