Changeset 34548 in osm
- Timestamp:
- 2018-08-18T19:34:51+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/public_transport
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/public_transport/build.xml
r34265 r34548 5 5 <property name="commit.message" value="Commit message"/> 6 6 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 7 <property name="plugin.main.version" value="1 3906"/>7 <property name="plugin.main.version" value="14153"/> 8 8 9 9 <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 23 23 import javax.swing.JTable; 24 24 25 import org.openstreetmap.josm.Main;26 25 import org.openstreetmap.josm.actions.JosmAction; 26 import org.openstreetmap.josm.data.UndoRedoHandler; 27 27 import org.openstreetmap.josm.data.coor.LatLon; 28 28 import org.openstreetmap.josm.data.osm.DataSet; … … 39 39 import org.openstreetmap.josm.plugins.public_transport.models.GTFSStopTableModel; 40 40 import org.openstreetmap.josm.plugins.public_transport.refs.TrackReference; 41 import org.openstreetmap.josm.spi.preferences.Config; 41 42 import org.openstreetmap.josm.tools.Logging; 42 43 … … 94 95 95 96 if (tr("Create Stops from GTFS ...").equals(event.getActionCommand())) { 96 String curDir = Main.pref.get("lastDirectory");97 String curDir = Config.getPref().get("lastDirectory"); 97 98 if (curDir.isEmpty()) { 98 99 curDir = "."; … … 102 103 fc.setMultiSelectionEnabled(false); 103 104 104 int answer = fc.showOpenDialog(Main .parent);105 int answer = fc.showOpenDialog(MainApplication.getMainFrame()); 105 106 if (answer != JFileChooser.APPROVE_OPTION) 106 107 return; 107 108 108 109 if (!fc.getCurrentDirectory().getAbsolutePath().equals(curDir)) 109 Main.pref.put("lastDirectory", fc.getCurrentDirectory().getAbsolutePath());110 Config.getPref().put("lastDirectory", fc.getCurrentDirectory().getAbsolutePath()); 110 111 111 112 importData(fc.getSelectedFile()); … … 116 117 { 117 118 if ((!inEvent) && (dialog.gpsTimeStartValid()) && (currentTrack != null)) 118 Main.main.undoRedo.add(new TrackStoplistRelocateCommand(this));119 UndoRedoHandler.getInstance().add(new TrackStoplistRelocateCommand(this)); 119 120 } 120 121 else if ("stopImporter.settingsStopwatchStart".equals(event.getActionCommand())) 121 122 { 122 123 if ((!inEvent) && (dialog.stopwatchStartValid()) && (currentTrack != null)) 123 Main.main.undoRedo.add(new TrackStoplistRelocateCommand(this));124 UndoRedoHandler.getInstance().add(new TrackStoplistRelocateCommand(this)); 124 125 } 125 126 else if ("stopImporter.settingsTimeWindow".equals(event.getActionCommand())) … … 134 135 } 135 136 else if ("stopImporter.settingsSuggestStops".equals(event.getActionCommand())) 136 Main.main.undoRedo.add(new TrackSuggestStopsCommand(this));137 UndoRedoHandler.getInstance().add(new TrackSuggestStopsCommand(this)); 137 138 else if ("stopImporter.stoplistFind".equals(event.getActionCommand())) 138 139 findNodesInTable(dialog.getStoplistTable(), currentTrack.stoplistTM.getNodes()); … … 143 144 else if ("stopImporter.stoplistDetach".equals(event.getActionCommand())) 144 145 { 145 Main.main.undoRedo.add(new TrackStoplistDetachCommand(this));146 UndoRedoHandler.getInstance().add(new TrackStoplistDetachCommand(this)); 146 147 dialog.getStoplistTable().clearSelection(); 147 148 */ 148 149 } else if ("gtfsImporter.gtfsStopsAdd".equals(event.getActionCommand())) 149 Main.main.undoRedo.add(new GTFSAddCommand(this));150 UndoRedoHandler.getInstance().add(new GTFSAddCommand(this)); 150 151 else if ("gtfsImporter.gtfsStopsDelete".equals(event.getActionCommand())) 151 Main.main.undoRedo.add(new GTFSDeleteCommand(this));152 UndoRedoHandler.getInstance().add(new GTFSDeleteCommand(this)); 152 153 else if ("gtfsImporter.gtfsStopsCatch".equals(event.getActionCommand())) 153 Main.main.undoRedo.add(new GTFSCatchCommand(this));154 UndoRedoHandler.getInstance().add(new GTFSCatchCommand(this)); 154 155 else if ("gtfsImporter.gtfsStopsJoin".equals(event.getActionCommand())) 155 Main.main.undoRedo.add(new GTFSJoinCommand(this));156 UndoRedoHandler.getInstance().add(new GTFSJoinCommand(this)); 156 157 else if ("gtfsImporter.gtfsStopsFind".equals(event.getActionCommand())) 157 158 findNodesInTable(dialog.getGTFSStopTable(), gtfsStopTM.nodes); … … 359 360 @Override 360 361 public void actionPerformed(ActionEvent e) { 361 Main.main.undoRedo.add(new GTFSAddCommand(GTFSImporterAction.this));362 UndoRedoHandler.getInstance().add(new GTFSAddCommand(GTFSImporterAction.this)); 362 363 showNodesFromTable(dialog.getGTFSStopTable(), gtfsStopTM.nodes); 363 364 } … … 381 382 table.clearSelection(); 382 383 table.addRowSelectionInterval(row, row); 383 /* Main.main.undoRedo.add384 /* UndoRedoHandler.getInstance().add 384 385 (new WaypointsDisableCommand(GTFSImporterAction.this));* 385 386 } … … 409 410 table.clearSelection(); 410 411 table.addRowSelectionInterval(row, row); 411 /* Main.main.undoRedo.add412 /* UndoRedoHandler.getInstance().add 412 413 (new TrackStoplistDeleteCommand(GTFSImporterAction.this));* 413 414 } -
applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport/actions/RoutePatternAction.java
r34265 r34548 43 43 import javax.swing.table.TableCellEditor; 44 44 45 import org.openstreetmap.josm.Main;46 45 import org.openstreetmap.josm.actions.JosmAction; 47 46 import org.openstreetmap.josm.actions.mapmode.DeleteAction; … … 335 334 @Override 336 335 public void actionPerformed(ActionEvent event) { 337 Frame frame = JOptionPane.getFrameForComponent(Main .parent);336 Frame frame = JOptionPane.getFrameForComponent(MainApplication.getMainFrame()); 338 337 DataSet mainDataSet = MainApplication.getLayerManager().getEditDataSet(); 339 338 -
applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport/actions/StopImporterAction.java
r34265 r34548 24 24 import javax.swing.JTable; 25 25 26 import org.openstreetmap.josm.Main;27 26 import org.openstreetmap.josm.actions.JosmAction; 27 import org.openstreetmap.josm.data.UndoRedoHandler; 28 28 import org.openstreetmap.josm.data.coor.LatLon; 29 29 import org.openstreetmap.josm.data.gpx.GpxData; … … 50 50 import org.openstreetmap.josm.plugins.public_transport.models.WaypointTableModel; 51 51 import org.openstreetmap.josm.plugins.public_transport.refs.TrackReference; 52 import org.openstreetmap.josm.spi.preferences.Config; 52 53 import org.xml.sax.SAXException; 53 54 … … 104 105 105 106 if (tr("Create Stops from GPX ...").equals(event.getActionCommand())) { 106 String curDir = Main.pref.get("lastDirectory");107 String curDir = Config.getPref().get("lastDirectory"); 107 108 if (curDir.equals("")) { 108 109 curDir = "."; … … 112 113 fc.setMultiSelectionEnabled(false); 113 114 114 int answer = fc.showOpenDialog(Main .parent);115 int answer = fc.showOpenDialog(MainApplication.getMainFrame()); 115 116 if (answer != JFileChooser.APPROVE_OPTION) 116 117 return; 117 118 118 119 if (!fc.getCurrentDirectory().getAbsolutePath().equals(curDir)) 119 Main.pref.put("lastDirectory", fc.getCurrentDirectory().getAbsolutePath());120 Config.getPref().put("lastDirectory", fc.getCurrentDirectory().getAbsolutePath()); 120 121 121 122 importData(fc.getSelectedFile()); … … 124 125 } else if ("stopImporter.settingsGPSTimeStart".equals(event.getActionCommand())) { 125 126 if ((!inEvent) && (dialog.gpsTimeStartValid()) && (currentTrack != null)) 126 Main.main.undoRedo.add(new TrackStoplistRelocateCommand(this));127 UndoRedoHandler.getInstance().add(new TrackStoplistRelocateCommand(this)); 127 128 } else if ("stopImporter.settingsStopwatchStart".equals(event.getActionCommand())) { 128 129 if ((!inEvent) && (dialog.stopwatchStartValid()) && (currentTrack != null)) 129 Main.main.undoRedo.add(new TrackStoplistRelocateCommand(this));130 UndoRedoHandler.getInstance().add(new TrackStoplistRelocateCommand(this)); 130 131 } else if ("stopImporter.settingsTimeWindow".equals(event.getActionCommand())) { 131 132 if (currentTrack != null) … … 135 136 currentTrack.threshold = dialog.getThreshold(); 136 137 } else if ("stopImporter.settingsSuggestStops".equals(event.getActionCommand())) 137 Main.main.undoRedo.add(new TrackSuggestStopsCommand(this));138 UndoRedoHandler.getInstance().add(new TrackSuggestStopsCommand(this)); 138 139 else if ("stopImporter.stoplistFind".equals(event.getActionCommand())) 139 140 findNodesInTable(dialog.getStoplistTable(), currentTrack.stoplistTM.getNodes()); … … 143 144 markNodesFromTable(dialog.getStoplistTable(), currentTrack.stoplistTM.getNodes()); 144 145 else if ("stopImporter.stoplistDetach".equals(event.getActionCommand())) { 145 Main.main.undoRedo.add(new TrackStoplistDetachCommand(this));146 UndoRedoHandler.getInstance().add(new TrackStoplistDetachCommand(this)); 146 147 dialog.getStoplistTable().clearSelection(); 147 148 } else if ("stopImporter.stoplistAdd".equals(event.getActionCommand())) 148 Main.main.undoRedo.add(new TrackStoplistAddCommand(this));149 UndoRedoHandler.getInstance().add(new TrackStoplistAddCommand(this)); 149 150 else if ("stopImporter.stoplistDelete".equals(event.getActionCommand())) 150 Main.main.undoRedo.add(new TrackStoplistDeleteCommand(this));151 UndoRedoHandler.getInstance().add(new TrackStoplistDeleteCommand(this)); 151 152 else if ("stopImporter.stoplistSort".equals(event.getActionCommand())) 152 Main.main.undoRedo.add(new TrackStoplistSortCommand(this));153 UndoRedoHandler.getInstance().add(new TrackStoplistSortCommand(this)); 153 154 else if ("stopImporter.waypointsFind".equals(event.getActionCommand())) 154 155 findNodesInTable(dialog.getWaypointsTable(), waypointTM.nodes); … … 158 159 markNodesFromTable(dialog.getWaypointsTable(), waypointTM.nodes); 159 160 else if ("stopImporter.waypointsDetach".equals(event.getActionCommand())) { 160 Main.main.undoRedo.add(new WaypointsDetachCommand(this));161 UndoRedoHandler.getInstance().add(new WaypointsDetachCommand(this)); 161 162 dialog.getWaypointsTable().clearSelection(); 162 163 } else if ("stopImporter.waypointsAdd".equals(event.getActionCommand())) 163 Main.main.undoRedo.add(new WaypointsEnableCommand(this));164 UndoRedoHandler.getInstance().add(new WaypointsEnableCommand(this)); 164 165 else if ("stopImporter.waypointsDelete".equals(event.getActionCommand())) 165 Main.main.undoRedo.add(new WaypointsDisableCommand(this));166 UndoRedoHandler.getInstance().add(new WaypointsDisableCommand(this)); 166 167 else if ("stopImporter.settingsStoptype".equals(event.getActionCommand())) 167 Main.main.undoRedo.add(new SettingsStoptypeCommand(this));168 UndoRedoHandler.getInstance().add(new SettingsStoptypeCommand(this)); 168 169 } 169 170 … … 400 401 table.clearSelection(); 401 402 table.addRowSelectionInterval(row, row); 402 Main.main.undoRedo.add(new WaypointsDisableCommand(StopImporterAction.this));403 UndoRedoHandler.getInstance().add(new WaypointsDisableCommand(StopImporterAction.this)); 403 404 } 404 405 }; … … 423 424 table.clearSelection(); 424 425 table.addRowSelectionInterval(row, row); 425 Main.main.undoRedo.add(new TrackStoplistDeleteCommand(StopImporterAction.this));426 UndoRedoHandler.getInstance().add(new TrackStoplistDeleteCommand(StopImporterAction.this)); 426 427 } 427 428 }; -
applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport/dialogs/AbstractImporterDialog.java
r33765 r34548 13 13 import javax.swing.JTextField; 14 14 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.actions.JosmAction; 16 import org.openstreetmap.josm.gui.MainApplication; 17 17 import org.openstreetmap.josm.plugins.public_transport.TransText; 18 18 … … 44 44 45 45 public AbstractImporterDialog(T controller, String dialogTitle, String actionPrefix) { 46 Frame frame = JOptionPane.getFrameForComponent(Main .parent);46 Frame frame = JOptionPane.getFrameForComponent(MainApplication.getMainFrame()); 47 47 jDialog = new JDialog(frame, dialogTitle, false); 48 48 tabbedPane = new JTabbedPane(); -
applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport/models/WaypointTableModel.java
r33765 r34548 10 10 import javax.swing.table.DefaultTableModel; 11 11 12 import org.openstreetmap.josm. Main;12 import org.openstreetmap.josm.data.UndoRedoHandler; 13 13 import org.openstreetmap.josm.data.coor.LatLon; 14 14 import org.openstreetmap.josm.data.gpx.WayPoint; … … 88 88 if (inEvent) 89 89 return; 90 Main.main.undoRedo.add(new WaypointsNameCommand(this, e.getFirstRow(),90 UndoRedoHandler.getInstance().add(new WaypointsNameCommand(this, e.getFirstRow(), 91 91 (String) getValueAt(e.getFirstRow(), 1), 92 92 (TransText) getValueAt(e.getFirstRow(), 2))); -
applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport/refs/TrackReference.java
r33765 r34548 10 10 import javax.swing.event.TableModelListener; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.command.ChangeCommand; 14 13 import org.openstreetmap.josm.command.Command; 14 import org.openstreetmap.josm.data.UndoRedoHandler; 15 15 import org.openstreetmap.josm.data.coor.LatLon; 16 16 import org.openstreetmap.josm.data.gpx.GpxTrack; … … 113 113 } 114 114 115 Main.main.undoRedo.add(new TrackStoplistNameCommand(this, e.getFirstRow()));115 UndoRedoHandler.getInstance().add(new TrackStoplistNameCommand(this, e.getFirstRow())); 116 116 stoplistTM.setTimeAt(e.getFirstRow(), 117 117 (String) stoplistTM.getValueAt(e.getFirstRow(), 0)); … … 182 182 Command cmd = new ChangeCommand(node, newNode); 183 183 if (cmd != null) { 184 Main.main.undoRedo.add(cmd);184 UndoRedoHandler.getInstance().add(cmd); 185 185 } 186 186 }
Note:
See TracChangeset
for help on using the changeset viewer.