Changeset 1847 in josm for trunk/src/org/openstreetmap/josm


Ignore:
Timestamp:
2009-07-25T23:44:19+02:00 (15 years ago)
Author:
Gubaer
Message:

replaced calls to JOptionPane.* by calls to OptionPaneUtil.*

Location:
trunk/src/org/openstreetmap/josm
Files:
37 edited

Legend:

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

    r1820 r1847  
    1313import org.openstreetmap.josm.Main;
    1414import org.openstreetmap.josm.data.osm.OsmPrimitive;
     15import org.openstreetmap.josm.gui.OptionPaneUtil;
    1516import org.openstreetmap.josm.tools.OpenBrowser;
    1617import org.openstreetmap.josm.tools.Shortcut;
     
    5859
    5960        if (primitivesToShow.isEmpty()) {
    60             JOptionPane.showMessageDialog(
     61            OptionPaneUtil.showMessageDialog(
    6162                    Main.parent,
    6263                    tr("Please select at least one already uploaded node, way, or relation."),
  • trunk/src/org/openstreetmap/josm/actions/AlignInCircleAction.java

    r1846 r1847  
    2222import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2323import org.openstreetmap.josm.data.osm.Way;
     24import org.openstreetmap.josm.gui.OptionPaneUtil;
    2425import org.openstreetmap.josm.tools.Shortcut;
    2526
     
    132133
    133134        if (nodes.size() < 4) {
    134             JOptionPane.showMessageDialog(Main.parent, tr("Please select at least four nodes."));
     135            OptionPaneUtil.showMessageDialog(
     136                    Main.parent,
     137                    tr("Please select at least four nodes."),
     138                    tr("Information"),
     139                    JOptionPane.INFORMATION_MESSAGE
     140            );
    135141            return;
    136142        }
  • trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java

    r1820 r1847  
    1818import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1919import org.openstreetmap.josm.data.osm.Way;
     20import org.openstreetmap.josm.gui.OptionPaneUtil;
    2021import org.openstreetmap.josm.tools.Shortcut;
    2122
     
    6061        }
    6162        if (nodes.size() < 3) {
    62             JOptionPane.showMessageDialog(Main.parent, tr("Please select at least three nodes."));
     63            OptionPaneUtil.showMessageDialog(
     64                    Main.parent,
     65                    tr("Please select at least three nodes."),
     66                    tr("Information"),
     67                    JOptionPane.INFORMATION_MESSAGE
     68            );
    6369            return;
    6470        }
  • trunk/src/org/openstreetmap/josm/actions/ApiPreconditionChecker.java

    r1843 r1847  
    1515import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1616import org.openstreetmap.josm.data.osm.Way;
     17import org.openstreetmap.josm.gui.OptionPaneUtil;
    1718import org.openstreetmap.josm.io.OsmApi;
    1819import org.openstreetmap.josm.io.OsmApiInitializationException;
     
    4748                total = add.size() + update.size() + delete.size();
    4849                if(total > maxElements) {
    49                     JOptionPane.showMessageDialog(
     50                    OptionPaneUtil.showMessageDialog(
    5051                            Main.parent,
    5152                            tr("Current number of changes exceeds the max. number of changes, current is {0}, max is {1}",
     
    6162        } catch (OsmApiInitializationException e) {
    6263            e.printStackTrace();
    63             JOptionPane.showMessageDialog(
     64            OptionPaneUtil.showMessageDialog(
    6465                    Main.parent,
    6566                    tr("Failed to initialize API. Please try again later."),
     
    8889                        continue;
    8990                    }
    90                     JOptionPane.showMessageDialog(Main.parent,
     91                    OptionPaneUtil.showMessageDialog(Main.parent,
    9192                            tr("Length of value for tag ''{0}'' on primitive {1} exceeds the max. allowed length {2}. Values length is {3}.",
    9293                                    e.getKey(), Long.toString(osmPrimitive.id), 255, e.getValue().length()
     
    104105            if (osmPrimitive instanceof Way &&
    105106                    ((Way)osmPrimitive).nodes.size() > maxNodes) {
    106                 JOptionPane.showMessageDialog(
     107                OptionPaneUtil.showMessageDialog(
    107108                        Main.parent,
    108109                        tr("{0} nodes in way {1} exceed the max. allowed number of nodes {2}",
  • trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java

    r1820 r1847  
    1616import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1717import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
     18import org.openstreetmap.josm.gui.OptionPaneUtil;
    1819import org.openstreetmap.josm.gui.layer.Layer;
    1920import org.openstreetmap.josm.tools.Shortcut;
     
    8687            }
    8788            if (sel.isEmpty()) {
    88                 JOptionPane.showMessageDialog(Main.parent,
    89                         mode.equals("selection") ? tr("Nothing selected to zoom to.") : tr("No conflicts to zoom to"));
     89                OptionPaneUtil.showMessageDialog(
     90                        Main.parent,
     91                        (mode.equals("selection") ? tr("Nothing selected to zoom to.") : tr("No conflicts to zoom to")),
     92                        tr("Information"),
     93                        JOptionPane.INFORMATION_MESSAGE
     94                );
    9095                return null;
    9196            }
  • trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java

    r1820 r1847  
    3737import org.openstreetmap.josm.data.osm.Way;
    3838import org.openstreetmap.josm.gui.ExtendedDialog;
     39import org.openstreetmap.josm.gui.OptionPaneUtil;
    3940import org.openstreetmap.josm.tools.GBC;
    4041import org.openstreetmap.josm.tools.Pair;
     
    6566
    6667        if (selectedWays.size() < 2) {
    67             JOptionPane.showMessageDialog(Main.parent, tr("Please select at least two ways to combine."));
     68            OptionPaneUtil.showMessageDialog(
     69                    Main.parent,
     70                    tr("Please select at least two ways to combine."),
     71                    tr("Information"),
     72                    JOptionPane.INFORMATION_MESSAGE
     73            );
    6874            return;
    6975        }
     
    152158                nodeList = (List<Node>) secondTry;
    153159            } else {
    154                 JOptionPane.showMessageDialog(Main.parent, secondTry);
     160                OptionPaneUtil.showMessageDialog(
     161                        Main.parent,
     162                        secondTry, // FIXME: not sure whether this fits in a dialog
     163                        tr("Information"),
     164                        JOptionPane.INFORMATION_MESSAGE
     165                );
    155166                return;
    156167            }
  • trunk/src/org/openstreetmap/josm/actions/CopyAction.java

    r1820 r1847  
    2424import org.openstreetmap.josm.data.osm.Way;
    2525import org.openstreetmap.josm.data.osm.visitor.AbstractVisitor;
     26import org.openstreetmap.josm.gui.OptionPaneUtil;
    2627import org.openstreetmap.josm.tools.Shortcut;
    2728
     
    136137        Collection<OsmPrimitive> sel = getCurrentDataSet().getSelected();
    137138        if (sel.isEmpty()) {
    138             JOptionPane.showMessageDialog(
     139            OptionPaneUtil.showMessageDialog(
    139140                    Main.parent,
    140                     tr("Please select something to copy.")
     141                    tr("Please select something to copy."),
     142                    tr("Information"),
     143                    JOptionPane.INFORMATION_MESSAGE
    141144            );
    142145            return true;
  • trunk/src/org/openstreetmap/josm/actions/CreateCircleAction.java

    r1846 r1847  
    2323import org.openstreetmap.josm.data.osm.Way;
    2424import org.openstreetmap.josm.data.osm.visitor.CollectBackReferencesVisitor;
     25import org.openstreetmap.josm.gui.OptionPaneUtil;
    2526import org.openstreetmap.josm.tools.Shortcut;
    2627
     
    202203
    203204            if (sUnder == 0) {
    204                 JOptionPane.showMessageDialog(Main.parent, tr("Those nodes are not in a circle."));
     205                OptionPaneUtil.showMessageDialog(
     206                        Main.parent,
     207                        tr("Those nodes are not in a circle. Aborting."),
     208                        tr("Warning"),
     209                        JOptionPane.WARNING_MESSAGE
     210                );
    205211                return;
    206212            }
     
    261267
    262268        } else {
    263             JOptionPane.showMessageDialog(Main.parent, tr("Please select exactly two or three nodes or one way with exactly two or three nodes."));
     269            OptionPaneUtil.showMessageDialog(
     270                    Main.parent,
     271                    tr("Please select exactly two or three nodes or one way with exactly two or three nodes."),
     272                    tr("Information"),
     273                    JOptionPane.INFORMATION_MESSAGE
     274            );
    264275            return;
    265276        }
  • trunk/src/org/openstreetmap/josm/actions/DistributeAction.java

    r1820 r1847  
    1818import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1919import org.openstreetmap.josm.data.osm.Way;
     20import org.openstreetmap.josm.gui.OptionPaneUtil;
    2021import org.openstreetmap.josm.tools.Shortcut;
    2122
     
    5960
    6061        if (nodes.size() < 3) {
    61             JOptionPane.showMessageDialog(Main.parent, tr("Please select at least three nodes."));
     62            OptionPaneUtil.showMessageDialog(
     63                    Main.parent,
     64                    tr("Please select at least three nodes."),
     65                    tr("Information"),
     66                    JOptionPane.INFORMATION_MESSAGE
     67            );
    6268            return;
    6369        }
  • trunk/src/org/openstreetmap/josm/actions/DownloadAction.java

    r1811 r1847  
    1313
    1414import org.openstreetmap.josm.Main;
     15import org.openstreetmap.josm.gui.OptionPaneUtil;
    1516import org.openstreetmap.josm.gui.download.DownloadDialog;
    1617import org.openstreetmap.josm.gui.download.DownloadDialog.DownloadTask;
     
    3233    public DownloadAction() {
    3334        super(tr("Download from OSM..."), "download", tr("Download map data from the OSM server."),
    34         Shortcut.registerShortcut("file:download", tr("File: {0}", tr("Download from OSM...")), KeyEvent.VK_D, Shortcut.GROUPS_ALT1+Shortcut.GROUP_HOTKEY), true);
     35                Shortcut.registerShortcut("file:download", tr("File: {0}", tr("Download from OSM...")), KeyEvent.VK_D, Shortcut.GROUPS_ALT1+Shortcut.GROUP_HOTKEY), true);
    3536    }
    3637
     
    4647        dialog.setOptionPane(pane);
    4748
    48         if (dlg.getWidth() > 1000)
     49        if (dlg.getWidth() > 1000) {
    4950            dlg.setSize(1000, dlg.getHeight());
    50         if (dlg.getHeight() > 600)
     51        }
     52        if (dlg.getHeight() > 600) {
    5153            dlg.setSize(dlg.getWidth(),600);
     54        }
    5255
    5356        boolean finish = false;
     
    6467                    }
    6568                }
    66             } else
     69            } else {
    6770                finish = true;
    68             if (!finish)
    69                 JOptionPane.showMessageDialog(Main.parent, tr("Please select at least one task to download"));
     71            }
     72            if (!finish) {
     73                OptionPaneUtil.showMessageDialog(
     74                        Main.parent,
     75                        tr("Please select at least one task to download"),
     76                        tr("Error"),
     77                        JOptionPane.ERROR_MESSAGE
     78                );
     79            }
    7080        }
    7181
    72                 dialog = null;
     82        dialog = null;
    7383        dlg.dispose();
    7484    }
  • trunk/src/org/openstreetmap/josm/actions/DownloadReferrersAction.java

    r1820 r1847  
    1818import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1919import org.openstreetmap.josm.data.osm.visitor.MergeVisitor;
     20import org.openstreetmap.josm.gui.OptionPaneUtil;
    2021import org.openstreetmap.josm.gui.PleaseWaitRunnable;
    2122import org.openstreetmap.josm.gui.layer.Layer;
     
    8586                msg = lastException.toString();
    8687            }
    87             JOptionPane.showMessageDialog(
     88            OptionPaneUtil.showMessageDialog(
    8889                    Main.map,
    8990                    msg,
     
    121122                return;
    122123            Main.map.mapView.getEditLayer().getConflicts().add(visitor.getConflicts());
    123             JOptionPane op = new JOptionPane(
     124            OptionPaneUtil.showMessageDialog(
     125                    Main.parent,
    124126                    tr("There were {0} conflicts during import.",
    125                             visitor.getConflicts().size()),
    126                             JOptionPane.WARNING_MESSAGE
     127                            visitor.getConflicts().size()
     128                    ),
     129                    tr("Conflicts during download"),
     130                    JOptionPane.WARNING_MESSAGE
    127131            );
    128             JDialog dialog = op.createDialog(null, tr("Conflicts in data"));
    129             dialog.setAlwaysOnTop(true);
    130             dialog.setModal(true);
    131             dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    132             dialog.setVisible(true);
    133132        }
    134133
  • trunk/src/org/openstreetmap/josm/actions/GpxExportAction.java

    r1820 r1847  
    2929import org.openstreetmap.josm.data.gpx.GpxData;
    3030import org.openstreetmap.josm.gui.ExtendedDialog;
     31import org.openstreetmap.josm.gui.OptionPaneUtil;
    3132import org.openstreetmap.josm.gui.layer.GpxLayer;
    3233import org.openstreetmap.josm.gui.layer.Layer;
     
    6263        GpxLayer layer = getLayer();
    6364        if (layer == null) {
    64             JOptionPane.showMessageDialog(Main.parent, tr("Nothing to export. Get some data first."));
     65            OptionPaneUtil.showMessageDialog(
     66                    Main.parent,
     67                    tr("Nothing to export. Get some data first."),
     68                    tr("Information"),
     69                    JOptionPane.INFORMATION_MESSAGE
     70            );
    6571            return;
    6672        }
  • trunk/src/org/openstreetmap/josm/actions/HelpAction.java

    r1820 r1847  
    3030
    3131import org.openstreetmap.josm.Main;
     32import org.openstreetmap.josm.gui.OptionPaneUtil;
    3233import org.openstreetmap.josm.tools.ImageProvider;
    3334import org.openstreetmap.josm.tools.LanguageInfo;
     
    110111        } else if (tr("Edit").equals(e.getActionCommand())) {
    111112            if (!url.startsWith(baseurl)) {
    112                 JOptionPane.showMessageDialog(Main.parent, tr("Can only edit help pages from JOSM Online Help"));
     113                OptionPaneUtil.showMessageDialog(
     114                        Main.parent,
     115                        tr("Can only edit help pages from JOSM Online Help"),
     116                        tr("Warning"),
     117                        JOptionPane.WARNING_MESSAGE
     118                );
    113119                return;
    114120            }
  • trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java

    r1820 r1847  
    7272
    7373        if (selectedNodes.size() < 2) {
    74             JOptionPane.showMessageDialog(Main.parent, tr("Please select at least two nodes to merge."));
     74            JOptionPane.showMessageDialog(
     75                    Main.parent,
     76                    tr("Please select at least two nodes to merge."),
     77                    tr("Warning"),
     78                    JOptionPane.WARNING_MESSAGE
     79            );
    7580            return;
    7681        }
  • trunk/src/org/openstreetmap/josm/actions/MirrorAction.java

    r1820 r1847  
    4949
    5050        if (nodes.size() == 0) {
    51             JOptionPane.showMessageDialog(Main.parent, tr("Please select at least one node or way."));
     51            JOptionPane.showMessageDialog(
     52                    Main.parent,
     53                    tr("Please select at least one node or way."),
     54                    tr("Information"),
     55                    JOptionPane.INFORMATION_MESSAGE
     56            );
    5257            return;
    5358        }
  • trunk/src/org/openstreetmap/josm/actions/MoveAction.java

    r1820 r1847  
    1717import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1818import org.openstreetmap.josm.data.osm.visitor.AllNodesVisitor;
     19import org.openstreetmap.josm.gui.OptionPaneUtil;
    1920import org.openstreetmap.josm.tools.Shortcut;
    2021
     
    102103                // Revert move
    103104                ((MoveCommand) c).moveAgain(-distx, -disty);
    104                 JOptionPane.showMessageDialog(Main.parent,
    105                         tr("Cannot move objects outside of the world."));
     105                OptionPaneUtil.showMessageDialog(
     106                        Main.parent,
     107                        tr("Cannot move objects outside of the world."),
     108                        tr("Warning"),
     109                        JOptionPane.WARNING_MESSAGE
     110                );
    106111                return;
    107112            }
  • trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java

    r1637 r1847  
    1313
    1414import org.openstreetmap.josm.Main;
     15import org.openstreetmap.josm.gui.OptionPaneUtil;
    1516import org.openstreetmap.josm.io.FileImporter;
    1617import org.openstreetmap.josm.tools.Shortcut;
     
    2930    public OpenFileAction() {
    3031        super(tr("Open..."), "open", tr("Open a file."),
    31         Shortcut.registerShortcut("system:open", tr("File: {0}", tr("Open...")), KeyEvent.VK_O, Shortcut.GROUP_MENU));
     32                Shortcut.registerShortcut("system:open", tr("File: {0}", tr("Open...")), KeyEvent.VK_O, Shortcut.GROUP_MENU));
    3233    }
    3334
     
    3738            return;
    3839        File[] files = fc.getSelectedFiles();
    39         for (int i = files.length; i > 0; --i)
     40        for (int i = files.length; i > 0; --i) {
    4041            openFile(files[i-1]);
     42        }
    4143    }
    4244
     
    4850            System.out.println("Open file: " + file.getAbsolutePath() + " (" + file.length() + " bytes)");
    4951            for (FileImporter importer : ExtensionFileFilter.importers)
    50                 if (importer.acceptFile(file))
     52                if (importer.acceptFile(file)) {
    5153                    importer.importData(file);
     54                }
    5255        } catch (IOException x) {
    5356            x.printStackTrace();
    54             JOptionPane.showMessageDialog(Main.parent, tr("Could not read \"{0}\"", file.getName()) + "\n"
    55                     + x.getMessage());
     57            OptionPaneUtil.showMessageDialog(
     58                    Main.parent,
     59                    tr("<html>Could not read file ''{0}\''. Error is: <br>{1}</html>", file.getName(), x.getMessage()),
     60                    tr("Error"),
     61                    JOptionPane.ERROR_MESSAGE
     62            );
     63
    5664        }
    5765    }
  • trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java

    r1838 r1847  
    1212
    1313import javax.swing.JOptionPane;
     14import javax.swing.text.html.Option;
    1415
    1516import org.openstreetmap.josm.Main;
     
    2324import org.openstreetmap.josm.data.osm.Way;
    2425import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;
     26import org.openstreetmap.josm.gui.OptionPaneUtil;
    2527import org.openstreetmap.josm.tools.Shortcut;
    2628
     
    5759            if(osm instanceof Node) {
    5860                if(dirnodes.size() == 2) {
    59                     JOptionPane.showMessageDialog(Main.parent, tr("Only two nodes allowed"));
     61                    OptionPaneUtil.showMessageDialog(
     62                            Main.parent,
     63                            tr("Only two nodes allowed"),
     64                            tr("Information"),
     65                            JOptionPane.INFORMATION_MESSAGE
     66                    );
    6067                    return;
    6168                }
     
    6572            // Check if selection consists now only of ways
    6673            if (!(osm instanceof Way)) {
    67                 JOptionPane.showMessageDialog(Main.parent, tr("Selection must consist only of ways."));
     74                OptionPaneUtil.showMessageDialog(
     75                        Main.parent,
     76                        tr("Selection must consist only of ways."),
     77                        tr("Information"),
     78                        JOptionPane.INFORMATION_MESSAGE
     79                );
    6880                return;
    6981            }
     
    7284            Way way = (Way)osm;
    7385            if ((way.nodes.size() < 5) || (!way.nodes.get(0).equals(way.nodes.get(way.nodes.size() - 1)))) {
    74                 JOptionPane.showMessageDialog(Main.parent, tr("Please select one or more closed ways of at least four nodes."));
     86                OptionPaneUtil.showMessageDialog(
     87                        Main.parent,
     88                        tr("Please select one or more closed ways of at least four nodes."),
     89                        tr("Information"),
     90                        JOptionPane.INFORMATION_MESSAGE
     91                );
    7592                return;
    7693            }
     
    112129        // Check, if selection held neither none nor two nodes
    113130        if(dirnodes.size() == 1) {
    114             JOptionPane.showMessageDialog(Main.parent, tr("Only one node selected"));
     131            OptionPaneUtil.showMessageDialog(
     132                    Main.parent,
     133                    tr("Only one node selected"),
     134                    tr("Warning"),
     135                    JOptionPane.WARNING_MESSAGE
     136            );
    115137            return;
    116138        }
  • trunk/src/org/openstreetmap/josm/actions/PasteTagsAction.java

    r1843 r1847  
    103103        /* only enable if there is something selected to paste into and
    104104            if we don't have conflicting keys in the pastebuffer */
    105         setEnabled(selection != null &&
    106                 ! selection.isEmpty() &&
    107                 ! pasteBuffer.allPrimitives().isEmpty() &&
    108                 (getCurrentDataSet().getSelectedNodes().isEmpty() ||
    109                         ! containsSameKeysWithDifferentValues(pasteBuffer.nodes)) &&
    110                         (getCurrentDataSet().getSelectedWays().isEmpty() ||
    111                                 ! containsSameKeysWithDifferentValues(pasteBuffer.ways)) &&
    112                                 (getCurrentDataSet().getSelectedRelations().isEmpty() ||
    113                                         ! containsSameKeysWithDifferentValues(pasteBuffer.relations)));
     105        DataSet ds = getCurrentDataSet();
     106        if (ds == null || ds.getSelected().isEmpty() || pasteBuffer == null || pasteBuffer.allPrimitives().isEmpty()) {
     107            setEnabled(false);
     108            return;
     109        }
     110        setEnabled((!ds.getSelectedNodes().isEmpty() && ! containsSameKeysWithDifferentValues(pasteBuffer.nodes)) ||
     111                (!ds.getSelectedWays().isEmpty() && ! containsSameKeysWithDifferentValues(pasteBuffer.ways)) ||
     112                (! ds.getSelectedRelations().isEmpty() && ! containsSameKeysWithDifferentValues(pasteBuffer.relations)));
    114113    }
    115114
    116115    @Override public void pasteBufferChanged(DataSet newPasteBuffer) {
    117         possiblyEnable(getCurrentDataSet().getSelected(), newPasteBuffer);
     116        updateEnabledState();
    118117    }
    119118
  • trunk/src/org/openstreetmap/josm/actions/RenameLayerAction.java

    r1646 r1847  
    1515
    1616import org.openstreetmap.josm.Main;
     17import org.openstreetmap.josm.gui.OptionPaneUtil;
    1718import org.openstreetmap.josm.gui.layer.Layer;
    1819import org.openstreetmap.josm.tools.ImageProvider;
     
    5253            filerename.setEnabled(file != null);
    5354        }
    54         if (filerename.isEnabled())
     55        if (filerename.isEnabled()) {
    5556            filerename.setSelected(Main.pref.getBoolean("layer.rename-file", true));
     57        }
    5658
    5759        final JOptionPane optionPane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION){
     
    6264        };
    6365        final JDialog dlg = optionPane.createDialog(Main.parent, tr("Rename layer"));
     66        dlg.setModal(true);
     67        dlg.setAlwaysOnTop(true);
     68        dlg.toFront();
    6469        dlg.setVisible(true);
    6570
    6671        Object answer = optionPane.getValue();
    6772        if (answer == null || answer == JOptionPane.UNINITIALIZED_VALUE ||
    68                 (answer instanceof Integer && (Integer)answer != JOptionPane.OK_OPTION)) {
     73                (answer instanceof Integer && (Integer)answer != JOptionPane.OK_OPTION))
    6974            return;
    70         }
    7175
    7276        String nameText = name.getText();
     
    7579            if (filerename.isSelected()) {
    7680                String newname = nameText;
    77                 if (newname.indexOf("/") == -1 && newname.indexOf("\\") == -1)
     81                if (newname.indexOf("/") == -1 && newname.indexOf("\\") == -1) {
    7882                    newname = file.getParent() + File.separator + newname;
     83                }
    7984                String oldname = file.getName();
    80                 if (name.getText().indexOf('.') == -1 && oldname.indexOf('.') >= 0)
     85                if (name.getText().indexOf('.') == -1 && oldname.indexOf('.') >= 0) {
    8186                    newname += oldname.substring(oldname.lastIndexOf('.'));
     87                }
    8288                File newFile = new File(newname);
    8389                if (file.renameTo(newFile)) {
     
    8591                    nameText = newFile.getName();
    8692                } else {
    87                     JOptionPane.showMessageDialog(Main.parent, tr("Could not rename the file \"{0}\".", file.getPath()));
     93                    OptionPaneUtil.showMessageDialog(
     94                            Main.parent,
     95                            tr("Could not rename file ''{0}''", file.getPath()),
     96                            tr("Error"),
     97                            JOptionPane.ERROR_MESSAGE
     98                    );
    8899                    return;
    89100                }
  • trunk/src/org/openstreetmap/josm/actions/ReverseWayAction.java

    r1844 r1847  
    2121import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2222import org.openstreetmap.josm.data.osm.Way;
     23import org.openstreetmap.josm.gui.OptionPaneUtil;
    2324import org.openstreetmap.josm.tools.Shortcut;
    2425
     
    4344        }
    4445        if (sel.isEmpty()) {
    45             JOptionPane.showMessageDialog(Main.parent,
    46                     tr("Please select at least one way."));
     46            OptionPaneUtil.showMessageDialog(
     47                    Main.parent,
     48                    tr("Please select at least one way."),
     49                    tr("Information"),
     50                    JOptionPane.INFORMATION_MESSAGE
     51            );
    4752            return;
    4853        }
  • trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java

    r1820 r1847  
    2323import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2424import org.openstreetmap.josm.gui.ExtendedDialog;
     25import org.openstreetmap.josm.gui.OptionPaneUtil;
    2526import org.openstreetmap.josm.gui.layer.GpxLayer;
    2627import org.openstreetmap.josm.gui.layer.Layer;
     
    9091        }
    9192        if (Main.map == null) {
    92             JOptionPane.showMessageDialog(Main.parent, tr("No document open so nothing to save."));
     93            JOptionPane.showMessageDialog(
     94                    Main.parent,
     95                    tr("No document open so nothing to save."),
     96                    tr("Warning"),
     97                    JOptionPane.WARNING_MESSAGE
     98            );
    9399            return false;
    94100        }
     
    128134            dstStream = new FileOutputStream(dst);
    129135        } catch (FileNotFoundException e) {
    130             JOptionPane.showMessageDialog(Main.parent, tr("Could not back up file.")+"\n"+e.getMessage());
     136            OptionPaneUtil.showMessageDialog(
     137                    Main.parent,
     138                    tr("Could not back up file. Exception is: {0}", e.getMessage()),
     139                    tr("Error"),
     140                    JOptionPane.ERROR_MESSAGE
     141            );
    131142            return;
    132143        }
     
    192203                }
    193204            } else {
    194                 JOptionPane.showMessageDialog(Main.parent, tr("Unknown file extension."));
     205                OptionPaneUtil.showMessageDialog(
     206                        Main.parent,
     207                        tr("Unknown file extension for file ''{0}''", file.toString()),
     208                        tr("Error"),
     209                        JOptionPane.ERROR_MESSAGE
     210                );
    195211                return;
    196212            }
     
    198214        } catch (IOException e) {
    199215            e.printStackTrace();
    200             JOptionPane.showMessageDialog(Main.parent, tr("An error occurred while saving.")+"\n"+e.getMessage());
     216            OptionPaneUtil.showMessageDialog(
     217                    Main.parent,
     218                    tr("<html>An error occurred while saving. <br>Error is: <br>{0}</html>", e.getMessage()),
     219                    tr("Error"),
     220                    JOptionPane.ERROR_MESSAGE
     221            );
    201222
    202223            try {
     
    208229            } catch (IOException e2) {
    209230                e2.printStackTrace();
    210                 JOptionPane.showMessageDialog(Main.parent, tr("An error occurred while restoring backup file.")+"\n"+e2.getMessage());
     231                OptionPaneUtil.showMessageDialog(
     232                        Main.parent,
     233                        tr("<html>An error occurred while restoring backup file.<br> Error is: <br>{0}</html>", e2.getMessage()),
     234                        tr("Error"),
     235                        JOptionPane.ERROR_MESSAGE
     236                );
    211237            }
    212238        }
     
    235261                }
    236262            } else {
    237                 JOptionPane.showMessageDialog(Main.parent, tr("Unknown file extension."));
     263                OptionPaneUtil.showMessageDialog(
     264                        Main.parent,
     265                        tr("Unknown file extension."),
     266                        tr("Error"),
     267                        JOptionPane.ERROR_MESSAGE
     268                );
    238269                return;
    239270            }
     
    250281        } catch (IOException e) {
    251282            e.printStackTrace();
    252             JOptionPane.showMessageDialog(Main.parent, tr("An error occurred while restoring backup file.")+"\n"+e.getMessage());
     283            OptionPaneUtil.showMessageDialog(
     284                    Main.parent,
     285                    tr("<html>An error occurred while restoring backup file.<br>Error is:<br>{0}</html>", e.getMessage()),
     286                    tr("Error"),
     287                    JOptionPane.ERROR_MESSAGE
     288            );;
    253289        }
    254290    }
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTaskList.java

    r1811 r1847  
    2020import org.openstreetmap.josm.data.osm.DataSet;
    2121import org.openstreetmap.josm.data.osm.OsmPrimitive;
     22import org.openstreetmap.josm.gui.OptionPaneUtil;
    2223import org.openstreetmap.josm.gui.download.DownloadDialog.DownloadTask;
    2324import org.openstreetmap.josm.gui.layer.Layer;
     
    100101
    101102        if(! errors.equals("")) {
    102             JOptionPane.showMessageDialog(Main.parent,
    103                     tr("The following errors occurred during mass download:") + "\r\n" + errors,
     103            OptionPaneUtil.showMessageDialog(
     104                    Main.parent,
     105                    tr("<html>The following errors occurred during mass download: {0}</html>", errors),
    104106                    tr("Errors during Download"),
    105107                    JOptionPane.ERROR_MESSAGE);
     
    167169        );
    168170
    169         int ret = JOptionPane.showOptionDialog(
     171        int ret =OptionPaneUtil.showOptionDialog(
    170172                Main.parent,
    171173                message,
     
    173175                JOptionPane.YES_NO_OPTION,
    174176                JOptionPane.WARNING_MESSAGE,
    175                 null,
    176177                options,
    177178                options[0]
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r1844 r1847  
    4141import org.openstreetmap.josm.gui.MapFrame;
    4242import org.openstreetmap.josm.gui.MapView;
     43import org.openstreetmap.josm.gui.OptionPaneUtil;
    4344import org.openstreetmap.josm.gui.SelectionManager;
    4445import org.openstreetmap.josm.gui.SelectionManager.SelectionEnded;
     
    246247                        ((MoveCommand) c).moveAgain(-dx, -dy);
    247248
    248                         JOptionPane.showMessageDialog(Main.parent,
    249                                 tr("Cannot move objects outside of the world."));
     249                        OptionPaneUtil.showMessageDialog(
     250                                Main.parent,
     251                                tr("Cannot move objects outside of the world."),
     252                                tr("Warning"),
     253                                JOptionPane.WARNING_MESSAGE
     254
     255                        );
    250256                        restoreCursor();
    251257                        return;
  • trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java

    r1820 r1847  
    2323import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2424import org.openstreetmap.josm.gui.ExtendedDialog;
     25import org.openstreetmap.josm.gui.OptionPaneUtil;
    2526import org.openstreetmap.josm.tools.GBC;
    2627import org.openstreetmap.josm.tools.Shortcut;
     
    4748            return;
    4849        if (Main.map == null) {
    49             JOptionPane.showMessageDialog(Main.parent, tr("No data loaded."));
     50            OptionPaneUtil.showMessageDialog(
     51                    Main.parent,
     52                    tr("Can't search because there is no loaded data."),
     53                    tr("Warning"),
     54                    JOptionPane.WARNING_MESSAGE
     55            );
    5056            return;
    5157        }
     
    190196                }
    191197                Main.map.statusLine.setHelpText(msg);
    192                 JOptionPane.showMessageDialog(Main.parent, msg);
     198                OptionPaneUtil.showMessageDialog(
     199                        Main.parent,
     200                        msg,
     201                        tr("Warning"),
     202                        JOptionPane.WARNING_MESSAGE
     203                );
    193204            } else {
    194205                Main.map.statusLine.setHelpText(tr("Found {0} matches", foundMatches));
    195206            }
    196207        } catch (SearchCompiler.ParseError e) {
    197             JOptionPane.showMessageDialog(Main.parent, e.getMessage());
     208            OptionPaneUtil.showMessageDialog(
     209                    Main.parent,
     210                    e.getMessage(),
     211                    tr("Error"),
     212                    JOptionPane.ERROR_MESSAGE
     213
     214            );
    198215        }
    199216    }
  • trunk/src/org/openstreetmap/josm/gui/conflict/properties/PropertiesMergeModel.java

    r1811 r1847  
    2727import org.openstreetmap.josm.data.osm.RelationMember;
    2828import org.openstreetmap.josm.data.osm.Way;
     29import org.openstreetmap.josm.gui.OptionPaneUtil;
    2930import org.openstreetmap.josm.gui.conflict.MergeDecisionType;
    3031import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
     
    417418        String msg = e.getMessage() != null ? e.getMessage() : e.toString();
    418419        msg = msg.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
    419         JOptionPane.showMessageDialog(
     420        OptionPaneUtil.showMessageDialog(
    420421                Main.parent,
    421422                tr("<html>An error occurred while communicating with the server<br>"
     
    468469                tr("No, cancel operation")
    469470        };
    470         int ret = JOptionPane.showOptionDialog(
     471        int ret = OptionPaneUtil.showOptionDialog(
    471472                Main.parent,
    472473                tr("<html>There are {0} additional nodes used by way {1}<br>"
     
    478479                        JOptionPane.YES_NO_OPTION,
    479480                        JOptionPane.QUESTION_MESSAGE,
    480                         null,
    481481                        options,
    482482                        options[0]
     
    497497                tr("No, cancel operation")
    498498        };
    499         int ret = JOptionPane.showOptionDialog(
     499        int ret = OptionPaneUtil.showOptionDialog(
    500500                Main.parent,
    501501                tr("<html>There are {0} additional primitives referred to by relation {1}<br>"
     
    507507                        JOptionPane.YES_NO_OPTION,
    508508                        JOptionPane.QUESTION_MESSAGE,
    509                         null,
    510509                        options,
    511510                        options[0]
  • trunk/src/org/openstreetmap/josm/gui/conflict/properties/PropertiesMerger.java

    r1690 r1847  
    2525import org.openstreetmap.josm.data.coor.LatLon;
    2626import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
     27import org.openstreetmap.josm.gui.OptionPaneUtil;
    2728import org.openstreetmap.josm.gui.conflict.MergeDecisionType;
    2829import org.openstreetmap.josm.tools.ImageProvider;
     
    582583                    tr("No, abort")
    583584            };
    584             int ret = JOptionPane.showOptionDialog(
     585            int ret = OptionPaneUtil.showOptionDialog(
    585586                    null,
    586587                    tr("<html>To keep your local version, JOSM<br>"
     
    595596                    JOptionPane.YES_NO_OPTION,
    596597                    JOptionPane.QUESTION_MESSAGE,
    597                     null,
    598598                    options,
    599599                    options[1]
     
    624624                    tr("No, abort")
    625625            };
    626             int ret = JOptionPane.showOptionDialog(
     626            int ret = OptionPaneUtil.showOptionDialog(
    627627                    null,
    628628                    tr("<html>JOSM will have to remove your local primitive with id {0}<br>"
     
    634634                    JOptionPane.YES_NO_OPTION,
    635635                    JOptionPane.QUESTION_MESSAGE,
    636                     null,
    637636                    options,
    638637                    options[1]
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictResolutionDialog.java

    r1782 r1847  
    2222import org.openstreetmap.josm.Main;
    2323import org.openstreetmap.josm.command.Command;
     24import org.openstreetmap.josm.gui.OptionPaneUtil;
    2425import org.openstreetmap.josm.gui.conflict.ConflictResolver;
    2526import org.openstreetmap.josm.gui.conflict.properties.OperationCancelledException;
     
    174175                        tr("Apply partial resolutions"),
    175176                        tr("Continue resolving")};
    176                 int n = JOptionPane.showOptionDialog(null,
     177                int n = OptionPaneUtil.showOptionDialog(null,
    177178                        tr("<html>You didn''t finish to resolve all conflicts.<br>"
    178179                                + "Click <strong>{0}</strong> to apply already resolved conflicts anyway.<br>"
     
    184185                        JOptionPane.YES_NO_OPTION,
    185186                        JOptionPane.WARNING_MESSAGE,
    186                         null,
    187187                        options,
    188188                        options[1]
  • trunk/src/org/openstreetmap/josm/gui/dialogs/HistoryDialog.java

    r1815 r1847  
    4343import org.openstreetmap.josm.data.osm.history.History;
    4444import org.openstreetmap.josm.data.osm.history.HistoryDataSet;
     45import org.openstreetmap.josm.gui.OptionPaneUtil;
    4546import org.openstreetmap.josm.gui.PleaseWaitRunnable;
    4647import org.openstreetmap.josm.gui.SideButton;
     
    246247                msg = task.getLastException().toString();
    247248            }
    248             JOptionPane.showMessageDialog(
     249            OptionPaneUtil.showMessageDialog(
    249250                    Main.parent,
    250251                    tr(
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListPopup.java

    r1169 r1847  
    1313
    1414import org.openstreetmap.josm.Main;
     15import org.openstreetmap.josm.gui.OptionPaneUtil;
    1516import org.openstreetmap.josm.gui.layer.Layer;
    1617import org.openstreetmap.josm.tools.ImageProvider;
     
    2829        }
    2930        public void actionPerformed(ActionEvent e) {
    30             JOptionPane.showMessageDialog(Main.parent, layer.getInfoComponent());
     31            OptionPaneUtil.showMessageDialog(
     32                    Main.parent,
     33                    layer.getInfoComponent(),
     34                    tr("Information about layer"),
     35                    JOptionPane.INFORMATION_MESSAGE
     36            );
    3137        }
    3238    }
    3339
    3440    public LayerListPopup(final JList layers, final Layer layer) {
    35         for (Component c : layer.getMenuEntries())
     41        for (Component c : layer.getMenuEntries()) {
    3642            add(c);
     43        }
    3744    }
    3845}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

    r1838 r1847  
    1616import javax.swing.DefaultListModel;
    1717import javax.swing.JList;
    18 import javax.swing.JOptionPane;
    1918import javax.swing.JPanel;
    2019import javax.swing.JScrollPane;
     
    2827import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2928import org.openstreetmap.josm.data.osm.Relation;
    30 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;
    31 import org.openstreetmap.josm.gui.OptionPaneUtil;
    3229import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
    3330import org.openstreetmap.josm.gui.SideButton;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ChildRelationBrowser.java

    r1828 r1847  
    3434import org.openstreetmap.josm.data.osm.RelationMember;
    3535import org.openstreetmap.josm.data.osm.visitor.MergeVisitor;
     36import org.openstreetmap.josm.gui.OptionPaneUtil;
    3637import org.openstreetmap.josm.gui.PleaseWaitRunnable;
    3738import org.openstreetmap.josm.gui.PrimitiveNameFormatter;
     
    309310                msg = lastException.toString();
    310311            }
    311             JOptionPane.showMessageDialog(null, msg, tr("Error"), JOptionPane.ERROR_MESSAGE);
     312            OptionPaneUtil.showMessageDialog(
     313                    Main.parent,
     314                    msg,
     315                    tr("Error"),
     316                    JOptionPane.ERROR_MESSAGE
     317            );
    312318        }
    313319
     
    331337
    332338            if (conflictsCount > 0) {
    333                 JOptionPane op = new JOptionPane(
     339                OptionPaneUtil.showMessageDialog(
     340                        Main.parent,
    334341                        tr("There were {0} conflicts during import.", conflictsCount),
     342                        tr("Conflicts in data"),
    335343                        JOptionPane.WARNING_MESSAGE
    336344                );
    337                 JDialog dialog = op.createDialog(ChildRelationBrowser.this, tr("Conflicts in data"));
    338                 dialog.setAlwaysOnTop(true);
    339                 dialog.setModal(true);
    340                 dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    341                 dialog.setVisible(true);
    342345            }
    343346        }
     
    423426                msg = lastException.toString();
    424427            }
    425             JOptionPane.showMessageDialog(null, msg, tr("Error"), JOptionPane.ERROR_MESSAGE);
     428            OptionPaneUtil.showMessageDialog(
     429                    Main.parent,
     430                    msg,
     431                    tr("Error"),
     432                    JOptionPane.ERROR_MESSAGE
     433            );
    426434        }
    427435
     
    445453
    446454            if (conflictsCount > 0) {
    447                 JOptionPane op = new JOptionPane(
     455                OptionPaneUtil.showMessageDialog(
     456                        Main.parent,
    448457                        tr("There were {0} conflicts during import.", conflictsCount),
     458                        tr("Conflicts in data"),
    449459                        JOptionPane.WARNING_MESSAGE
    450460                );
    451                 JDialog dialog = op.createDialog(ChildRelationBrowser.this, tr("Conflicts in data"));
    452                 dialog.setAlwaysOnTop(true);
    453                 dialog.setModal(true);
    454                 dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    455                 dialog.setVisible(true);
    456461            }
    457462        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java

    r1845 r1847  
    713713                    this.nameFormatter.getName(primitive)
    714714            );
    715             OptionPaneUtil.showMessageDialog(Main.parent, msg, tr("Warning"), JOptionPane.WARNING_MESSAGE);
     715            OptionPaneUtil.showMessageDialog(
     716                    Main.parent,
     717                    msg,
     718                    tr("Warning"),
     719                    JOptionPane.WARNING_MESSAGE
     720            );
    716721        }
    717722
     
    986991                Conflict<Relation> conflict = new Conflict<Relation>(getRelation(), editedRelation);
    987992                getLayer().getConflicts().add(conflict);
    988                 JOptionPane op = new JOptionPane(
     993                OptionPaneUtil.showMessageDialog(
     994                        Main.parent,
    989995                        tr("<html>The relation has changed outside of the editor.<br>"
    990996                                + "Your edits can't be applied directly, a conflict has been created instead.</html>"),
     997                                tr("Warning"),
    991998                                JOptionPane.WARNING_MESSAGE
    992999                );
    993                 JDialog dialog = op.createDialog(GenericRelationEditor.this, tr("Conflict created"));
    994                 dialog.setAlwaysOnTop(true);
    995                 dialog.setModal(true);
    996                 dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    997                 dialog.setVisible(true);
    9981000            } else {
    9991001                tagEditorModel.applyToPrimitive(editedRelation);
     
    12921294                msg = lastException.toString();
    12931295            }
    1294             JOptionPane.showMessageDialog(null, msg, tr("Error"), JOptionPane.ERROR_MESSAGE);
     1296            OptionPaneUtil.showMessageDialog(
     1297                    Main.parent,
     1298                    msg,
     1299                    tr("Error"),
     1300                    JOptionPane.ERROR_MESSAGE
     1301            );
    12951302        }
    12961303
     
    13051312
    13061313            if (conflictsCount > 0) {
    1307                 JOptionPane op = new JOptionPane(tr("There were {0} conflicts during import.", conflictsCount),
    1308                         JOptionPane.WARNING_MESSAGE);
    1309                 JDialog dialog = op.createDialog(GenericRelationEditor.this, tr("Conflicts in data"));
    1310                 dialog.setAlwaysOnTop(true);
    1311                 dialog.setModal(true);
    1312                 dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    1313                 dialog.setVisible(true);
     1314                OptionPaneUtil.showMessageDialog(
     1315                        Main.parent,
     1316                        tr("There were {0} conflicts during import.", conflictsCount),
     1317                        tr("Warning"),
     1318                        JOptionPane.WARNING_MESSAGE
     1319                );
    13141320            }
    13151321        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ReferringRelationsBrowser.java

    r1836 r1847  
    3232import org.openstreetmap.josm.data.osm.Relation;
    3333import org.openstreetmap.josm.data.osm.visitor.MergeVisitor;
     34import org.openstreetmap.josm.gui.OptionPaneUtil;
    3435import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
    3536import org.openstreetmap.josm.gui.PleaseWaitRunnable;
     
    202203                msg = lastException.toString();
    203204            }
    204             JOptionPane.showMessageDialog(
    205                     null,
     205            OptionPaneUtil.showMessageDialog(
     206                    Main.parent,
    206207                    msg,
    207208                    tr("Error"),
     
    259260                        return;
    260261                    getLayer().getConflicts().add(visitor.getConflicts());
    261                     JOptionPane op = new JOptionPane(
     262                    OptionPaneUtil.showMessageDialog(
     263                            Main.parent,
    262264                            tr("There were {0} conflicts during import.",
    263265                                    visitor.getConflicts().size()),
     266                                    tr("Warning"),
    264267                                    JOptionPane.WARNING_MESSAGE
    265268                    );
    266                     JDialog dialog = op.createDialog(ReferringRelationsBrowser.this, tr("Conflicts in data"));
    267                     dialog.setAlwaysOnTop(true);
    268                     dialog.setModal(true);
    269                     dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    270                     dialog.setVisible(true);
    271269                }
    272270            } catch(Exception e) {
  • trunk/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java

    r1169 r1847  
    2323import org.openstreetmap.josm.data.Preferences;
    2424import org.openstreetmap.josm.gui.BookmarkList;
     25import org.openstreetmap.josm.gui.OptionPaneUtil;
    2526import org.openstreetmap.josm.tools.GBC;
    2627
     
    7879
    7980                if (tempBookmark == null) {
    80                     JOptionPane.showMessageDialog(Main.parent, tr("Please enter the desired coordinates first."));
     81                    OptionPaneUtil.showMessageDialog(
     82                            Main.parent,
     83                            tr("Please enter the desired coordinates first."),
     84                            tr("Information"),
     85                            JOptionPane.INFORMATION_MESSAGE
     86                    );
    8187                    return;
    8288                }
     
    94100                Object sel = bookmarks.getSelectedValue();
    95101                if (sel == null) {
    96                     JOptionPane.showMessageDialog(Main.parent,tr("Select a bookmark first."));
     102                    OptionPaneUtil.showMessageDialog(
     103                            Main.parent,
     104                            tr("Select a bookmark first."),
     105                            tr("Information"),
     106                            JOptionPane.INFORMATION_MESSAGE
     107                    );
    97108                    return;
    98109                }
  • trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java

    r1349 r1847  
    3232
    3333import org.openstreetmap.josm.Main;
     34import org.openstreetmap.josm.gui.OptionPaneUtil;
    3435import org.openstreetmap.josm.gui.download.DownloadDialog;
    3536import org.openstreetmap.josm.gui.download.DownloadSelection;
     
    166167                    if(searchtext.length()==0)
    167168                    {
    168                         JOptionPane.showMessageDialog(Main.parent,tr("Please enter a search string"));
     169                        OptionPaneUtil.showMessageDialog(
     170                                Main.parent,
     171                                tr("Please enter a search string"),
     172                                tr("Information"),
     173                                JOptionPane.INFORMATION_MESSAGE
     174                        );
    169175                    }
    170176                    else
     
    173179                        component.repaint();
    174180                        URL url = new URL("http://gazetteer.openstreetmap.org/namefinder/search.xml?find="
    175                         +java.net.URLEncoder.encode(searchTerm.getText(), "UTF-8"));
     181                                +java.net.URLEncoder.encode(searchTerm.getText(), "UTF-8"));
    176182                        HttpURLConnection activeConnection = (HttpURLConnection)url.openConnection();
    177183                        //System.out.println("got return: "+activeConnection.getResponseCode());
     
    318324    // if bounding box selected on other tab, de-select item
    319325    public void boundingBoxChanged(DownloadDialog gui) {
    320         if (!updatingSelf) searchResultDisplay.clearSelection();
     326        if (!updatingSelf) {
     327            searchResultDisplay.clearSelection();
     328        }
    321329    }
    322330}
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/ImageMarker.java

    r1169 r1847  
    6161            public void actionPerformed(ActionEvent ev) {
    6262                p.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    63                 if (scale.getModel().isSelected())
     63                if (scale.getModel().isSelected()) {
    6464                    ((JLabel)vp.getView()).setIcon(loadScaledImage(imageUrl, Math.max(vp.getWidth(), vp.getHeight())));
    65                 else
     65                } else {
    6666                    ((JLabel)vp.getView()).setIcon(new ImageIcon(imageUrl));
     67                }
    6768                p.setCursor(Cursor.getDefaultCursor());
    6869            }
     
    7273        JDialog dlg = pane.createDialog(Main.parent, imageUrl.toString());
    7374        dlg.setModal(false);
     75        dlg.toFront();
    7476        dlg.setVisible(true);
    7577    }
Note: See TracChangeset for help on using the changeset viewer.