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/gui
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • 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.