Ignore:
Timestamp:
2009-02-14T12:25:54+01:00 (15 years ago)
Author:
stoecker
Message:

apply patches from xeen for #1977.

Location:
trunk/src/org/openstreetmap/josm/actions
Files:
8 edited

Legend:

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

    r1169 r1397  
    3838import org.openstreetmap.josm.data.osm.TigerUtils;
    3939import org.openstreetmap.josm.data.osm.Way;
     40import org.openstreetmap.josm.gui.ExtendedDialog;
    4041import org.openstreetmap.josm.tools.GBC;
    4142import org.openstreetmap.josm.tools.Pair;
     
    108109        for (HashSet<Way> waylinks : backlinks.values()) {
    109110            if (!waylinks.containsAll(selectedWays)) {
    110                 int option = JOptionPane.showConfirmDialog(Main.parent,
    111                     tr("The selected ways have differing relation memberships.  "
    112                         + "Do you still want to combine them?"),
    113                     tr("Combine ways with different memberships?"),
    114                     JOptionPane.YES_NO_OPTION);
    115                 if (option == JOptionPane.YES_OPTION)
    116                     break;
     111                int option = new ExtendedDialog(Main.parent,
     112                        tr("Combine ways with different memberships?"),
     113                        tr("The selected ways have differing relation memberships.  "
     114                            + "Do you still want to combine them?"),
     115                        new String[] {tr("Combine Anyway"), tr("Cancel")},
     116                        new String[] {"combineway.png", "cancel.png"}).getValue(); 
     117                if (option == 1) break;
     118               
    117119                return;
    118120            }
     
    136138            Object secondTry = actuallyCombineWays(selectedWays, true);
    137139            if (secondTry instanceof List) {
    138                 int option = JOptionPane.showConfirmDialog(Main.parent,
     140                int option = new ExtendedDialog(Main.parent,
     141                    tr("Change directions?"),
    139142                    tr("The ways can not be combined in their current directions.  "
    140                     + "Do you want to reverse some of them?"), tr("Change directions?"),
    141                     JOptionPane.YES_NO_OPTION);
    142                 if (option != JOptionPane.YES_OPTION) {
    143                     return;
    144                 }
     143                        + "Do you want to reverse some of them?"),
     144                    new String[] {tr("Reverse and Combine"), tr("Cancel")},
     145                    new String[] {"wayflip.png", "cancel.png"}).getValue();
     146                if (option != 1) return;
    145147                nodeList = (List<Node>) secondTry;
    146148            } else {
     
    191193
    192194        if (!components.isEmpty()) {
    193             int answer = JOptionPane.showConfirmDialog(Main.parent, p, tr("Enter values for all conflicts."), JOptionPane.OK_CANCEL_OPTION);
    194             if (answer != JOptionPane.OK_OPTION)
    195                 return;
     195            int answer = new ExtendedDialog(Main.parent,
     196                tr("Enter values for all conflicts."),
     197                p,
     198                new String[] {tr("Solve Conflicts"), tr("Cancel")},
     199                new String[] {"dialogs/conflict.png", "cancel.png"}).getValue(); 
     200            if (answer != 1) return;
     201           
    196202            for (Entry<String, JComboBox> e : components.entrySet())
    197203                newWay.put(e.getKey(), e.getValue().getEditor().getItem().toString());
  • trunk/src/org/openstreetmap/josm/actions/DiskAccessAction.java

    r1180 r1397  
    1010
    1111import org.openstreetmap.josm.Main;
     12import org.openstreetmap.josm.gui.ExtendedDialog;
    1213import org.openstreetmap.josm.tools.Shortcut;
    1314
     
    4344        if (!open) {
    4445            File file = fc.getSelectedFile();
    45             if (file == null || (file.exists() && JOptionPane.YES_OPTION !=
    46                     JOptionPane.showConfirmDialog(Main.parent, tr("File exists. Overwrite?"), tr("Overwrite"), JOptionPane.YES_NO_OPTION)))
     46            if (file == null || (file.exists() && 1 !=
     47                new ExtendedDialog(Main.parent,
     48                        tr("Overwrite"),
     49                        tr("File exists. Overwrite?"),
     50                        new String[] {tr("Overwrite"), tr("Cancel")},
     51                        new String[] {"save_as.png", "cancel.png"}).getValue()))
    4752                return null;
    4853        }
  • trunk/src/org/openstreetmap/josm/actions/GpxExportAction.java

    r1212 r1397  
    3232import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    3333import org.openstreetmap.josm.io.GpxWriter;
     34import org.openstreetmap.josm.gui.ExtendedDialog;
    3435import org.openstreetmap.josm.tools.GBC;
    3536import org.openstreetmap.josm.tools.Shortcut;
     
    111112        p.add(keywords, GBC.eop().fill(GBC.HORIZONTAL));
    112113
    113         int answer = JOptionPane.showConfirmDialog(Main.parent, p, tr("Export options"), JOptionPane.OK_CANCEL_OPTION);
    114         if (answer != JOptionPane.OK_OPTION)
     114        int answer = new ExtendedDialog(Main.parent,
     115                        tr("Export options"),
     116                        p,
     117                        new String[] {tr("Export and Save"), tr("Cancel")},
     118                        new String[] {"exportgpx.png", "cancel.png"}).getValue(); 
     119        if (answer != 1)
    115120            return;
    116121
  • trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java

    r1169 r1397  
    3838import org.openstreetmap.josm.data.osm.Way;
    3939import org.openstreetmap.josm.data.osm.visitor.CollectBackReferencesVisitor;
     40import org.openstreetmap.josm.gui.ExtendedDialog;
    4041import org.openstreetmap.josm.tools.GBC;
    4142import org.openstreetmap.josm.tools.Pair;
     
    144145        for (HashSet<Node> nodelinks : backlinks.values()) {
    145146            if (!nodelinks.containsAll(allNodes)) {
    146                 int option = JOptionPane.showConfirmDialog(Main.parent,
    147                     tr("The selected nodes have differing relation memberships.  "
    148                         + "Do you still want to merge them?"),
    149                     tr("Merge nodes with different memberships?"),
    150                     JOptionPane.YES_NO_OPTION);
    151                 if (option == JOptionPane.YES_OPTION)
    152                     break;
     147                int option = new ExtendedDialog(Main.parent,
     148                        tr("Merge nodes with different memberships?"),
     149                        tr("The selected nodes have differing relation memberships.  "
     150                            + "Do you still want to merge them?"),
     151                        new String[] {tr("Merge Anyway"), tr("Cancel")},
     152                        new String[] {"mergenodes.png", "cancel.png"}).getValue(); 
     153                if (option == 1) break;
    153154                return null;
    154155            }
     
    191192
    192193        if (!components.isEmpty()) {
    193             int answer = JOptionPane.showConfirmDialog(Main.parent, p, tr("Enter values for all conflicts."), JOptionPane.OK_CANCEL_OPTION);
    194             if (answer != JOptionPane.OK_OPTION)
     194            int answer = new ExtendedDialog(Main.parent,
     195                tr("Enter values for all conflicts."),
     196                p,
     197                new String[] {tr("Solve Conflicts"), tr("Cancel")},
     198                new String[] {"dialogs/conflict.png", "cancel.png"}).getValue(); 
     199            if (answer != 1)
    195200                return null;
    196201            for (Entry<String, JComboBox> e : components.entrySet())
  • trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java

    r1195 r1397  
    2424import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask;
    2525import org.openstreetmap.josm.data.osm.DataSet;
     26import org.openstreetmap.josm.gui.ExtendedDialog;
    2627import org.openstreetmap.josm.gui.layer.GpxLayer;
    2728import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    5556        layer.setSelected(Main.pref.getBoolean("download.newlayer"));
    5657        JPanel all = new JPanel(new GridBagLayout());
    57         all.add(new JLabel("Enter URL to download:"), GBC.eol());
     58        all.add(new JLabel(tr("Enter URL to download:")), GBC.eol());
    5859        JTextField urltext = new JTextField(40);
    5960        all.add(urltext, GBC.eol());
    6061        all.add(layer, GBC.eol());
    61         int answer = JOptionPane.showConfirmDialog(Main.parent, all, tr("Download Location"), JOptionPane.OK_CANCEL_OPTION);
    62         if (answer != JOptionPane.OK_OPTION)
    63             return;
     62        int answer = new ExtendedDialog(Main.parent,
     63                        tr("Download Location"),
     64                        all,
     65                        new String[] {tr("Download URL"), tr("Cancel")},
     66                        new String[] {"download.png", "cancel.png"}).getValue(); 
     67        if (answer != 1) return;
    6468        openUrl(layer.isSelected(), urltext.getText());
    6569    }
  • trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java

    r1373 r1397  
    1717import org.openstreetmap.josm.Main;
    1818import org.openstreetmap.josm.data.osm.OsmPrimitive;
     19import org.openstreetmap.josm.gui.ExtendedDialog;
    1920import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2021import org.openstreetmap.josm.gui.layer.Layer;
     
    7879        }
    7980
    80         if (layer instanceof OsmDataLayer && isDataSetEmpty((OsmDataLayer)layer) && JOptionPane.NO_OPTION == JOptionPane.showConfirmDialog(Main.parent,tr("The document contains no data. Save anyway?"), tr("Empty document"), JOptionPane.YES_NO_OPTION)) {
     81        if (layer instanceof OsmDataLayer && isDataSetEmpty((OsmDataLayer)layer) && 1 != new ExtendedDialog(Main.parent, tr("Empty document"), tr("The document contains no data."), new String[] {tr("Save anyway"), tr("Cancel")}, new String[] {"save.png", "cancel.png"}).getValue()) {
    8182            return false;
    8283        }
     
    8586        }
    8687        if (!Main.map.conflictDialog.conflicts.isEmpty()) {
    87             int answer = JOptionPane.showConfirmDialog(Main.parent,
    88                     tr("There are unresolved conflicts. Conflicts will not be saved and handled as if you rejected all. Continue?"),tr("Conflicts"), JOptionPane.YES_NO_OPTION);
    89             if (answer != JOptionPane.YES_OPTION)
    90                 return false;
     88            int answer = new ExtendedDialog(Main.parent,
     89                tr("Conflicts"),
     90                tr("There are unresolved conflicts. Conflicts will not be saved and handled as if you rejected all. Continue?"),
     91                new String[] {tr("Reject Conflicts and Save"), tr("Cancel")},
     92                new String[] {"save.png", "cancel.png"}).getValue();
     93
     94            if (answer != 1) return false;
    9195        }
    9296        return true;
  • trunk/src/org/openstreetmap/josm/actions/UploadAction.java

    r1212 r1397  
    1818import org.openstreetmap.josm.Main;
    1919import org.openstreetmap.josm.data.osm.OsmPrimitive;
     20import org.openstreetmap.josm.gui.ExtendedDialog;
    2021import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
    2122import org.openstreetmap.josm.gui.PleaseWaitRunnable;
     
    9899                }
    99100
    100                 return JOptionPane.showConfirmDialog(Main.parent, p, tr("Upload these changes?"),
    101                         JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
     101                return new ExtendedDialog(Main.parent,
     102                        tr("Upload these changes?"),
     103                        p,
     104                        new String[] {tr("Upload Changes"), tr("Cancel")},
     105                        new String[] {"upload.png", "cancel.png"}).getValue() == 1; 
    102106            }
    103107        });
  • trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java

    r1375 r1397  
    2121import org.openstreetmap.josm.actions.JosmAction;
    2222import org.openstreetmap.josm.data.osm.OsmPrimitive;
     23import org.openstreetmap.josm.gui.ExtendedDialog;
    2324import org.openstreetmap.josm.tools.GBC;
    2425import org.openstreetmap.josm.tools.Shortcut;
     
    5556        JLabel label = new JLabel(tr("Please enter a search string."));
    5657        final JTextField input = new JTextField(initialValues.text);
     58        input.selectAll();
     59        input.requestFocusInWindow();
    5760        JRadioButton replace = new JRadioButton(tr("replace selection"), initialValues.mode == SearchMode.replace);
    5861        JRadioButton add = new JRadioButton(tr("add to selection"), initialValues.mode == SearchMode.add);
     
    99102        p.add(left);
    100103        p.add(right);
    101 
    102         JOptionPane pane = new JOptionPane(p, JOptionPane.INFORMATION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null) {
    103             @Override
    104             public void selectInitialValue() {
    105                 input.requestFocusInWindow();
    106                 input.selectAll();
    107             }
    108         };
    109         pane.createDialog(Main.parent, tr("Search")).setVisible(true);
    110         if (!Integer.valueOf(JOptionPane.OK_OPTION).equals(pane.getValue()))
    111             return;
     104       
     105        int result = new ExtendedDialog(Main.parent,
     106            tr("Search"),
     107            p,
     108            new String[] {tr("Start Search"), tr("Cancel")},
     109            new String[] {"dialogs/search.png", "cancel.png"}).getValue(); 
     110        if(result != 1) return;
     111
    112112        // User pressed OK - let's perform the search
    113113        SearchMode mode = replace.isSelected() ? SearchAction.SearchMode.replace
Note: See TracChangeset for help on using the changeset viewer.