Changeset 12641 in josm for trunk/src/org
- Timestamp:
- 2017-08-25T03:01:22+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 51 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r12639 r12641 138 138 /** 139 139 * The commands undo/redo handler. 140 */ 141 public final UndoRedoHandler undoRedo = new UndoRedoHandler(); 140 * @deprecated Use {@link MainApplication#undoRedo} instead 141 */ 142 @Deprecated 143 public final UndoRedoHandler undoRedo = MainApplication.undoRedo; 142 144 143 145 /** … … 446 448 /** 447 449 * Platform specific code goes in here. 448 * Plugins may replace it, however, some hooks will be called before any plugins have been lo eaded.450 * Plugins may replace it, however, some hooks will be called before any plugins have been loaded. 449 451 * So if you need to hook into those early ones, split your class and send the one with the early hooks 450 452 * to the JOSM team for inclusion. -
trunk/src/org/openstreetmap/josm/actions/AddNodeAction.java
r12630 r12641 66 66 67 67 // add the node 68 Main .main.undoRedo.add(new AddCommand(nnew));68 MainApplication.undoRedo.add(new AddCommand(nnew)); 69 69 getLayerManager().getEditDataSet().setSelected(nnew); 70 70 MapView mapView = MainApplication.getMap().mapView; -
trunk/src/org/openstreetmap/josm/actions/AlignInCircleAction.java
r10763 r12641 17 17 import javax.swing.JOptionPane; 18 18 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.command.Command; 21 20 import org.openstreetmap.josm.command.MoveCommand; … … 26 25 import org.openstreetmap.josm.data.osm.OsmPrimitive; 27 26 import org.openstreetmap.josm.data.osm.Way; 27 import org.openstreetmap.josm.gui.MainApplication; 28 28 import org.openstreetmap.josm.gui.Notification; 29 29 import org.openstreetmap.josm.tools.Geometry; … … 283 283 } 284 284 285 Main .main.undoRedo.add(new SequenceCommand(tr("Align Nodes in Circle"), cmds));285 MainApplication.undoRedo.add(new SequenceCommand(tr("Align Nodes in Circle"), cmds)); 286 286 } 287 287 -
trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java
r12620 r12641 17 17 import javax.swing.JOptionPane; 18 18 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.command.Command; 21 20 import org.openstreetmap.josm.command.MoveCommand; … … 26 25 import org.openstreetmap.josm.data.osm.OsmPrimitive; 27 26 import org.openstreetmap.josm.data.osm.Way; 27 import org.openstreetmap.josm.gui.MainApplication; 28 28 import org.openstreetmap.josm.gui.Notification; 29 29 import org.openstreetmap.josm.tools.Logging; … … 172 172 173 173 try { 174 Main .main.undoRedo.add(buildCommand());174 MainApplication.undoRedo.add(buildCommand()); 175 175 } catch (InvalidSelection except) { 176 176 Logging.debug(except); -
trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
r12620 r12641 32 32 import org.openstreetmap.josm.data.preferences.BooleanProperty; 33 33 import org.openstreetmap.josm.gui.ExtendedDialog; 34 import org.openstreetmap.josm.gui.MainApplication; 34 35 import org.openstreetmap.josm.gui.Notification; 35 36 import org.openstreetmap.josm.gui.conflict.tags.CombinePrimitiveResolverDialog; … … 173 174 if (!reverseWayTagCommands.isEmpty()) { 174 175 // commands need to be executed for CombinePrimitiveResolverDialog 175 Main .main.undoRedo.add(new SequenceCommand(tr("Reverse Ways"), reverseWayTagCommands));176 MainApplication.undoRedo.add(new SequenceCommand(tr("Reverse Ways"), reverseWayTagCommands)); 176 177 } 177 178 wayTags = TagCollection.unionOfAllPrimitives(reversedTagWays); … … 192 193 if (!reverseWayTagCommands.isEmpty()) { 193 194 // undo reverseWayTagCorrector and merge into SequenceCommand below 194 Main .main.undoRedo.undo();195 MainApplication.undoRedo.undo(); 195 196 } 196 197 } … … 236 237 return; 237 238 final Way selectedWay = combineResult.a; 238 Main .main.undoRedo.add(combineResult.b);239 MainApplication.undoRedo.add(combineResult.b); 239 240 if (selectedWay != null) { 240 241 GuiHelper.runInEDT(() -> ds.setSelected(selectedWay)); -
trunk/src/org/openstreetmap/josm/actions/CreateCircleAction.java
r10467 r12641 28 28 import org.openstreetmap.josm.data.osm.OsmPrimitive; 29 29 import org.openstreetmap.josm.data.osm.Way; 30 import org.openstreetmap.josm.gui.MainApplication; 30 31 import org.openstreetmap.josm.gui.Notification; 31 32 import org.openstreetmap.josm.tools.Geometry; … … 240 241 } 241 242 242 Main .main.undoRedo.add(new SequenceCommand(tr("Create Circle"), cmds));243 MainApplication.undoRedo.add(new SequenceCommand(tr("Create Circle"), cmds)); 243 244 } 244 245 -
trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java
r12636 r12641 107 107 // to avoid EDT violations 108 108 SwingUtilities.invokeLater(() -> { 109 Main .main.undoRedo.add(command);109 MainApplication.undoRedo.add(command); 110 110 111 111 // Use 'SwingUtilities.invokeLater' to make sure the relationListDialog -
trunk/src/org/openstreetmap/josm/actions/DistributeAction.java
r12620 r12641 16 16 import javax.swing.JOptionPane; 17 17 18 import org.openstreetmap.josm.Main;19 18 import org.openstreetmap.josm.command.Command; 20 19 import org.openstreetmap.josm.command.MoveCommand; … … 23 22 import org.openstreetmap.josm.data.osm.OsmPrimitive; 24 23 import org.openstreetmap.josm.data.osm.Way; 24 import org.openstreetmap.josm.gui.MainApplication; 25 25 import org.openstreetmap.josm.gui.Notification; 26 26 import org.openstreetmap.josm.tools.Logging; … … 98 98 99 99 // Do it! 100 Main .main.undoRedo.add(new SequenceCommand(tr("Distribute Nodes"), cmds));100 MainApplication.undoRedo.add(new SequenceCommand(tr("Distribute Nodes"), cmds)); 101 101 } 102 102 -
trunk/src/org/openstreetmap/josm/actions/FollowLineAction.java
r12636 r12641 11 11 import java.util.Set; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.actions.mapmode.DrawAction; 15 14 import org.openstreetmap.josm.command.ChangeCommand; … … 115 114 newFollower.addNode(newPoint); 116 115 } 117 Main .main.undoRedo.add(new SequenceCommand(tr("Follow line"),116 MainApplication.undoRedo.add(new SequenceCommand(tr("Follow line"), 118 117 new ChangeCommand(follower, newFollower), 119 118 new SelectCommand(newFollower.isClosed() // see #10028 - unselect last node when closing a way -
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r12636 r12641 41 41 import org.openstreetmap.josm.data.osm.TagCollection; 42 42 import org.openstreetmap.josm.data.osm.Way; 43 import org.openstreetmap.josm.gui.MainApplication; 43 44 import org.openstreetmap.josm.gui.Notification; 44 45 import org.openstreetmap.josm.gui.conflict.tags.CombinePrimitiveResolverDialog; … … 569 570 //FIXME: this is dirty hack 570 571 makeCommitsOneAction(tr("Reverting changes")); 571 Main .main.undoRedo.undo();572 Main .main.undoRedo.redoCommands.clear();572 MainApplication.undoRedo.undo(); 573 MainApplication.undoRedo.redoCommands.clear(); 573 574 } 574 575 } … … 826 827 private static void commitCommand(Command c) { 827 828 if (Main.main != null) { 828 Main .main.undoRedo.add(c);829 MainApplication.undoRedo.add(c); 829 830 } else { 830 831 c.executeCommand(); … … 1592 1593 cmds.clear(); 1593 1594 if (Main.main != null) { 1594 UndoRedoHandler ur = Main .main.undoRedo;1595 UndoRedoHandler ur = MainApplication.undoRedo; 1595 1596 int i = Math.max(ur.commands.size() - cmdsCount, 0); 1596 1597 for (; i < ur.commands.size(); i++) { -
trunk/src/org/openstreetmap/josm/actions/JoinNodeWayAction.java
r12630 r12641 19 19 import java.util.TreeSet; 20 20 21 import org.openstreetmap.josm.Main;22 21 import org.openstreetmap.josm.command.ChangeCommand; 23 22 import org.openstreetmap.josm.command.Command; … … 160 159 161 160 if (cmds.isEmpty()) return; 162 Main .main.undoRedo.add(new SequenceCommand(getValue(NAME).toString(), cmds));161 MainApplication.undoRedo.add(new SequenceCommand(getValue(NAME).toString(), cmds)); 163 162 } 164 163 -
trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java
r12636 r12641 95 95 Command cmd = mergeNodes(getLayerManager().getEditLayer(), selectedNodes, targetNode, targetLocationNode); 96 96 if (cmd != null) { 97 Main .main.undoRedo.add(cmd);97 MainApplication.undoRedo.add(cmd); 98 98 getLayerManager().getEditLayer().data.setSelected(targetNode); 99 99 } … … 274 274 Command cmd = mergeNodes(layer, nodes, target, targetLocationNode); 275 275 if (cmd != null) { 276 Main .main.undoRedo.add(cmd);276 MainApplication.undoRedo.add(cmd); 277 277 layer.data.setSelected(target); 278 278 } -
trunk/src/org/openstreetmap/josm/actions/MirrorAction.java
r10467 r12641 14 14 import javax.swing.JOptionPane; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.command.Command; 18 17 import org.openstreetmap.josm.command.MoveCommand; … … 21 20 import org.openstreetmap.josm.data.osm.OsmPrimitive; 22 21 import org.openstreetmap.josm.data.osm.Way; 22 import org.openstreetmap.josm.gui.MainApplication; 23 23 import org.openstreetmap.josm.gui.Notification; 24 24 import org.openstreetmap.josm.tools.Shortcut; … … 80 80 } 81 81 82 Main .main.undoRedo.add(new SequenceCommand(tr("Mirror"), cmds));82 MainApplication.undoRedo.add(new SequenceCommand(tr("Mirror"), cmds)); 83 83 } 84 84 -
trunk/src/org/openstreetmap/josm/actions/MoveAction.java
r12637 r12641 136 136 Collection<Node> affectedNodes = AllNodesVisitor.getAllNodes(selection); 137 137 138 Command c = Main .main.undoRedo.getLastCommand();138 Command c = MainApplication.undoRedo.getLastCommand(); 139 139 140 140 ds.beginUpdate(); … … 145 145 } else { 146 146 c = new MoveCommand(selection, distx, disty); 147 Main .main.undoRedo.add(c);147 MainApplication.undoRedo.add(c); 148 148 } 149 149 } finally { -
trunk/src/org/openstreetmap/josm/actions/MoveNodeAction.java
r12630 r12641 50 50 51 51 // move the node 52 Main .main.undoRedo.add(new MoveCommand(n, coordinates));52 MainApplication.undoRedo.add(new MoveCommand(n, coordinates)); 53 53 MainApplication.getMap().mapView.repaint(); 54 54 } -
trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java
r12620 r12641 30 30 import org.openstreetmap.josm.data.osm.Way; 31 31 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil; 32 import org.openstreetmap.josm.gui.MainApplication; 32 33 import org.openstreetmap.josm.gui.Notification; 33 34 import org.openstreetmap.josm.tools.JosmRuntimeException; … … 116 117 } 117 118 if (!commands.isEmpty()) { 118 Main .main.undoRedo.add(new SequenceCommand(tr("Orthogonalize / Undo"), commands));119 MainApplication.undoRedo.add(new SequenceCommand(tr("Orthogonalize / Undo"), commands)); 119 120 } else { 120 121 throw new InvalidUserInputException("Commands are empty"); … … 165 166 try { 166 167 final SequenceCommand command = orthogonalize(sel); 167 Main .main.undoRedo.add(new SequenceCommand(tr("Orthogonalize"), command));168 MainApplication.undoRedo.add(new SequenceCommand(tr("Orthogonalize"), command)); 168 169 } catch (InvalidUserInputException ex) { 169 170 Logging.debug(ex); -
trunk/src/org/openstreetmap/josm/actions/PurgeAction.java
r12636 r12641 38 38 import org.openstreetmap.josm.data.osm.Way; 39 39 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil; 40 import org.openstreetmap.josm.gui.MainApplication; 40 41 import org.openstreetmap.josm.gui.OsmPrimitivRenderer; 41 42 import org.openstreetmap.josm.gui.help.HelpUtil; … … 125 126 } 126 127 127 Main .main.undoRedo.add(cmd);128 MainApplication.undoRedo.add(cmd); 128 129 if (clearUndoRedo) { 129 Main .main.undoRedo.clean();130 MainApplication.undoRedo.clean(); 130 131 getLayerManager().getEditDataSet().clearSelectionHistory(); 131 132 } -
trunk/src/org/openstreetmap/josm/actions/RedoAction.java
r12630 r12641 37 37 return; 38 38 map.repaint(); 39 Main .main.undoRedo.redo();39 MainApplication.undoRedo.redo(); 40 40 } 41 41 42 42 @Override 43 43 protected void updateEnabledState() { 44 setEnabled(Main.main != null && !Main .main.undoRedo.redoCommands.isEmpty());44 setEnabled(Main.main != null && !MainApplication.undoRedo.redoCommands.isEmpty()); 45 45 } 46 46 47 47 @Override 48 48 public void commandChanged(int queueSize, int redoSize) { 49 if (Main .main.undoRedo.redoCommands.isEmpty()) {49 if (MainApplication.undoRedo.redoCommands.isEmpty()) { 50 50 putValue(NAME, tr("Redo")); 51 51 setTooltip(tr("Redo the last undone action.")); … … 53 53 putValue(NAME, tr("Redo ...")); 54 54 setTooltip(tr("Redo {0}", 55 Main .main.undoRedo.redoCommands.getFirst().getDescriptionText()));55 MainApplication.undoRedo.redoCommands.getFirst().getDescriptionText())); 56 56 } 57 57 } -
trunk/src/org/openstreetmap/josm/actions/ReverseWayAction.java
r12620 r12641 26 26 import org.openstreetmap.josm.data.osm.OsmPrimitive; 27 27 import org.openstreetmap.josm.data.osm.Way; 28 import org.openstreetmap.josm.gui.MainApplication; 28 29 import org.openstreetmap.josm.gui.Notification; 29 30 import org.openstreetmap.josm.tools.Logging; … … 137 138 c.addAll(revResult.getCommands()); 138 139 } 139 Main .main.undoRedo.add(new SequenceCommand(tr("Reverse ways"), c));140 MainApplication.undoRedo.add(new SequenceCommand(tr("Reverse ways"), c)); 140 141 } 141 142 -
trunk/src/org/openstreetmap/josm/actions/SimplifyWayAction.java
r12527 r12641 32 32 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 33 33 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec; 34 import org.openstreetmap.josm.gui.MainApplication; 34 35 import org.openstreetmap.josm.gui.Notification; 35 36 import org.openstreetmap.josm.tools.ImageProvider; … … 123 124 allCommands 124 125 ); 125 Main .main.undoRedo.add(rootCommand);126 MainApplication.undoRedo.add(rootCommand); 126 127 } finally { 127 128 ds.endUpdate(); -
trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java
r12636 r12641 215 215 if (wayToKeep != null) { 216 216 final SplitWayResult result = doSplitWay(getLayerManager().getEditLayer(), selectedWay, wayToKeep, newWays, sel); 217 Main .main.undoRedo.add(result.getCommand());217 MainApplication.undoRedo.add(result.getCommand()); 218 218 if (!result.getNewSelection().isEmpty()) { 219 219 getLayerManager().getEditDataSet().setSelected(result.getNewSelection()); … … 296 296 SplitWayResult result = doSplitWay(MainApplication.getLayerManager().getEditLayer(), 297 297 selectedWay, list.getSelectedValue(), newWays, selection); 298 Main .main.undoRedo.add(result.getCommand());298 MainApplication.undoRedo.add(result.getCommand()); 299 299 if (!result.getNewSelection().isEmpty()) { 300 300 MainApplication.getLayerManager().getEditDataSet().setSelected(result.getNewSelection()); -
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r12630 r12641 314 314 } 315 315 316 Main .main.undoRedo.add(new SequenceCommand(tr("Unglued Node"), cmds));316 MainApplication.undoRedo.add(new SequenceCommand(tr("Unglued Node"), cmds)); 317 317 getLayerManager().getEditDataSet().setSelected(n); 318 318 mv.repaint(); … … 553 553 */ 554 554 private void execCommands(List<Command> cmds, List<Node> newNodes) { 555 Main .main.undoRedo.add(new SequenceCommand(/* for correct i18n of plural forms - see #9110 */555 MainApplication.undoRedo.add(new SequenceCommand(/* for correct i18n of plural forms - see #9110 */ 556 556 trn("Dupe into {0} node", "Dupe into {0} nodes", newNodes.size() + 1L, newNodes.size() + 1L), cmds)); 557 557 // select one of the new nodes … … 641 641 notifyWayPartOfRelation(Collections.singleton(selectedWay)); 642 642 643 Main .main.undoRedo.add(new SequenceCommand(643 MainApplication.undoRedo.add(new SequenceCommand( 644 644 trn("Dupe {0} node into {1} nodes", "Dupe {0} nodes into {1} nodes", 645 645 selectedNodes.size(), selectedNodes.size(), selectedNodes.size()+allNewNodes.size()), cmds)); -
trunk/src/org/openstreetmap/josm/actions/UnJoinNodeWayAction.java
r12031 r12641 15 15 import javax.swing.JOptionPane; 16 16 17 import org.openstreetmap.josm.Main;18 17 import org.openstreetmap.josm.command.RemoveNodesCommand; 19 18 import org.openstreetmap.josm.data.osm.Node; 20 19 import org.openstreetmap.josm.data.osm.OsmPrimitive; 21 20 import org.openstreetmap.josm.data.osm.Way; 21 import org.openstreetmap.josm.gui.MainApplication; 22 22 import org.openstreetmap.josm.gui.Notification; 23 23 import org.openstreetmap.josm.tools.Shortcut; … … 89 89 90 90 // I'm sure there's a better way to handle this 91 Main .main.undoRedo.add(new RemoveNodesCommand(selectedWay, selectedNodes));91 MainApplication.undoRedo.add(new RemoveNodesCommand(selectedWay, selectedNodes)); 92 92 } 93 93 -
trunk/src/org/openstreetmap/josm/actions/UndoAction.java
r12630 r12641 37 37 return; 38 38 map.repaint(); 39 Main .main.undoRedo.undo();39 MainApplication.undoRedo.undo(); 40 40 } 41 41 42 42 @Override 43 43 protected void updateEnabledState() { 44 setEnabled(Main.main != null && !Main .main.undoRedo.commands.isEmpty());44 setEnabled(Main.main != null && !MainApplication.undoRedo.commands.isEmpty()); 45 45 } 46 46 47 47 @Override 48 48 public void commandChanged(int queueSize, int redoSize) { 49 if (Main .main.undoRedo.commands.isEmpty()) {49 if (MainApplication.undoRedo.commands.isEmpty()) { 50 50 putValue(NAME, tr("Undo")); 51 51 setTooltip(tr("Undo the last action.")); … … 53 53 putValue(NAME, tr("Undo ...")); 54 54 setTooltip(tr("Undo {0}", 55 Main .main.undoRedo.commands.getLast().getDescriptionText()));55 MainApplication.undoRedo.commands.getLast().getDescriptionText())); 56 56 } 57 57 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java
r12636 r12641 157 157 // if c is null, an error occurred or the user aborted. Don't do anything in that case. 158 158 if (c != null) { 159 Main .main.undoRedo.add(c);159 MainApplication.undoRedo.add(c); 160 160 //FIXME: This should not be required, DeleteCommand should update the selection, otherwise undo/redo won't work. 161 161 lm.getEditDataSet().setSelected(); … … 304 304 Command c = buildDeleteCommands(e, e.getModifiersEx(), false); 305 305 if (c != null) { 306 Main .main.undoRedo.add(c);306 MainApplication.undoRedo.add(c); 307 307 } 308 308 … … 355 355 if (cmd != null) { 356 356 // cmd can be null if the user cancels dialogs DialogCommand displays 357 Main .main.undoRedo.add(cmd);357 MainApplication.undoRedo.add(cmd); 358 358 for (Relation relation : toDelete) { 359 359 if (layer.data.getSelectedRelations().contains(relation)) { -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r12639 r12641 617 617 Command c = new SequenceCommand(title, cmds); 618 618 619 Main .main.undoRedo.add(c);619 MainApplication.undoRedo.add(c); 620 620 if (!wayIsFinished) { 621 621 lastUsedNode = n; … … 1334 1334 @Override 1335 1335 public void actionPerformed(ActionEvent e) { 1336 Main .main.undoRedo.undo();1337 Command lastCmd = Main .main.undoRedo.getLastCommand();1336 MainApplication.undoRedo.undo(); 1337 Command lastCmd = MainApplication.undoRedo.getLastCommand(); 1338 1338 if (lastCmd == null) return; 1339 1339 Node n = null; -
trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java
r12636 r12641 496 496 moveCommand2 = new MoveCommand(movingNodeList.get(1), movement2.getX(), movement2.getY()); 497 497 Command c = new SequenceCommand(tr("Extrude Way"), moveCommand, moveCommand2); 498 Main .main.undoRedo.add(c);498 MainApplication.undoRedo.add(c); 499 499 } else { 500 500 // reuse existing move commands … … 511 511 //make a new move command 512 512 moveCommand = new MoveCommand(new ArrayList<OsmPrimitive>(movingNodeList), bestMovement); 513 Main .main.undoRedo.add(moveCommand);513 MainApplication.undoRedo.add(moveCommand); 514 514 } else { 515 515 //reuse existing move command … … 594 594 SequenceCommand cmds = new SequenceCommand(tr("Add a new node to an existing way"), 595 595 new AddCommand(n), new ChangeCommand(ws.way, wnew)); 596 Main .main.undoRedo.add(cmds);596 MainApplication.undoRedo.add(cmds); 597 597 } 598 598 } … … 624 624 cmds.add(new AddCommand(wnew)); 625 625 Command c = new SequenceCommand(tr("Extrude Way"), cmds); 626 Main .main.undoRedo.add(c);626 MainApplication.undoRedo.add(c); 627 627 getLayerManager().getEditDataSet().setSelected(wnew); 628 628 } … … 712 712 } 713 713 Command c = new SequenceCommand(tr("Extrude Way"), cmds); 714 Main .main.undoRedo.add(c);714 MainApplication.undoRedo.add(c); 715 715 joinNodesIfCollapsed(changedNodes); 716 716 } … … 724 724 Command mergeCmd = MergeNodesAction.mergeNodes(MainApplication.getLayerManager().getEditLayer(), changedNodes, targetNode, locNode); 725 725 if (mergeCmd != null) { 726 Main .main.undoRedo.add(mergeCmd);726 MainApplication.undoRedo.add(mergeCmd); 727 727 } else { 728 728 // undo extruding command itself 729 Main .main.undoRedo.undo();729 MainApplication.undoRedo.undo(); 730 730 } 731 731 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java
r12630 r12641 473 473 virtualSegments.size(), virtualSegments.size()); 474 474 475 Main .main.undoRedo.add(new SequenceCommand(text, virtualCmds));475 MainApplication.undoRedo.add(new SequenceCommand(text, virtualCmds)); 476 476 477 477 } else if (alt && !ctrl && candidateNode != null) { … … 490 490 final Command deleteCmd = DeleteCommand.delete(getLayerManager().getEditLayer(), Collections.singleton(targetWay), true); 491 491 if (deleteCmd != null) { 492 Main .main.undoRedo.add(deleteCmd);492 MainApplication.undoRedo.add(deleteCmd); 493 493 } 494 494 } else { 495 Main .main.undoRedo.add(new ChangeCommand(targetWay, newWay));495 MainApplication.undoRedo.add(new ChangeCommand(targetWay, newWay)); 496 496 } 497 497 } else if (candidateNode.isTagged()) { … … 502 502 final Command deleteCmd = DeleteCommand.delete(getLayerManager().getEditLayer(), Collections.singleton(candidateNode), true); 503 503 if (deleteCmd != null) { 504 Main .main.undoRedo.add(deleteCmd);504 MainApplication.undoRedo.add(deleteCmd); 505 505 } 506 506 } … … 512 512 EastNorth cursorEN = mv.getEastNorth(mousePos.x, mousePos.y); 513 513 514 Main .main.undoRedo.add(new MoveCommand(candidateNode, cursorEN.east() - nodeEN.east(), cursorEN.north() - nodeEN.north()));514 MainApplication.undoRedo.add(new MoveCommand(candidateNode, cursorEN.east() - nodeEN.east(), cursorEN.north() - nodeEN.north())); 515 515 } 516 516 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWays.java
r12463 r12641 11 11 import java.util.Set; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.command.AddCommand; 15 14 import org.openstreetmap.josm.command.Command; … … 19 18 import org.openstreetmap.josm.data.osm.NodeGraph; 20 19 import org.openstreetmap.josm.data.osm.Way; 20 import org.openstreetmap.josm.gui.MainApplication; 21 21 import org.openstreetmap.josm.tools.Geometry; 22 22 … … 182 182 */ 183 183 public void commit() { 184 Main .main.undoRedo.add(new SequenceCommand("Make parallel way(s)", makeAddWayAndNodesCommandList()));184 MainApplication.undoRedo.add(new SequenceCommand("Make parallel way(s)", makeAddWayAndNodesCommandList())); 185 185 } 186 186 -
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r12636 r12641 711 711 } else { 712 712 c = new MoveCommand(selection, startEN, currentEN); 713 Main .main.undoRedo.add(c);713 MainApplication.undoRedo.add(c); 714 714 } 715 715 for (Node n : affectedNodes) { … … 744 744 ((RotateCommand) c).handleEvent(currentEN); 745 745 } else { 746 Main .main.undoRedo.add(new RotateCommand(selection, currentEN));746 MainApplication.undoRedo.add(new RotateCommand(selection, currentEN)); 747 747 } 748 748 } else if (mode == Mode.SCALE) { … … 750 750 ((ScaleCommand) c).handleEvent(currentEN); 751 751 } else { 752 Main .main.undoRedo.add(new ScaleCommand(selection, currentEN));752 MainApplication.undoRedo.add(new ScaleCommand(selection, currentEN)); 753 753 } 754 754 } … … 799 799 */ 800 800 private static Command getLastCommandInDataset(DataSet ds) { 801 Command lastCommand = Main .main.undoRedo.getLastCommand();801 Command lastCommand = MainApplication.undoRedo.getLastCommand(); 802 802 if (lastCommand instanceof SequenceCommand) { 803 803 lastCommand = ((SequenceCommand) lastCommand).getLastCommand(); … … 825 825 ed.showDialog(); 826 826 if (ed.getValue() != 1) { 827 Main .main.undoRedo.undo();827 MainApplication.undoRedo.undo(); 828 828 } 829 829 } … … 848 848 849 849 if (ed.getValue() != 1) { 850 Main .main.undoRedo.undo();850 MainApplication.undoRedo.undo(); 851 851 } 852 852 } else { … … 1247 1247 "Add and move a virtual new node to {0} ways", virtualWays.size(), 1248 1248 virtualWays.size()); 1249 Main .main.undoRedo.add(new SequenceCommand(text, virtualCmds));1249 MainApplication.undoRedo.add(new SequenceCommand(text, virtualCmds)); 1250 1250 getLayerManager().getEditDataSet().setSelected(Collections.singleton((OsmPrimitive) virtualNode)); 1251 1251 clear(); -
trunk/src/org/openstreetmap/josm/actions/relation/AddSelectionToRelations.java
r12636 r12641 11 11 import javax.swing.JOptionPane; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.command.Command; 15 14 import org.openstreetmap.josm.command.SequenceCommand; … … 46 45 } 47 46 if (!cmds.isEmpty()) { 48 Main .main.undoRedo.add(new SequenceCommand(tr("Add selection to relation"), cmds));47 MainApplication.undoRedo.add(new SequenceCommand(tr("Add selection to relation"), cmds)); 49 48 new Notification( 50 49 "<html>"+ -
trunk/src/org/openstreetmap/josm/actions/relation/RecentRelationsAction.java
r12639 r12641 18 18 import javax.swing.plaf.basic.BasicArrowButton; 19 19 20 import org.openstreetmap.josm.Main;21 20 import org.openstreetmap.josm.actions.JosmAction; 22 21 import org.openstreetmap.josm.data.osm.Relation; … … 50 49 arrow = editButton.createArrow(this); 51 50 arrow.setToolTipText(tr("List of recent relations")); 52 Main .main.undoRedo.addCommandQueueListener(this);51 MainApplication.undoRedo.addCommandQueueListener(this); 53 52 enableArrow(); 54 53 shortcut = Shortcut.registerShortcut( -
trunk/src/org/openstreetmap/josm/actions/upload/DiscardTagsHook.java
r8338 r12641 10 10 import java.util.Map; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.command.ChangePropertyCommand; 14 13 import org.openstreetmap.josm.command.SequenceCommand; 15 14 import org.openstreetmap.josm.data.APIDataSet; 16 15 import org.openstreetmap.josm.data.osm.OsmPrimitive; 16 import org.openstreetmap.josm.gui.MainApplication; 17 17 18 18 /** … … 44 44 SequenceCommand removeKeys = new SequenceCommand(tr("Removed obsolete tags"), 45 45 new ChangePropertyCommand(objectsToUpload, map)); 46 Main .main.undoRedo.add(removeKeys);46 MainApplication.undoRedo.add(removeKeys); 47 47 } 48 48 return true; -
trunk/src/org/openstreetmap/josm/actions/upload/FixDataHook.java
r12288 r12641 20 20 import org.openstreetmap.josm.data.osm.Relation; 21 21 import org.openstreetmap.josm.data.osm.Tag; 22 import org.openstreetmap.josm.gui.MainApplication; 22 23 23 24 /** … … 204 205 205 206 if (!cmds.isEmpty()) { 206 Main .main.undoRedo.add(new SequenceCommand(tr("Fix deprecated tags"), cmds));207 MainApplication.undoRedo.add(new SequenceCommand(tr("Fix deprecated tags"), cmds)); 207 208 } 208 209 } -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r12639 r12641 69 69 import org.openstreetmap.josm.actions.search.SearchAction; 70 70 import org.openstreetmap.josm.data.Bounds; 71 import org.openstreetmap.josm.data.UndoRedoHandler; 71 72 import org.openstreetmap.josm.data.Version; 72 73 import org.openstreetmap.josm.data.osm.DataSet; … … 164 165 165 166 /** 167 * The commands undo/redo handler. 168 * @since 12641 (as a replacement to {@code Main.main.undoRedo}) 169 */ 170 public static final UndoRedoHandler undoRedo = new UndoRedoHandler(); 171 172 /** 166 173 * Provides access to the layers displayed in the main view. 167 174 */ -
trunk/src/org/openstreetmap/josm/gui/MainMenu.java
r12636 r12641 678 678 679 679 add(editMenu, undo); 680 Main .main.undoRedo.addCommandQueueListener(undo);680 MainApplication.undoRedo.addCommandQueueListener(undo); 681 681 add(editMenu, redo); 682 Main .main.undoRedo.addCommandQueueListener(redo);682 MainApplication.undoRedo.addCommandQueueListener(redo); 683 683 editMenu.addSeparator(); 684 684 add(editMenu, copy); -
trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/AbstractTagPaster.java
r10737 r12641 14 14 import javax.swing.TransferHandler.TransferSupport; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.command.ChangePropertyCommand; 18 17 import org.openstreetmap.josm.command.Command; … … 20 19 import org.openstreetmap.josm.data.coor.EastNorth; 21 20 import org.openstreetmap.josm.data.osm.OsmPrimitive; 21 import org.openstreetmap.josm.gui.MainApplication; 22 22 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 23 23 import org.openstreetmap.josm.tools.I18n; … … 65 65 @I18n.QuirkyPluralString 66 66 final String title = title1 + ' ' + title2; 67 Main .main.undoRedo.add(new SequenceCommand(title, commands));67 MainApplication.undoRedo.add(new SequenceCommand(title, commands)); 68 68 } 69 69 } -
trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/PrimitiveDataPaster.java
r12279 r12641 24 24 import org.openstreetmap.josm.data.osm.WayData; 25 25 import org.openstreetmap.josm.gui.ExtendedDialog; 26 import org.openstreetmap.josm.gui.MainApplication; 26 27 import org.openstreetmap.josm.gui.datatransfer.data.PrimitiveTransferData; 27 28 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 57 58 58 59 /* Now execute the commands to add the duplicated contents of the paste buffer to the map */ 59 Main .main.undoRedo.add(command);60 MainApplication.undoRedo.add(command); 60 61 return true; 61 62 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
r12636 r12641 36 36 import javax.swing.tree.TreeSelectionModel; 37 37 38 import org.openstreetmap.josm.Main;39 38 import org.openstreetmap.josm.actions.AutoScaleAction; 40 39 import org.openstreetmap.josm.command.Command; … … 233 232 listener.updateEnabledState(); 234 233 } 235 Main .main.undoRedo.addCommandQueueListener(this);234 MainApplication.undoRedo.addCommandQueueListener(this); 236 235 } 237 236 … … 249 248 undoTreeModel.setRoot(new DefaultMutableTreeNode()); 250 249 redoTreeModel.setRoot(new DefaultMutableTreeNode()); 251 Main .main.undoRedo.removeCommandQueueListener(this);250 MainApplication.undoRedo.removeCommandQueueListener(this); 252 251 } 253 252 … … 261 260 return; 262 261 263 List<Command> undoCommands = Main .main.undoRedo.commands;262 List<Command> undoCommands = MainApplication.undoRedo.commands; 264 263 DefaultMutableTreeNode undoRoot = new DefaultMutableTreeNode(); 265 264 for (int i = 0; i < undoCommands.size(); ++i) { … … 268 267 undoTreeModel.setRoot(undoRoot); 269 268 270 List<Command> redoCommands = Main .main.undoRedo.redoCommands;269 List<Command> redoCommands = MainApplication.undoRedo.redoCommands; 271 270 DefaultMutableTreeNode redoRoot = new DefaultMutableTreeNode(); 272 271 for (int i = 0; i < redoCommands.size(); ++i) { … … 457 456 case UNDO: 458 457 int numUndo = ((DefaultMutableTreeNode) undoTreeModel.getRoot()).getChildCount() - idx; 459 Main .main.undoRedo.undo(numUndo);458 MainApplication.undoRedo.undo(numUndo); 460 459 break; 461 460 case REDO: 462 461 int numRedo = idx+1; 463 Main .main.undoRedo.redo(numRedo);462 MainApplication.undoRedo.redo(numRedo); 464 463 break; 465 464 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
r12636 r12641 520 520 } 521 521 } 522 Main .main.undoRedo.add(new SequenceCommand(name, commands));522 MainApplication.undoRedo.add(new SequenceCommand(name, commands)); 523 523 refreshView(); 524 524 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictResolutionDialog.java
r12279 r12641 21 21 import org.openstreetmap.josm.gui.DefaultNameFormatter; 22 22 import org.openstreetmap.josm.gui.ExtendedDialog; 23 import org.openstreetmap.josm.gui.MainApplication; 23 24 import org.openstreetmap.josm.gui.conflict.pair.ConflictResolver; 24 25 import org.openstreetmap.josm.gui.help.HelpBrowser; … … 203 204 } 204 205 } 205 Main .main.undoRedo.add(resolver.buildResolveCommand());206 MainApplication.undoRedo.add(resolver.buildResolveCommand()); 206 207 buttonAction(1, evt); 207 208 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java
r12636 r12641 613 613 final Command fixCommand = error.getFix(); 614 614 if (fixCommand != null) { 615 SwingUtilities.invokeAndWait(() -> Main .main.undoRedo.addNoRedraw(fixCommand));615 SwingUtilities.invokeAndWait(() -> MainApplication.undoRedo.addNoRedraw(fixCommand)); 616 616 } 617 617 // It is wanted to ignore an error if it said fixable, even if fixCommand was null … … 644 644 monitor.subTask(tr("Updating map ...")); 645 645 SwingUtilities.invokeAndWait(() -> { 646 Main .main.undoRedo.afterAdd();646 MainApplication.undoRedo.afterAdd(); 647 647 MainApplication.getLayerManager().getLayersOfType(ValidatorLayer.class).forEach(ValidatorLayer::invalidate); 648 648 tree.resetErrors(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r12639 r12641 830 830 Command command = TaggingPreset.createCommand(getSelection(), tags); 831 831 if (command != null) { 832 Main .main.undoRedo.add(command);832 MainApplication.undoRedo.add(command); 833 833 } 834 834 } … … 997 997 998 998 Collection<OsmPrimitive> sel = Main.main.getInProgressSelection(); 999 Main .main.undoRedo.add(new ChangePropertyCommand(sel, tags));999 MainApplication.undoRedo.add(new ChangePropertyCommand(sel, tags)); 1000 1000 1001 1001 membershipTable.clearSelection(); … … 1028 1028 rel.removeMembersFor(primitive); 1029 1029 } 1030 Main .main.undoRedo.add(new ChangeCommand(cur, rel));1030 MainApplication.undoRedo.add(new ChangeCommand(cur, rel)); 1031 1031 1032 1032 tagTable.clearSelection(); … … 1266 1266 if (sel.isEmpty() || clipboard == null) 1267 1267 return; 1268 Main .main.undoRedo.add(new ChangePropertyCommand(sel, key, Utils.strip(clipboard)));1268 MainApplication.undoRedo.add(new ChangePropertyCommand(sel, key, Utils.strip(clipboard))); 1269 1269 } 1270 1270 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
r12636 r12641 507 507 return; 508 508 if (key.equals(newkey) || value == null) { 509 Main .main.undoRedo.add(new ChangePropertyCommand(sel, newkey, value));509 MainApplication.undoRedo.add(new ChangePropertyCommand(sel, newkey, value)); 510 510 AutoCompletionManager.rememberUserInput(newkey, value, true); 511 511 } else { … … 541 541 AutoCompletionManager.rememberUserInput(newkey, value, false); 542 542 } 543 Main .main.undoRedo.add(new SequenceCommand(543 MainApplication.undoRedo.add(new SequenceCommand( 544 544 trn("Change properties of up to {0} object", 545 545 "Change properties of up to {0} objects", sel.size(), sel.size()), … … 1068 1068 AutoCompletionManager.rememberUserInput(key, value, false); 1069 1069 commandCount++; 1070 Main .main.undoRedo.add(new ChangePropertyCommand(sel, key, value));1070 MainApplication.undoRedo.add(new ChangePropertyCommand(sel, key, value)); 1071 1071 changedKey = key; 1072 1072 clearEntries(); … … 1079 1079 1080 1080 public void undoAllTagsAdding() { 1081 Main .main.undoRedo.undo(commandCount);1081 MainApplication.undoRedo.undo(commandCount); 1082 1082 } 1083 1083 -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/RefreshAction.java
r9661 r12641 14 14 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 15 15 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec; 16 import org.openstreetmap.josm.gui.MainApplication; 16 17 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor; 17 18 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable; … … 50 51 ((JComponent) editor).getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(sc.getKeyStroke(), "refresh"); 51 52 } 52 Main .main.undoRedo.addCommandQueueListener(this);53 MainApplication.undoRedo.addCommandQueueListener(this); 53 54 updateEnabledState(); 54 55 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SavingAction.java
r12630 r12641 73 73 if (newRelation.getMembersCount() == 0 && !newRelation.hasKeys()) 74 74 return; 75 Main .main.undoRedo.add(new AddCommand(layer, newRelation));75 MainApplication.undoRedo.add(new AddCommand(layer, newRelation)); 76 76 77 77 // make sure everybody is notified about the changes … … 95 95 memberTableModel.applyToRelation(editedRelation); 96 96 Conflict<Relation> conflict = new Conflict<>(editor.getRelation(), editedRelation); 97 Main .main.undoRedo.add(new ConflictAddCommand(layer, conflict));97 MainApplication.undoRedo.add(new ConflictAddCommand(layer, conflict)); 98 98 } 99 99 … … 107 107 memberTableModel.applyToRelation(editedRelation); 108 108 if (!editedRelation.hasEqualSemanticAttributes(editor.getRelation(), false)) { 109 Main .main.undoRedo.add(new ChangeCommand(editor.getRelation(), editedRelation));109 MainApplication.undoRedo.add(new ChangeCommand(editor.getRelation(), editedRelation)); 110 110 } 111 111 } -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r12636 r12641 609 609 return; 610 610 611 Main .main.undoRedo.clean(this);611 MainApplication.undoRedo.clean(this); 612 612 613 613 // if uploaded, clean the modified flags as well -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java
r12637 r12641 398 398 Command cmd = createCommand(sel, getChangedTags()); 399 399 if (cmd != null) { 400 Main .main.undoRedo.add(cmd);400 MainApplication.undoRedo.add(cmd); 401 401 } 402 402 } else if (answer == DIALOG_ANSWER_NEW_RELATION) { -
trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java
r12636 r12641 258 258 String key = (String) tm.getValueAt(i, 1); 259 259 Object value = tm.getValueAt(i, 2); 260 Main .main.undoRedo.add(new ChangePropertyCommand(sel,260 MainApplication.undoRedo.add(new ChangePropertyCommand(sel, 261 261 key, value instanceof String ? (String) value : "")); 262 262 } … … 312 312 if (MainApplication.getLayerManager().getEditDataSet() != null) { 313 313 for (String[] row : keyValue) { 314 Main .main.undoRedo.add(new ChangePropertyCommand(primitives, row[0], row[1]));314 MainApplication.undoRedo.add(new ChangePropertyCommand(primitives, row[0], row[1])); 315 315 } 316 316 } -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java
r12636 r12641 99 99 node = new Node(ll); 100 100 // Now execute the commands to add this node. 101 Main .main.undoRedo.add(new AddCommand(node));101 MainApplication.undoRedo.add(new AddCommand(node)); 102 102 } 103 103 -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java
r12636 r12641 167 167 allCoordinates.clear(); 168 168 commands.add(new AddCommand(way)); 169 Main .main.undoRedo.add(new SequenceCommand(tr("Add way"), commands));169 MainApplication.undoRedo.add(new SequenceCommand(tr("Add way"), commands)); 170 170 MainApplication.getLayerManager().getEditDataSet().setSelected(way); 171 171 if (PermissionPrefWithDefault.CHANGE_VIEWPORT.isAllowed()) {
Note:
See TracChangeset
for help on using the changeset viewer.