Changeset 34514 in osm


Ignore:
Timestamp:
2018-08-18T17:50:45+02:00 (6 years ago)
Author:
donvip
Message:

update to JOSM 14153

Location:
applications/editors/josm/plugins/globalsat
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/globalsat/build.xml

    r33854 r34514  
    55    <property name="commit.message" value="Changed constructor signature of plugin main class"/>
    66    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    7     <property name="plugin.main.version" value="12840"/>
     7    <property name="plugin.main.version" value="14153"/>
    88
    99    <!-- Configure these properties (replace "..." accordingly).
  • applications/editors/josm/plugins/globalsat/src/org/kaintoch/gps/globalsat/dg100/GpsRec.java

    r34120 r34514  
    6969
    7070    @Override
    71     public boolean equals(Object arg0)
    72     {
    73         boolean isEqual = false;
    74         if (arg0 != null && arg0 instanceof GpsRec)
    75         {
    76             GpsRec otherGpsRec = (GpsRec)arg0;
    77             isEqual =
    78                 dg100TypeOfNextRec == otherGpsRec.dg100TypeOfNextRec
    79                 && dg100TypeOfCurRec == otherGpsRec.dg100TypeOfCurRec
    80                 && dg100Latitude == otherGpsRec.dg100Latitude
    81                 && dg100Longitude == otherGpsRec.dg100Longitude
    82                 && dg100TimeZ == otherGpsRec.dg100TimeZ
    83                 && dg100Date == otherGpsRec.dg100Date
    84                 && dg100Speed == otherGpsRec.dg100Speed
    85                 && dg100Altitude == otherGpsRec.dg100Altitude
    86                 //&& dg100Unk1 == otherGpsRec.unk1
    87                 ;
    88         }
    89         return isEqual;
     71    public int hashCode() {
     72        final int prime = 31;
     73        int result = 1;
     74        result = prime * result + dg100Altitude;
     75        result = prime * result + dg100Date;
     76        result = prime * result + dg100Latitude;
     77        result = prime * result + dg100Longitude;
     78        result = prime * result + dg100Speed;
     79        result = prime * result + dg100TimeZ;
     80        result = prime * result + dg100TypeOfCurRec;
     81        result = prime * result + dg100TypeOfNextRec;
     82        return result;
     83    }
     84
     85    @Override
     86    public boolean equals(Object obj) {
     87        if (this == obj)
     88            return true;
     89        if (obj == null || getClass() != obj.getClass())
     90            return false;
     91        GpsRec other = (GpsRec) obj;
     92        return dg100Altitude == other.dg100Altitude
     93            && dg100Date == other.dg100Date
     94            && dg100Latitude == other.dg100Latitude
     95            && dg100Longitude == other.dg100Longitude
     96            && dg100Speed == other.dg100Speed
     97            && dg100TimeZ == other.dg100TimeZ
     98            && dg100TypeOfCurRec == other.dg100TypeOfCurRec
     99            && dg100TypeOfNextRec == other.dg100TypeOfNextRec;
    90100    }
    91101
  • applications/editors/josm/plugins/globalsat/src/org/openstreetmap/josm/plugins/globalsat/GlobalsatConfigDialog.java

    r33854 r34514  
    2424
    2525import org.kaintoch.gps.globalsat.dg100.Dg100Config;
    26 import org.openstreetmap.josm.Main;
     26import org.openstreetmap.josm.gui.MainApplication;
    2727
    2828/**
     
    243243            break;
    244244        default:
    245             JOptionPane.showMessageDialog(Main.parent, tr("Unknown logFormat"));
     245            JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Unknown logFormat"));
    246246        }
    247247
     
    260260    }
    261261
    262     private static ButtonGroup createButtonGroup(AbstractButton ... buttons) {
     262    private static ButtonGroup createButtonGroup(AbstractButton... buttons) {
    263263        ButtonGroup group = new ButtonGroup();
    264264        for (AbstractButton b : buttons) {
  • applications/editors/josm/plugins/globalsat/src/org/openstreetmap/josm/plugins/globalsat/GlobalsatImportDialog.java

    r33394 r34514  
    2121
    2222import org.kaintoch.gps.globalsat.dg100.Dg100Config;
    23 import org.openstreetmap.josm.Main;
     23import org.openstreetmap.josm.gui.MainApplication;
     24import org.openstreetmap.josm.spi.preferences.Config;
    2425
    2526import gnu.io.CommPortIdentifier;
     
    6061                    if (i instanceof CommPortIdentifier) {
    6162                        GlobalsatPlugin.setPortIdent((CommPortIdentifier) i);
    62                         Main.pref.put("globalsat.portIdentifier", ((CommPortIdentifier) i).getName());
     63                        Config.getPref().put("globalsat.portIdentifier", ((CommPortIdentifier) i).getName());
    6364                    }
    6465                }
     
    105106                            GlobalsatConfigDialog dialog = new GlobalsatConfigDialog(conf);
    106107                            JOptionPane pane = new JOptionPane(dialog, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
    107                             JDialog dlg = pane.createDialog(Main.parent, tr("Configure Device"));
     108                            JDialog dlg = pane.createDialog(MainApplication.getMainFrame(), tr("Configure Device"));
    108109                            dlg.setVisible(true);
    109110                            if (((Integer) pane.getValue()) == JOptionPane.OK_OPTION) {
     
    112113                            dlg.dispose();
    113114                        } else {
    114                             JOptionPane.showMessageDialog(Main.parent, tr("Connection Error."), tr("Connection Error."), JOptionPane.ERROR);
     115                            JOptionPane.showMessageDialog(MainApplication.getMainFrame(),
     116                                    tr("Connection Error."), tr("Connection Error."), JOptionPane.ERROR);
    115117                        }
    116118                    } catch (GlobalsatDg100.ConnectionException ex) {
    117                         JOptionPane.showMessageDialog(Main.parent, tr("Connection Error.") + " " + ex.toString());
     119                        JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Connection Error.") + " " + ex.toString());
    118120                    }
    119121                    System.out.println("configuring the device finished");
     
    130132
    131133        delete = new JCheckBox(tr("delete data after import"));
    132         delete.setSelected(Main.pref.getBoolean("globalsat.deleteAfterDownload", false));
     134        delete.setSelected(Config.getPref().getBoolean("globalsat.deleteAfterDownload", false));
    133135
    134136        c.gridwidth = 3;
     
    140142
    141143    public void refreshPorts() {
    142         String sel = Main.pref.get("globalsat.portIdentifier");
     144        String sel = Config.getPref().get("globalsat.portIdentifier");
    143145        portCombo.setVisible(false);
    144146        portCombo.removeAllItems();
  • applications/editors/josm/plugins/globalsat/src/org/openstreetmap/josm/plugins/globalsat/GlobalsatPlugin.java

    r33854 r34514  
    1212import javax.swing.JOptionPane;
    1313
    14 import org.openstreetmap.josm.Main;
    1514import org.openstreetmap.josm.actions.JosmAction;
    1615import org.openstreetmap.josm.data.gpx.GpxData;
     
    2120import org.openstreetmap.josm.plugins.Plugin;
    2221import org.openstreetmap.josm.plugins.PluginInformation;
     22import org.openstreetmap.josm.spi.preferences.Config;
    2323import org.openstreetmap.josm.tools.Logging;
    2424import org.openstreetmap.josm.tools.Shortcut;
     
    6161        @Override protected void finish() {
    6262            if (deleteAfter && GlobalsatPlugin.dg100().isCanceled() == false) {
    63                 Main.pref.putBoolean("globalsat.deleteAfterDownload", true);
     63                Config.getPref().putBoolean("globalsat.deleteAfterDownload", true);
    6464                try {
    6565                    GlobalsatPlugin.dg100().deleteData();
    6666                } catch (Exception ex) {
    67                     JOptionPane.showMessageDialog(Main.parent, tr("Error deleting data.") + " " + ex.toString());
     67                    JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Error deleting data.") + " " + ex.toString());
    6868                }
    6969            } else {
    70                 Main.pref.putBoolean("globalsat.deleteAfterDownload", false);
     70                Config.getPref().putBoolean("globalsat.deleteAfterDownload", false);
    7171            }
    7272            if (data != null && data.hasTrackPoints()) {
     
    7474                MainApplication.getMap().repaint();
    7575            } else {
    76                 JOptionPane.showMessageDialog(Main.parent, tr("No data found on device."));
     76                JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("No data found on device."));
    7777            }
    7878            if (eee != null) {
    7979                eee.printStackTrace();
    8080                System.out.println(eee.getMessage());
    81                 JOptionPane.showMessageDialog(Main.parent, tr("Connection failed.") + " (" + eee.toString() + ")");
     81                JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Connection failed.") + " (" + eee.toString() + ")");
    8282            }
    8383            GlobalsatPlugin.dg100().disconnect();
     
    103103            Logging.error(msg);
    104104            if (!GraphicsEnvironment.isHeadless()) {
    105                 JOptionPane.showMessageDialog(Main.parent, "<html>" + msg + "</html>");
     105                JOptionPane.showMessageDialog(MainApplication.getMainFrame(), "<html>" + msg + "</html>");
    106106            }
    107107        }
     
    124124            GlobalsatImportDialog dialog = new GlobalsatImportDialog();
    125125            JOptionPane pane = new JOptionPane(dialog, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
    126             JDialog dlg = pane.createDialog(Main.parent, tr("Import"));
     126            JDialog dlg = pane.createDialog(MainApplication.getMainFrame(), tr("Import"));
    127127            dlg.setVisible(true);
    128128            if (((Integer) pane.getValue()) == JOptionPane.OK_OPTION) {
Note: See TracChangeset for help on using the changeset viewer.