Changeset 26147 in osm for applications/editors/josm/plugins
- Timestamp:
- 2011-06-18T14:56:15+02:00 (13 years ago)
- Location:
- applications/editors/josm/plugins/public_transport/src/public_transport
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/public_transport/src/public_transport/GTFSImporterAction.java
r26144 r26147 74 74 { 75 75 super(tr("Create Stops from GTFS ..."), null, 76 tr("Create Stops from a GTFS file"), null, true);76 tr("Create Stops from a GTFS file"), null, false); 77 77 putValue("toolbar", "publictransport/gtfsimporter"); 78 Main.toolbar.register(this); 78 79 } 79 80 -
applications/editors/josm/plugins/public_transport/src/public_transport/RoutePatternAction.java
r26144 r26147 416 416 public RoutePatternAction() { 417 417 super(tr("Route patterns ..."), null, 418 tr("Edit Route patterns for public transport"), null, true);418 tr("Edit Route patterns for public transport"), null, false); 419 419 putValue("toolbar", "publictransport/routepattern"); 420 Main.toolbar.register(this); 420 421 } 421 422 -
applications/editors/josm/plugins/public_transport/src/public_transport/StopImporterAction.java
r26144 r26147 73 73 { 74 74 super(tr("Create Stops from GPX ..."), null, 75 tr("Create Stops from a GPX file"), null, true);75 tr("Create Stops from a GPX file"), null, false); 76 76 putValue("toolbar", "publictransport/stopimporter"); 77 Main.toolbar.register(this); 77 78 } 78 79 … … 113 114 if (curDir.equals("")) 114 115 { 115 curDir = ".";116 curDir = "."; 116 117 } 117 118 JFileChooser fc = new JFileChooser(new File(curDir)); … … 121 122 int answer = fc.showOpenDialog(Main.parent); 122 123 if (answer != JFileChooser.APPROVE_OPTION) 123 return;124 return; 124 125 125 126 if (!fc.getCurrentDirectory().getAbsolutePath().equals(curDir)) 126 Main.pref.put("lastDirectory", fc.getCurrentDirectory().getAbsolutePath());127 Main.pref.put("lastDirectory", fc.getCurrentDirectory().getAbsolutePath()); 127 128 128 129 importData(fc.getSelectedFile()); … … 133 134 { 134 135 if ((!inEvent) && (dialog.gpsTimeStartValid()) && (currentTrack != null)) 135 Main.main.undoRedo.add(new TrackStoplistRelocateCommand(this));136 Main.main.undoRedo.add(new TrackStoplistRelocateCommand(this)); 136 137 } 137 138 else if ("stopImporter.settingsStopwatchStart".equals(event.getActionCommand())) 138 139 { 139 140 if ((!inEvent) && (dialog.stopwatchStartValid()) && (currentTrack != null)) 140 Main.main.undoRedo.add(new TrackStoplistRelocateCommand(this));141 Main.main.undoRedo.add(new TrackStoplistRelocateCommand(this)); 141 142 } 142 143 else if ("stopImporter.settingsTimeWindow".equals(event.getActionCommand())) 143 144 { 144 145 if (currentTrack != null) 145 currentTrack.timeWindow = dialog.getTimeWindow();146 currentTrack.timeWindow = dialog.getTimeWindow(); 146 147 } 147 148 else if ("stopImporter.settingsThreshold".equals(event.getActionCommand())) 148 149 { 149 150 if (currentTrack != null) 150 currentTrack.threshold = dialog.getThreshold();151 currentTrack.threshold = dialog.getThreshold(); 151 152 } 152 153 else if ("stopImporter.settingsSuggestStops".equals(event.getActionCommand())) … … 194 195 InputStream is; 195 196 if (file.getName().endsWith(".gpx.gz")) 196 is = new GZIPInputStream(new FileInputStream(file));197 is = new GZIPInputStream(new FileInputStream(file)); 197 198 else 198 is = new FileInputStream(file);199 is = new FileInputStream(file); 199 200 // Workaround for SAX BOM bug 200 201 // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6206835 201 202 if (!((is.read() == 0xef) && (is.read() == 0xbb) && (is.read() == 0xbf))) 202 203 { 203 is.close();204 if (file.getName().endsWith(".gpx.gz"))205 is = new GZIPInputStream(new FileInputStream(file));206 else207 is = new FileInputStream(file);204 is.close(); 205 if (file.getName().endsWith(".gpx.gz")) 206 is = new GZIPInputStream(new FileInputStream(file)); 207 else 208 is = new FileInputStream(file); 208 209 } 209 210 final GpxReader r = new GpxReader(is); … … 213 214 if (!parsedProperly) 214 215 { 215 JOptionPane.showMessageDialog(null, tr("Error occured while parsing gpx file {0}. Only part of the file will be available", file.getName()));216 JOptionPane.showMessageDialog(null, tr("Error occured while parsing gpx file {0}. Only part of the file will be available", file.getName())); 216 217 } 217 218 } … … 242 243 while (trackIter.hasNext()) 243 244 { 244 GpxTrack track = trackIter.next();245 trackRefs.add(new TrackReference(track, this));245 GpxTrack track = trackIter.next(); 246 trackRefs.add(new TrackReference(track, this)); 246 247 } 247 248 … … 250 251 Iterator< TrackReference > iter = trackRefs.iterator(); 251 252 while (iter.hasNext()) 252 tracksListModel.addElement(iter.next());253 tracksListModel.addElement(iter.next()); 253 254 254 255 waypointTM = new WaypointTableModel(this); … … 256 257 while (waypointIter.hasNext()) 257 258 { 258 WayPoint waypoint = waypointIter.next();259 waypointTM.addRow(waypoint);259 WayPoint waypoint = waypointIter.next(); 260 waypointTM.addRow(waypoint); 260 261 } 261 262 dialog.setWaypointsTableModel(waypointTM); … … 435 436 public void actionPerformed(ActionEvent e) 436 437 { 437 JTable table = dialog.getWaypointsTable();438 int row = table.getEditingRow();439 if (row < 0)440 return;441 table.clearSelection();442 table.addRowSelectionInterval(row, row);443 Main.main.undoRedo.add438 JTable table = dialog.getWaypointsTable(); 439 int row = table.getEditingRow(); 440 if (row < 0) 441 return; 442 table.clearSelection(); 443 table.addRowSelectionInterval(row, row); 444 Main.main.undoRedo.add 444 445 (new WaypointsDisableCommand(StopImporterAction.this)); 445 446 } … … 484 485 int row = table.getEditingRow(); 485 486 if (row < 0) 486 row = 0;487 row = 0; 487 488 waypointTM.inEvent = true; 488 489 if (table.getCellEditor() != null) 489 490 { 490 if (!table.getCellEditor().stopCellEditing())491 table.getCellEditor().cancelCellEditing();491 if (!table.getCellEditor().stopCellEditing()) 492 table.getCellEditor().cancelCellEditing(); 492 493 } 493 494 table.editCellAt(row, 1); … … 514 515 int row = table.getEditingRow(); 515 516 if (row < 0) 516 row = 0;517 row = 0; 517 518 waypointTM.inEvent = true; 518 519 if (table.getCellEditor() != null) 519 520 { 520 if (!table.getCellEditor().stopCellEditing())521 table.getCellEditor().cancelCellEditing();521 if (!table.getCellEditor().stopCellEditing()) 522 table.getCellEditor().cancelCellEditing(); 522 523 } 523 524 table.editCellAt(row, 2); … … 537 538 int row = table.getEditingRow(); 538 539 if (row < 0) 539 row = 0;540 row = 0; 540 541 currentTrack.inEvent = true; 541 542 if (table.getCellEditor() != null) 542 543 { 543 if (!table.getCellEditor().stopCellEditing())544 table.getCellEditor().cancelCellEditing();544 if (!table.getCellEditor().stopCellEditing()) 545 table.getCellEditor().cancelCellEditing(); 545 546 } 546 547 table.editCellAt(row, 1); … … 567 568 int row = table.getEditingRow(); 568 569 if (row < 0) 569 row = 0;570 row = 0; 570 571 currentTrack.inEvent = true; 571 572 if (table.getCellEditor() != null) 572 573 { 573 if (!table.getCellEditor().stopCellEditing())574 table.getCellEditor().cancelCellEditing();574 if (!table.getCellEditor().stopCellEditing()) 575 table.getCellEditor().cancelCellEditing(); 575 576 } 576 577 table.editCellAt(row, 2);
Note:
See TracChangeset
for help on using the changeset viewer.