Index: trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java	(revision 5726)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java	(revision 5727)
@@ -38,4 +38,5 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.actions.AutoScaleAction;
 import org.openstreetmap.josm.command.Command;
 import org.openstreetmap.josm.command.PseudoCommand;
@@ -73,4 +74,8 @@
     private UndoRedoType lastOperation = UndoRedoType.UNDO;
 
+    // Actions for context menu and Enter key
+    private SelectAction selectAction = new SelectAction();
+    private SelectAndZoomAction selectAndZoomAction = new SelectAndZoomAction();
+    
     public CommandStackDialog(final MapFrame mapFrame) {
         super(tr("Command Stack"), "commandstack", tr("Open a list of all commands (undo buffer)."),
@@ -107,5 +112,4 @@
         treesPanel.setBackground(redoTree.getBackground());
 
-        SelectAction selectAction = new SelectAction();
         wireUpdateEnabledStateUpdater(selectAction, undoTree);
         wireUpdateEnabledStateUpdater(selectAction, redoTree);
@@ -123,6 +127,6 @@
         }));
         
-        InputMapUtils.addEnterAction(undoTree, selectAction);
-        InputMapUtils.addEnterAction(redoTree, selectAction);
+        InputMapUtils.addEnterAction(undoTree, selectAndZoomAction);
+        InputMapUtils.addEnterAction(redoTree, selectAndZoomAction);
     }
 
@@ -301,4 +305,24 @@
         return node;
     }
+    
+    /**
+     * Return primitives that are affected by some command
+     * @param path GUI elements 
+     * @return collection of affected primitives, onluy usable ones 
+     */
+    protected static FilteredCollection<OsmPrimitive> getAffectedPrimitives(TreePath path) {
+        PseudoCommand c = ((CommandListMutableTreeNode) path.getLastPathComponent()).getCommand();
+        final OsmDataLayer currentLayer = Main.map.mapView.getEditLayer();
+        FilteredCollection<OsmPrimitive> prims = new FilteredCollection<OsmPrimitive>(
+                c.getParticipatingPrimitives(),
+                new Predicate<OsmPrimitive>(){
+                    public boolean evaluate(OsmPrimitive o) {
+                        OsmPrimitive p = currentLayer.data.getPrimitiveById(o);
+                        return p != null && p.isUsable();
+                    }
+                }
+        );
+        return prims;
+    }
 
     public void commandChanged(int queueSize, int redoSize) {
@@ -318,4 +342,5 @@
         }
 
+        @Override
         public void actionPerformed(ActionEvent e) {
             TreePath path;
@@ -329,20 +354,8 @@
 
             if (Main.map == null || Main.map.mapView == null || Main.map.mapView.getEditLayer() == null) return;
-            PseudoCommand c = ((CommandListMutableTreeNode) path.getLastPathComponent()).getCommand();
-
-            final OsmDataLayer currentLayer = Main.map.mapView.getEditLayer();
-
-            FilteredCollection<OsmPrimitive> prims = new FilteredCollection<OsmPrimitive>(
-                    c.getParticipatingPrimitives(),
-                    new Predicate<OsmPrimitive>(){
-                        public boolean evaluate(OsmPrimitive o) {
-                            OsmPrimitive p = currentLayer.data.getPrimitiveById(o);
-                            return p != null && p.isUsable();
-                        }
-                    }
-            );
-            Main.map.mapView.getEditLayer().data.setSelected(prims);
-        }
-
+            Main.map.mapView.getEditLayer().data.setSelected( getAffectedPrimitives(path));
+        }
+        
+        @Override
         public void updateEnabledState() {
             setEnabled(!undoTree.isSelectionEmpty() || !redoTree.isSelectionEmpty());
@@ -351,4 +364,20 @@
     }
 
+    public class SelectAndZoomAction extends SelectAction {
+        public SelectAndZoomAction() {
+            super();
+            putValue(NAME,tr("Select and zoom"));
+            putValue(SHORT_DESCRIPTION, tr("Selects the objects that take part in this command (unless currently deleted), then and zooms to it"));
+            putValue(SMALL_ICON, ImageProvider.get("dialogs/autoscale","selection"));
+        }
+
+        @Override
+        public void actionPerformed(ActionEvent e) {
+            super.actionPerformed(e);
+            if (Main.map == null || Main.map.mapView == null || Main.map.mapView.getEditLayer() == null) return;
+            AutoScaleAction.autoScale("selection");
+        }
+    }
+    
     /**
      * undo / redo switch to reduce duplicate code
@@ -417,4 +446,13 @@
 
     class PopupMenuHandler extends PopupMenuLauncher {
+        
+        @Override
+        public void mouseClicked(MouseEvent evt) {
+            super.mouseClicked(evt);
+            if (evt.getButton() == MouseEvent.BUTTON1 && evt.getClickCount()>1) {
+                selectAndZoomAction.actionPerformed(null);
+            }
+        }
+        
         @Override
         public void launch(MouseEvent evt) {
@@ -430,5 +468,5 @@
                 TreePath[] selPaths = tree.getSelectionPaths();
 
-                CommandStackPopup menu = new CommandStackPopup(selPaths);
+                CommandStackPopup menu = new CommandStackPopup();
                 menu.show(tree, p.x, p.y-3);
             }
@@ -436,9 +474,9 @@
     }
 
+    
     private class CommandStackPopup extends JPopupMenu {
-        private TreePath[] sel;
-        public CommandStackPopup(TreePath[] sel){
-            this.sel = sel;
-            add(new SelectAction());
+        public CommandStackPopup(){
+            add(selectAction);
+            add(selectAndZoomAction);
         }
     }
