Ignore:
Timestamp:
2009-07-26T22:52:23+02:00 (15 years ago)
Author:
Gubaer
Message:

replaced JOptionDialog.show... by OptionPaneUtil.show....
improved relation editor

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

Legend:

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

    r1847 r1857  
    231231        } catch (IOException x) {
    232232            x.printStackTrace();
    233             JOptionPane.showMessageDialog(Main.parent, tr("Error while exporting {0}:\n{1}", fn,x.getMessage()), tr("Error"), JOptionPane.ERROR_MESSAGE);
     233            OptionPaneUtil.showMessageDialog(
     234                    Main.parent,
     235                    tr("Error while exporting {0}:\n{1}", fn,x.getMessage()),
     236                    tr("Error"),
     237                    JOptionPane.ERROR_MESSAGE
     238            );
    234239        }
    235240    }
     
    285290                l.setVisibleRowCount(4);
    286291                l.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    287                 int answer = JOptionPane.showConfirmDialog(Main.parent, new JScrollPane(l),tr("Choose a predefined license"), JOptionPane.OK_CANCEL_OPTION);
     292                int answer = OptionPaneUtil.showConfirmationDialog(
     293                        Main.parent,
     294                        new JScrollPane(l),
     295                        tr("Choose a predefined license"),
     296                        JOptionPane.OK_CANCEL_OPTION,
     297                        JOptionPane.QUESTION_MESSAGE
     298                );
    288299                if (answer != JOptionPane.OK_OPTION || l.getSelectedIndex() == -1)
    289300                    return;
  • trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java

    r1847 r1857  
    3737import org.openstreetmap.josm.data.osm.visitor.CollectBackReferencesVisitor;
    3838import org.openstreetmap.josm.gui.ExtendedDialog;
     39import org.openstreetmap.josm.gui.OptionPaneUtil;
    3940import org.openstreetmap.josm.tools.GBC;
    4041import org.openstreetmap.josm.tools.Pair;
     
    7273
    7374        if (selectedNodes.size() < 2) {
    74             JOptionPane.showMessageDialog(
     75            OptionPaneUtil.showMessageDialog(
    7576                    Main.parent,
    7677                    tr("Please select at least two nodes to merge."),
     
    249250                w.visit(backRefs);
    250251                if (!backRefs.data.isEmpty()) {
    251                     JOptionPane.showMessageDialog(Main.parent,
     252                    OptionPaneUtil.showMessageDialog(
     253                            Main.parent,
    252254                            tr("Cannot merge nodes: " +
    253                             "Would have to delete a way that is still used."));
     255                            "Would have to delete a way that is still used."),
     256                            tr("Warning"),
     257                            JOptionPane.WARNING_MESSAGE
     258                    );
    254259                    return null;
    255260                }
  • trunk/src/org/openstreetmap/josm/actions/MirrorAction.java

    r1847 r1857  
    1919import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2020import org.openstreetmap.josm.data.osm.Way;
     21import org.openstreetmap.josm.gui.OptionPaneUtil;
    2122import org.openstreetmap.josm.tools.Shortcut;
    2223
     
    4950
    5051        if (nodes.size() == 0) {
    51             JOptionPane.showMessageDialog(
     52            OptionPaneUtil.showMessageDialog(
    5253                    Main.parent,
    5354                    tr("Please select at least one node or way."),
  • trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java

    r1847 r1857  
    106106                }
    107107                if(delta < Math.PI/4) {
    108                     JOptionPane.showMessageDialog(Main.parent, tr("Please select ways with almost right angles to orthogonalize."));
     108                    OptionPaneUtil.showMessageDialog(
     109                            Main.parent,
     110                            tr("Please select ways with almost right angles to orthogonalize."),
     111                            tr("Information"),
     112                            JOptionPane.INFORMATION_MESSAGE
     113                    );
    109114                    return;
    110115                }
  • trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java

    r1847 r1857  
    8787    public boolean checkSaveConditions(Layer layer) {
    8888        if (layer == null) {
    89             JOptionPane.showMessageDialog(Main.parent, tr("Internal Error: cannot check conditions for no layer. Please report this as a bug."));
     89            OptionPaneUtil.showMessageDialog(
     90                    Main.parent,
     91                    tr("Internal Error: cannot check conditions for no layer. Please report this as a bug."),
     92                    tr("Error"),
     93                    JOptionPane.ERROR_MESSAGE
     94            );
    9095            return false;
    9196        }
    9297        if (Main.map == null) {
    93             JOptionPane.showMessageDialog(
     98            OptionPaneUtil.showMessageDialog(
    9499                    Main.parent,
    95100                    tr("No document open so nothing to save."),
     
    271276        } catch (IOException e) {
    272277            e.printStackTrace();
    273             JOptionPane.showMessageDialog(Main.parent, tr("An error occurred while saving.")+"\n"+e.getMessage());
     278            OptionPaneUtil.showMessageDialog(
     279                    Main.parent,
     280                    tr("An error occurred while saving. Error is: {0}", e.getMessage()),
     281                    tr("Error"),
     282                    JOptionPane.ERROR_MESSAGE
     283            );
    274284        }
    275285        try {
  • trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java

    r1843 r1857  
    3131import org.openstreetmap.josm.data.osm.visitor.AbstractVisitor;
    3232import org.openstreetmap.josm.data.osm.visitor.Visitor;
     33import org.openstreetmap.josm.gui.OptionPaneUtil;
    3334import org.openstreetmap.josm.gui.PrimitiveNameFormatter;
    3435import org.openstreetmap.josm.tools.Shortcut;
     
    6566
    6667        if (!checkSelection(selection)) {
    67             JOptionPane.showMessageDialog(Main.parent, tr("The current selection cannot be used for splitting."));
     68            OptionPaneUtil.showMessageDialog(
     69                    Main.parent,
     70                    tr("The current selection cannot be used for splitting."),
     71                    tr("Warning"),
     72                    JOptionPane.WARNING_MESSAGE
     73            );
    6874            return;
    6975        }
     
    117123            }
    118124            if (wayOccurenceCounter.isEmpty()) {
    119                 JOptionPane.showMessageDialog(Main.parent,
     125                OptionPaneUtil.showMessageDialog(Main.parent,
    120126                        trn("The selected node is not in the middle of any way.",
    121127                                "The selected nodes are not in the middle of any way.",
    122                                 selectedNodes.size()));
     128                                selectedNodes.size()),
     129                                tr("Warning"),
     130                                JOptionPane.WARNING_MESSAGE);
    123131                return;
    124132            }
     
    127135                if (entry.getValue().equals(selectedNodes.size())) {
    128136                    if (selectedWay != null) {
    129                         JOptionPane.showMessageDialog(Main.parent,
     137                        OptionPaneUtil.showMessageDialog(Main.parent,
    130138                                trn("There is more than one way using the node you selected. Please select the way also.",
    131139                                        "There is more than one way using the nodes you selected. Please select the way also.",
    132                                         selectedNodes.size()));
     140                                        selectedNodes.size()),
     141                                        tr("Warning"),
     142                                        JOptionPane.WARNING_MESSAGE);
    133143                        return;
    134144                    }
     
    138148
    139149            if (selectedWay == null) {
    140                 JOptionPane.showMessageDialog(Main.parent,
    141                         tr("The selected nodes do not share the same way."));
     150                OptionPaneUtil.showMessageDialog(Main.parent,
     151                        tr("The selected nodes do not share the same way."),
     152                        tr("Warning"),
     153                        JOptionPane.WARNING_MESSAGE);
    142154                return;
    143155            }
     
    151163            }
    152164            if (!nds.isEmpty()) {
    153                 JOptionPane.showMessageDialog(Main.parent,
     165                OptionPaneUtil.showMessageDialog(Main.parent,
    154166                        trn("The selected way does not contain the selected node.",
    155167                                "The selected way does not contain all the selected nodes.",
    156                                 selectedNodes.size()));
     168                                selectedNodes.size()),
     169                                tr("Warning"),
     170                                JOptionPane.WARNING_MESSAGE);
    157171                return;
    158172            }
     
    219233                && !nodeSet.contains(wayChunks.get(0).get(0))) {
    220234            if (wayChunks.size() == 2) {
    221                 JOptionPane.showMessageDialog(Main.parent, tr("You must select two or more nodes to split a circular way."));
     235                OptionPaneUtil.showMessageDialog(
     236                        Main.parent,
     237                        tr("You must select two or more nodes to split a circular way."),
     238                        tr("Warning"),
     239                        JOptionPane.WARNING_MESSAGE);
    222240                return;
    223241            }
     
    230248        if (wayChunks.size() < 2) {
    231249            if(wayChunks.get(0).get(0) == wayChunks.get(0).get(wayChunks.get(0).size()-1)) {
    232                 JOptionPane.showMessageDialog(Main.parent, tr("You must select two or more nodes to split a circular way."));
     250                OptionPaneUtil.showMessageDialog(
     251                        Main.parent,
     252                        tr("You must select two or more nodes to split a circular way."),
     253                        tr("Warning"),
     254                        JOptionPane.WARNING_MESSAGE);
    233255            } else {
    234                 JOptionPane.showMessageDialog(Main.parent, tr("The way cannot be split at the selected nodes. (Hint: Select nodes in the middle of the way.)"));
     256                OptionPaneUtil.showMessageDialog(
     257                        Main.parent,
     258                        tr("The way cannot be split at the selected nodes. (Hint: Select nodes in the middle of the way.)"),
     259                        tr("Warning"),
     260                        JOptionPane.WARNING_MESSAGE);
    235261            }
    236262            return;
     
    321347        }
    322348        if(warnmerole) {
    323             JOptionPane.showMessageDialog(Main.parent, tr("A role based relation membership was copied to all new ways.\nYou should verify this and correct it when necessary."));
     349            OptionPaneUtil.showMessageDialog(
     350                    Main.parent,
     351                    tr("<html>A role based relation membership was copied to all new ways.<br>You should verify this and correct it when necessary.</html>"),
     352                    tr("Warning"),
     353                    JOptionPane.WARNING_MESSAGE);
    324354        } else if(warnme) {
    325             JOptionPane.showMessageDialog(Main.parent, tr("A relation membership was copied to all new ways.\nYou should verify this and correct it when necessary."));
     355            OptionPaneUtil.showMessageDialog(
     356                    Main.parent,
     357                    tr("<html>A relation membership was copied to all new ways.<br>You should verify this and correct it when necessary.</html>"),
     358                    tr("Warning"),
     359                    JOptionPane.WARNING_MESSAGE);
    326360        }
    327361
  • trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java

    r1820 r1857  
    2727import org.openstreetmap.josm.data.osm.Way;
    2828import org.openstreetmap.josm.gui.MapView;
     29import org.openstreetmap.josm.gui.OptionPaneUtil;
    2930import org.openstreetmap.josm.tools.Shortcut;
    3031
     
    131132
    132133        if(errMsg != null) {
    133             JOptionPane.showMessageDialog(Main.parent, errMsg);
     134            OptionPaneUtil.showMessageDialog(
     135                    Main.parent,
     136                    errMsg,
     137                    tr("Error"),
     138                    JOptionPane.ERROR_MESSAGE);
    134139        }
    135140
  • trunk/src/org/openstreetmap/josm/actions/UpdateDataAction.java

    r1820 r1857  
    1515import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTaskList;
    1616import org.openstreetmap.josm.data.osm.DataSource;
     17import org.openstreetmap.josm.gui.OptionPaneUtil;
    1718import org.openstreetmap.josm.gui.layer.Layer;
    1819import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener;
     
    7374
    7475        if(bboxCount == 0) {
    75             JOptionPane.showMessageDialog(
     76            OptionPaneUtil.showMessageDialog(
    7677                    Main.parent,
    7778                    tr("No data to update found. Have you already opened or downloaded a data layer?"),
  • trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java

    r1820 r1857  
    1717import org.openstreetmap.josm.data.osm.DataSet;
    1818import org.openstreetmap.josm.data.osm.OsmPrimitive;
     19import org.openstreetmap.josm.gui.OptionPaneUtil;
    1920import org.openstreetmap.josm.gui.PleaseWaitRunnable;
    2021import org.openstreetmap.josm.gui.layer.Layer;
     
    205206        Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected();
    206207        if (selection.size() == 0) {
    207             JOptionPane.showMessageDialog(
     208            OptionPaneUtil.showMessageDialog(
    208209                    Main.parent,
    209210                    tr("There are no selected primitives to update."),
  • trunk/src/org/openstreetmap/josm/actions/UploadAction.java

    r1820 r1857  
    2626import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2727import org.openstreetmap.josm.gui.ExtendedDialog;
     28import org.openstreetmap.josm.gui.OptionPaneUtil;
    2829import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
    2930import org.openstreetmap.josm.gui.PleaseWaitRunnable;
     
    174175        ConflictCollection conflicts = Main.map.mapView.getEditLayer().getConflicts();
    175176        if (conflicts !=null && !conflicts.isEmpty()) {
    176             JOptionPane.showMessageDialog(Main.parent,tr("There are unresolved conflicts. You have to resolve these first."));
     177            OptionPaneUtil.showMessageDialog(
     178                    Main.parent,
     179                    tr("There are unresolved conflicts. You have to resolve these first."),
     180                    tr("Warning"),
     181                    JOptionPane.WARNING_MESSAGE
     182            );
    177183            Main.map.conflictDialog.action.button.setSelected(true);
    178184            Main.map.conflictDialog.action.actionPerformed(null);
  • trunk/src/org/openstreetmap/josm/actions/search/SelectionWebsiteLoader.java

    r1814 r1857  
    2020import org.openstreetmap.josm.Main;
    2121import org.openstreetmap.josm.data.osm.OsmPrimitive;
     22import org.openstreetmap.josm.gui.OptionPaneUtil;
    2223import org.openstreetmap.josm.gui.PleaseWaitRunnable;
    2324import org.openstreetmap.josm.io.OsmIdReader;
     
    5960        } catch (IOException e) {
    6061            e.printStackTrace();
    61             JOptionPane.showMessageDialog(Main.parent, tr("Could not read from URL: \"{0}\"",url));
     62            OptionPaneUtil.showMessageDialog(
     63                    Main.parent,
     64                    tr("Could not read from URL: \"{0}\"",url),
     65                    tr("Error"),
     66                    JOptionPane.ERROR_MESSAGE
     67            );
    6268        } catch (SAXException e) {
    6369            e.printStackTrace();
    64             JOptionPane.showMessageDialog(Main.parent,tr("Parsing error in URL: \"{0}\"",url));
     70            OptionPaneUtil.showMessageDialog(
     71                    Main.parent,
     72                    tr("Parsing error in URL: \"{0}\"",url),
     73                    tr("Error"),
     74                    JOptionPane.ERROR_MESSAGE
     75            );
    6576        } catch(OsmTransferException e) {
    6677            e.printStackTrace();
    6778            if (e.getCause() != null) {
    6879                if (e.getCause() instanceof IOException ) {
    69                     JOptionPane.showMessageDialog(Main.parent, tr("Could not read from URL: \"{0}\"",url),
     80                    OptionPaneUtil.showMessageDialog(
     81                            Main.parent, tr("Could not read from URL: \"{0}\"",url),
    7082                            tr("Error"), JOptionPane.ERROR_MESSAGE);
    7183                } else if (e.getCause() instanceof SAXException) {
    72                     JOptionPane.showMessageDialog(Main.parent,tr("Parsing error in URL: \"{0}\"",url),
     84                    OptionPaneUtil.showMessageDialog(Main.parent,tr("Parsing error in URL: \"{0}\"",url),
    7385                            tr("Error"), JOptionPane.ERROR_MESSAGE);
    7486                }
    7587            } else {
    76                 JOptionPane.showMessageDialog(Main.parent,tr("Error while communicating with server.",url),
     88                OptionPaneUtil.showMessageDialog(Main.parent,tr("Error while communicating with server.",url),
    7789                        tr("Error"), JOptionPane.ERROR_MESSAGE);
    7890            }
Note: See TracChangeset for help on using the changeset viewer.