- Timestamp:
- 2016-11-13T14:49:39+01:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r11240 r11252 760 760 return; 761 761 case 1: 762 Main.main.undoRedo.add(cmds.getFirst());762 commitCommand(cmds.getFirst()); 763 763 break; 764 764 default: 765 Command c = new SequenceCommand(tr(description), cmds); 766 Main.main.undoRedo.add(c); 765 commitCommand(new SequenceCommand(tr(description), cmds)); 767 766 break; 768 767 } … … 770 769 cmds.clear(); 771 770 cmdsCount++; 771 } 772 773 private static void commitCommand(Command c) { 774 if (Main.main != null) { 775 Main.main.undoRedo.add(c); 776 } else { 777 c.executeCommand(); 778 } 772 779 } 773 780 … … 1279 1286 if (!way.insideToTheRight) { 1280 1287 ReverseWayResult res = ReverseWayAction.reverseWay(way.way); 1281 Main.main.undoRedo.add(res.getReverseCommand());1288 commitCommand(res.getReverseCommand()); 1282 1289 cmdsCount++; 1283 1290 } … … 1286 1293 Pair<Way, Command> result = CombineWayAction.combineWaysWorker(actionWays); 1287 1294 1288 Main.main.undoRedo.add(result.b);1295 commitCommand(result.b); 1289 1296 cmdsCount++; 1290 1297 … … 1536 1543 */ 1537 1544 private void makeCommitsOneAction(String message) { 1538 UndoRedoHandler ur = Main.main.undoRedo;1539 1545 cmds.clear(); 1540 int i = Math.max(ur.commands.size() - cmdsCount, 0); 1541 for (; i < ur.commands.size(); i++) { 1542 cmds.add(ur.commands.get(i)); 1543 } 1544 1545 for (i = 0; i < cmds.size(); i++) { 1546 ur.undo(); 1546 if (Main.main != null) { 1547 UndoRedoHandler ur = Main.main.undoRedo; 1548 int i = Math.max(ur.commands.size() - cmdsCount, 0); 1549 for (; i < ur.commands.size(); i++) { 1550 cmds.add(ur.commands.get(i)); 1551 } 1552 1553 for (i = 0; i < cmds.size(); i++) { 1554 ur.undo(); 1555 } 1547 1556 } 1548 1557 -
trunk/src/org/openstreetmap/josm/actions/PurgeAction.java
r11240 r11252 72 72 protected transient OsmDataLayer layer; 73 73 protected JCheckBox cbClearUndoRedo; 74 protected boolean modified; 74 75 75 76 protected transient Set<OsmPrimitive> toPurge; … … 93 94 return; 94 95 95 doPurge(getLayerManager().getEditDataSet().getAllSelected(), true); 96 } 97 98 /** 99 * Performs purge on selected OSM primitives. 96 PurgeCommand cmd = getPurgeCommand(getLayerManager().getEditDataSet().getAllSelected()); 97 boolean clearUndoRedo = false; 98 99 if (!GraphicsEnvironment.isHeadless()) { 100 final boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog( 101 "purge", Main.parent, buildPanel(modified), tr("Confirm Purging"), 102 JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_OPTION); 103 if (!answer) 104 return; 105 106 clearUndoRedo = cbClearUndoRedo.isSelected(); 107 Main.pref.put("purge.clear_undo_redo", clearUndoRedo); 108 } 109 110 Main.main.undoRedo.add(cmd); 111 if (clearUndoRedo) { 112 Main.main.undoRedo.clean(); 113 getLayerManager().getEditDataSet().clearSelectionHistory(); 114 } 115 } 116 117 /** 118 * Creates command to purge selected OSM primitives. 100 119 * @param sel selected OSM primitives 101 * @ param confirm asks user confirmation through a popup dialog102 * @since 112 40103 */ 104 public void doPurge(Collection<OsmPrimitive> sel, boolean confirm) {120 * @return command to purge selected OSM primitives 121 * @since 11252 122 */ 123 public PurgeCommand getPurgeCommand(Collection<OsmPrimitive> sel) { 105 124 layer = Main.getLayerManager().getEditLayer(); 106 125 … … 204 223 } 205 224 206 booleanmodified = false;225 modified = false; 207 226 for (OsmPrimitive osm : toPurgeChecked) { 208 227 if (osm.isModified()) { … … 212 231 } 213 232 214 boolean clearUndoRedo = false; 215 216 if (!GraphicsEnvironment.isHeadless() && confirm) { 217 final boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog( 218 "purge", Main.parent, buildPanel(modified), tr("Confirm Purging"), 219 JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_OPTION); 220 if (!answer) 221 return; 222 223 clearUndoRedo = cbClearUndoRedo.isSelected(); 224 Main.pref.put("purge.clear_undo_redo", clearUndoRedo); 225 } 226 227 Main.main.undoRedo.add(layer != null ? new PurgeCommand(layer, toPurgeChecked, makeIncomplete) : 228 new PurgeCommand(toPurgeChecked.iterator().next().getDataSet(), toPurgeChecked, makeIncomplete)); 229 230 if (clearUndoRedo) { 231 Main.main.undoRedo.clean(); 232 getLayerManager().getEditDataSet().clearSelectionHistory(); 233 } 233 return layer != null ? new PurgeCommand(layer, toPurgeChecked, makeIncomplete) : 234 new PurgeCommand(toPurgeChecked.iterator().next().getDataSet(), toPurgeChecked, makeIncomplete); 234 235 } 235 236 -
trunk/src/org/openstreetmap/josm/tools/RightAndLefthandTraffic.java
r11249 r11252 81 81 */ 82 82 public static synchronized boolean isRightHandTraffic(LatLon ll) { 83 if (rlCache == null) {84 initialize();85 }86 83 return !rlCache.get(ll); 87 84 } … … 137 134 } 138 135 // Purge all other ways and relations so dataset only contains lefthand traffic data 139 new PurgeAction(). doPurge(toPurge, false);136 new PurgeAction().getPurgeCommand(toPurge).executeCommand(); 140 137 // Combine adjacent countries into a single polygon 141 138 Collection<Way> optimizedWays = new ArrayList<>();
Note:
See TracChangeset
for help on using the changeset viewer.