Changeset 15053 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2019-05-05T21:04:04+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AddNodeAction.java
r14397 r15053 8 8 import java.awt.event.KeyEvent; 9 9 import java.util.Collections; 10 11 import javax.swing.SwingUtilities; 10 12 11 13 import org.openstreetmap.josm.command.AddCommand; … … 43 45 return; 44 46 45 LatLonDialog dialog = new LatLonDialog(MainApplication.getMainFrame(), tr("Add Node..."), ht("/Action/AddNode")); 47 // #17682 - Run the action later in EDT to make sure the KeyEvent triggering it is consumed before the dialog is shown 48 SwingUtilities.invokeLater(() -> { 49 LatLonDialog dialog = new LatLonDialog(MainApplication.getMainFrame(), tr("Add Node..."), ht("/Action/AddNode")); 46 50 47 if (textLatLon != null) {48 dialog.setLatLonText(textLatLon);49 }50 if (textEastNorth != null) {51 dialog.setEastNorthText(textEastNorth);52 }51 if (textLatLon != null) { 52 dialog.setLatLonText(textLatLon); 53 } 54 if (textEastNorth != null) { 55 dialog.setEastNorthText(textEastNorth); 56 } 53 57 54 dialog.showDialog();58 dialog.showDialog(); 55 59 56 if (dialog.getValue() != 1)57 return;60 if (dialog.getValue() != 1) 61 return; 58 62 59 LatLon coordinates = dialog.getCoordinates();60 if (coordinates == null)61 return;63 LatLon coordinates = dialog.getCoordinates(); 64 if (coordinates == null) 65 return; 62 66 63 textLatLon = dialog.getLatLonText();64 textEastNorth = dialog.getEastNorthText();67 textLatLon = dialog.getLatLonText(); 68 textEastNorth = dialog.getEastNorthText(); 65 69 66 Node nnew = new Node(coordinates);70 Node nnew = new Node(coordinates); 67 71 68 // add the node 69 DataSet ds = getLayerManager().getEditDataSet(); 70 UndoRedoHandler.getInstance().add(new AddCommand(ds, nnew)); 71 ds.setSelected(nnew); 72 MapView mapView = MainApplication.getMap().mapView; 73 if (mapView != null && !mapView.getRealBounds().contains(nnew.getCoor())) { 74 AutoScaleAction.zoomTo(Collections.<OsmPrimitive>singleton(nnew)); 75 } 72 // add the node 73 DataSet ds = getLayerManager().getEditDataSet(); 74 UndoRedoHandler.getInstance().add(new AddCommand(ds, nnew)); 75 ds.setSelected(nnew); 76 MapView mapView = MainApplication.getMap().mapView; 77 if (mapView != null && !mapView.getRealBounds().contains(nnew.getCoor())) { 78 AutoScaleAction.zoomTo(Collections.<OsmPrimitive>singleton(nnew)); 79 } 80 }); 76 81 } 77 82
Note:
See TracChangeset
for help on using the changeset viewer.