Ignore:
Timestamp:
2018-08-18T19:34:51+02:00 (6 years ago)
Author:
donvip
Message:

update to JOSM 14153

Location:
applications/editors/josm/plugins/public_transport
Files:
7 edited

Legend:

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

    r34265 r34548  
    55    <property name="commit.message" value="Commit message"/>
    66    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    7     <property name="plugin.main.version" value="13906"/>
     7    <property name="plugin.main.version" value="14153"/>
    88
    99    <property name="plugin.author" value="Roland M. Olbricht"/>
  • applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport/actions/GTFSImporterAction.java

    r34265 r34548  
    2323import javax.swing.JTable;
    2424
    25 import org.openstreetmap.josm.Main;
    2625import org.openstreetmap.josm.actions.JosmAction;
     26import org.openstreetmap.josm.data.UndoRedoHandler;
    2727import org.openstreetmap.josm.data.coor.LatLon;
    2828import org.openstreetmap.josm.data.osm.DataSet;
     
    3939import org.openstreetmap.josm.plugins.public_transport.models.GTFSStopTableModel;
    4040import org.openstreetmap.josm.plugins.public_transport.refs.TrackReference;
     41import org.openstreetmap.josm.spi.preferences.Config;
    4142import org.openstreetmap.josm.tools.Logging;
    4243
     
    9495
    9596        if (tr("Create Stops from GTFS ...").equals(event.getActionCommand())) {
    96             String curDir = Main.pref.get("lastDirectory");
     97            String curDir = Config.getPref().get("lastDirectory");
    9798            if (curDir.isEmpty()) {
    9899                curDir = ".";
     
    102103            fc.setMultiSelectionEnabled(false);
    103104
    104             int answer = fc.showOpenDialog(Main.parent);
     105            int answer = fc.showOpenDialog(MainApplication.getMainFrame());
    105106            if (answer != JFileChooser.APPROVE_OPTION)
    106107                return;
    107108
    108109            if (!fc.getCurrentDirectory().getAbsolutePath().equals(curDir))
    109                 Main.pref.put("lastDirectory", fc.getCurrentDirectory().getAbsolutePath());
     110                Config.getPref().put("lastDirectory", fc.getCurrentDirectory().getAbsolutePath());
    110111
    111112            importData(fc.getSelectedFile());
     
    116117    {
    117118      if ((!inEvent) && (dialog.gpsTimeStartValid()) && (currentTrack != null))
    118     Main.main.undoRedo.add(new TrackStoplistRelocateCommand(this));
     119    UndoRedoHandler.getInstance().add(new TrackStoplistRelocateCommand(this));
    119120    }
    120121    else if ("stopImporter.settingsStopwatchStart".equals(event.getActionCommand()))
    121122    {
    122123      if ((!inEvent) && (dialog.stopwatchStartValid()) && (currentTrack != null))
    123     Main.main.undoRedo.add(new TrackStoplistRelocateCommand(this));
     124    UndoRedoHandler.getInstance().add(new TrackStoplistRelocateCommand(this));
    124125    }
    125126    else if ("stopImporter.settingsTimeWindow".equals(event.getActionCommand()))
     
    134135    }
    135136    else if ("stopImporter.settingsSuggestStops".equals(event.getActionCommand()))
    136       Main.main.undoRedo.add(new TrackSuggestStopsCommand(this));
     137      UndoRedoHandler.getInstance().add(new TrackSuggestStopsCommand(this));
    137138    else if ("stopImporter.stoplistFind".equals(event.getActionCommand()))
    138139      findNodesInTable(dialog.getStoplistTable(), currentTrack.stoplistTM.getNodes());
     
    143144    else if ("stopImporter.stoplistDetach".equals(event.getActionCommand()))
    144145    {
    145       Main.main.undoRedo.add(new TrackStoplistDetachCommand(this));
     146      UndoRedoHandler.getInstance().add(new TrackStoplistDetachCommand(this));
    146147      dialog.getStoplistTable().clearSelection();
    147148    */
    148149        } else if ("gtfsImporter.gtfsStopsAdd".equals(event.getActionCommand()))
    149             Main.main.undoRedo.add(new GTFSAddCommand(this));
     150            UndoRedoHandler.getInstance().add(new GTFSAddCommand(this));
    150151        else if ("gtfsImporter.gtfsStopsDelete".equals(event.getActionCommand()))
    151             Main.main.undoRedo.add(new GTFSDeleteCommand(this));
     152            UndoRedoHandler.getInstance().add(new GTFSDeleteCommand(this));
    152153        else if ("gtfsImporter.gtfsStopsCatch".equals(event.getActionCommand()))
    153             Main.main.undoRedo.add(new GTFSCatchCommand(this));
     154            UndoRedoHandler.getInstance().add(new GTFSCatchCommand(this));
    154155        else if ("gtfsImporter.gtfsStopsJoin".equals(event.getActionCommand()))
    155             Main.main.undoRedo.add(new GTFSJoinCommand(this));
     156            UndoRedoHandler.getInstance().add(new GTFSJoinCommand(this));
    156157        else if ("gtfsImporter.gtfsStopsFind".equals(event.getActionCommand()))
    157158            findNodesInTable(dialog.getGTFSStopTable(), gtfsStopTM.nodes);
     
    359360        @Override
    360361        public void actionPerformed(ActionEvent e) {
    361             Main.main.undoRedo.add(new GTFSAddCommand(GTFSImporterAction.this));
     362            UndoRedoHandler.getInstance().add(new GTFSAddCommand(GTFSImporterAction.this));
    362363            showNodesFromTable(dialog.getGTFSStopTable(), gtfsStopTM.nodes);
    363364        }
     
    381382    table.clearSelection();
    382383    table.addRowSelectionInterval(row, row);
    383 /*  Main.main.undoRedo.add
     384/*  UndoRedoHandler.getInstance().add
    384385        (new WaypointsDisableCommand(GTFSImporterAction.this));*
    385386      }
     
    409410    table.clearSelection();
    410411    table.addRowSelectionInterval(row, row);
    411 /*  Main.main.undoRedo.add
     412/*  UndoRedoHandler.getInstance().add
    412413        (new TrackStoplistDeleteCommand(GTFSImporterAction.this));*
    413414      }
  • applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport/actions/RoutePatternAction.java

    r34265 r34548  
    4343import javax.swing.table.TableCellEditor;
    4444
    45 import org.openstreetmap.josm.Main;
    4645import org.openstreetmap.josm.actions.JosmAction;
    4746import org.openstreetmap.josm.actions.mapmode.DeleteAction;
     
    335334    @Override
    336335    public void actionPerformed(ActionEvent event) {
    337         Frame frame = JOptionPane.getFrameForComponent(Main.parent);
     336        Frame frame = JOptionPane.getFrameForComponent(MainApplication.getMainFrame());
    338337        DataSet mainDataSet = MainApplication.getLayerManager().getEditDataSet();
    339338
  • applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport/actions/StopImporterAction.java

    r34265 r34548  
    2424import javax.swing.JTable;
    2525
    26 import org.openstreetmap.josm.Main;
    2726import org.openstreetmap.josm.actions.JosmAction;
     27import org.openstreetmap.josm.data.UndoRedoHandler;
    2828import org.openstreetmap.josm.data.coor.LatLon;
    2929import org.openstreetmap.josm.data.gpx.GpxData;
     
    5050import org.openstreetmap.josm.plugins.public_transport.models.WaypointTableModel;
    5151import org.openstreetmap.josm.plugins.public_transport.refs.TrackReference;
     52import org.openstreetmap.josm.spi.preferences.Config;
    5253import org.xml.sax.SAXException;
    5354
     
    104105
    105106        if (tr("Create Stops from GPX ...").equals(event.getActionCommand())) {
    106             String curDir = Main.pref.get("lastDirectory");
     107            String curDir = Config.getPref().get("lastDirectory");
    107108            if (curDir.equals("")) {
    108109                curDir = ".";
     
    112113            fc.setMultiSelectionEnabled(false);
    113114
    114             int answer = fc.showOpenDialog(Main.parent);
     115            int answer = fc.showOpenDialog(MainApplication.getMainFrame());
    115116            if (answer != JFileChooser.APPROVE_OPTION)
    116117                return;
    117118
    118119            if (!fc.getCurrentDirectory().getAbsolutePath().equals(curDir))
    119                 Main.pref.put("lastDirectory", fc.getCurrentDirectory().getAbsolutePath());
     120                Config.getPref().put("lastDirectory", fc.getCurrentDirectory().getAbsolutePath());
    120121
    121122            importData(fc.getSelectedFile());
     
    124125        } else if ("stopImporter.settingsGPSTimeStart".equals(event.getActionCommand())) {
    125126            if ((!inEvent) && (dialog.gpsTimeStartValid()) && (currentTrack != null))
    126                 Main.main.undoRedo.add(new TrackStoplistRelocateCommand(this));
     127                UndoRedoHandler.getInstance().add(new TrackStoplistRelocateCommand(this));
    127128        } else if ("stopImporter.settingsStopwatchStart".equals(event.getActionCommand())) {
    128129            if ((!inEvent) && (dialog.stopwatchStartValid()) && (currentTrack != null))
    129                 Main.main.undoRedo.add(new TrackStoplistRelocateCommand(this));
     130                UndoRedoHandler.getInstance().add(new TrackStoplistRelocateCommand(this));
    130131        } else if ("stopImporter.settingsTimeWindow".equals(event.getActionCommand())) {
    131132            if (currentTrack != null)
     
    135136                currentTrack.threshold = dialog.getThreshold();
    136137        } else if ("stopImporter.settingsSuggestStops".equals(event.getActionCommand()))
    137             Main.main.undoRedo.add(new TrackSuggestStopsCommand(this));
     138            UndoRedoHandler.getInstance().add(new TrackSuggestStopsCommand(this));
    138139        else if ("stopImporter.stoplistFind".equals(event.getActionCommand()))
    139140            findNodesInTable(dialog.getStoplistTable(), currentTrack.stoplistTM.getNodes());
     
    143144            markNodesFromTable(dialog.getStoplistTable(), currentTrack.stoplistTM.getNodes());
    144145        else if ("stopImporter.stoplistDetach".equals(event.getActionCommand())) {
    145             Main.main.undoRedo.add(new TrackStoplistDetachCommand(this));
     146            UndoRedoHandler.getInstance().add(new TrackStoplistDetachCommand(this));
    146147            dialog.getStoplistTable().clearSelection();
    147148        } else if ("stopImporter.stoplistAdd".equals(event.getActionCommand()))
    148             Main.main.undoRedo.add(new TrackStoplistAddCommand(this));
     149            UndoRedoHandler.getInstance().add(new TrackStoplistAddCommand(this));
    149150        else if ("stopImporter.stoplistDelete".equals(event.getActionCommand()))
    150             Main.main.undoRedo.add(new TrackStoplistDeleteCommand(this));
     151            UndoRedoHandler.getInstance().add(new TrackStoplistDeleteCommand(this));
    151152        else if ("stopImporter.stoplistSort".equals(event.getActionCommand()))
    152             Main.main.undoRedo.add(new TrackStoplistSortCommand(this));
     153            UndoRedoHandler.getInstance().add(new TrackStoplistSortCommand(this));
    153154        else if ("stopImporter.waypointsFind".equals(event.getActionCommand()))
    154155            findNodesInTable(dialog.getWaypointsTable(), waypointTM.nodes);
     
    158159            markNodesFromTable(dialog.getWaypointsTable(), waypointTM.nodes);
    159160        else if ("stopImporter.waypointsDetach".equals(event.getActionCommand())) {
    160             Main.main.undoRedo.add(new WaypointsDetachCommand(this));
     161            UndoRedoHandler.getInstance().add(new WaypointsDetachCommand(this));
    161162            dialog.getWaypointsTable().clearSelection();
    162163        } else if ("stopImporter.waypointsAdd".equals(event.getActionCommand()))
    163             Main.main.undoRedo.add(new WaypointsEnableCommand(this));
     164            UndoRedoHandler.getInstance().add(new WaypointsEnableCommand(this));
    164165        else if ("stopImporter.waypointsDelete".equals(event.getActionCommand()))
    165             Main.main.undoRedo.add(new WaypointsDisableCommand(this));
     166            UndoRedoHandler.getInstance().add(new WaypointsDisableCommand(this));
    166167        else if ("stopImporter.settingsStoptype".equals(event.getActionCommand()))
    167             Main.main.undoRedo.add(new SettingsStoptypeCommand(this));
     168            UndoRedoHandler.getInstance().add(new SettingsStoptypeCommand(this));
    168169    }
    169170
     
    400401                table.clearSelection();
    401402                table.addRowSelectionInterval(row, row);
    402                 Main.main.undoRedo.add(new WaypointsDisableCommand(StopImporterAction.this));
     403                UndoRedoHandler.getInstance().add(new WaypointsDisableCommand(StopImporterAction.this));
    403404            }
    404405        };
     
    423424                table.clearSelection();
    424425                table.addRowSelectionInterval(row, row);
    425                 Main.main.undoRedo.add(new TrackStoplistDeleteCommand(StopImporterAction.this));
     426                UndoRedoHandler.getInstance().add(new TrackStoplistDeleteCommand(StopImporterAction.this));
    426427            }
    427428        };
  • applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport/dialogs/AbstractImporterDialog.java

    r33765 r34548  
    1313import javax.swing.JTextField;
    1414
    15 import org.openstreetmap.josm.Main;
    1615import org.openstreetmap.josm.actions.JosmAction;
     16import org.openstreetmap.josm.gui.MainApplication;
    1717import org.openstreetmap.josm.plugins.public_transport.TransText;
    1818
     
    4444
    4545    public AbstractImporterDialog(T controller, String dialogTitle, String actionPrefix) {
    46         Frame frame = JOptionPane.getFrameForComponent(Main.parent);
     46        Frame frame = JOptionPane.getFrameForComponent(MainApplication.getMainFrame());
    4747        jDialog = new JDialog(frame, dialogTitle, false);
    4848        tabbedPane = new JTabbedPane();
  • applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport/models/WaypointTableModel.java

    r33765 r34548  
    1010import javax.swing.table.DefaultTableModel;
    1111
    12 import org.openstreetmap.josm.Main;
     12import org.openstreetmap.josm.data.UndoRedoHandler;
    1313import org.openstreetmap.josm.data.coor.LatLon;
    1414import org.openstreetmap.josm.data.gpx.WayPoint;
     
    8888            if (inEvent)
    8989                return;
    90             Main.main.undoRedo.add(new WaypointsNameCommand(this, e.getFirstRow(),
     90            UndoRedoHandler.getInstance().add(new WaypointsNameCommand(this, e.getFirstRow(),
    9191                    (String) getValueAt(e.getFirstRow(), 1),
    9292                    (TransText) getValueAt(e.getFirstRow(), 2)));
  • applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport/refs/TrackReference.java

    r33765 r34548  
    1010import javax.swing.event.TableModelListener;
    1111
    12 import org.openstreetmap.josm.Main;
    1312import org.openstreetmap.josm.command.ChangeCommand;
    1413import org.openstreetmap.josm.command.Command;
     14import org.openstreetmap.josm.data.UndoRedoHandler;
    1515import org.openstreetmap.josm.data.coor.LatLon;
    1616import org.openstreetmap.josm.data.gpx.GpxTrack;
     
    113113            }
    114114
    115             Main.main.undoRedo.add(new TrackStoplistNameCommand(this, e.getFirstRow()));
     115            UndoRedoHandler.getInstance().add(new TrackStoplistNameCommand(this, e.getFirstRow()));
    116116            stoplistTM.setTimeAt(e.getFirstRow(),
    117117                    (String) stoplistTM.getValueAt(e.getFirstRow(), 0));
     
    182182            Command cmd = new ChangeCommand(node, newNode);
    183183            if (cmd != null) {
    184                 Main.main.undoRedo.add(cmd);
     184                UndoRedoHandler.getInstance().add(cmd);
    185185            }
    186186        }
Note: See TracChangeset for help on using the changeset viewer.