Ignore:
Timestamp:
2007-08-08T14:56:38+02:00 (17 years ago)
Author:
imi
Message:
  • fixed undo/redo to be global
  • fixed adding of objects work with undo/redo (#212)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java

    r298 r301  
    1919import org.openstreetmap.josm.command.Command;
    2020import org.openstreetmap.josm.gui.MapFrame;
    21 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    22 import org.openstreetmap.josm.gui.layer.Layer;
    23 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2421import org.openstreetmap.josm.gui.layer.OsmDataLayer.CommandQueueListener;
    2522
     
    3128        public CommandStackDialog(final MapFrame mapFrame) {
    3229                super(tr("Command Stack"), "commandstack", tr("Open a list of all commands (undo buffer)."), KeyEvent.VK_O, 100);
    33                 mapFrame.mapView.addLayerChangeListener(new LayerChangeListener(){
    34                         public void activeLayerChange(Layer oldLayer, Layer newLayer) {}
    35                         public void layerAdded(Layer newLayer) {
    36                                 if (newLayer instanceof OsmDataLayer)
    37                                         Main.main.editLayer().listenerCommands.add(CommandStackDialog.this);
    38                         }
    39                         public void layerRemoved(Layer oldLayer) {
    40                                 if (oldLayer instanceof OsmDataLayer)
    41                                         Main.main.editLayer().listenerCommands.remove(CommandStackDialog.this);
    42                         }
    43                 });
    44                 if (mapFrame.mapView.editLayer != null)
    45                         mapFrame.mapView.editLayer.listenerCommands.add(this);
     30                Main.main.undoRedo.listenerCommands.add(this);
    4631                       
    4732                tree.setRootVisible(false);
     
    7560                if (Main.map == null || Main.map.mapView == null || Main.map.mapView.editLayer == null)
    7661                        return;
    77                 Collection<Command> commands = Main.main.editLayer().commands;
     62                Collection<Command> commands = Main.main.undoRedo.commands;
    7863                DefaultMutableTreeNode root = new DefaultMutableTreeNode();
    7964                for (Command c : commands)
Note: See TracChangeset for help on using the changeset viewer.