Index: src/org/openstreetmap/josm/actions/CopyAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/CopyAction.java	(revision 1348)
+++ src/org/openstreetmap/josm/actions/CopyAction.java	(working copy)
@@ -43,18 +43,24 @@
     }
 
     public void actionPerformed(ActionEvent e) {
-        Collection<OsmPrimitive> sel = Main.ds.getSelected();
-        if (sel.isEmpty()) {
-            JOptionPane.showMessageDialog(Main.parent,
-                    tr("Please select something to copy."));
-            return;
+        if(noSelection()) return;
+        
+        Main.pasteBuffer = copyData();
+        Main.main.menu.paste.setEnabled(true); /* now we have a paste buffer we can make paste available */
+
+        for(JosmAction a : listeners) {
+            a.pasteBufferChanged(Main.pasteBuffer);
         }
-
+    }
+    
+    public static DataSet copyData() {
         /* New pasteBuffer - will be assigned to the global one at the end */
         final DataSet pasteBuffer = new DataSet();
         final HashMap<OsmPrimitive,OsmPrimitive> map = new HashMap<OsmPrimitive,OsmPrimitive>();
         /* temporarily maps old nodes to new so we can do a true deep copy */
-
+        
+        if(noSelection()) return pasteBuffer;
+        
         /* scan the selected objects, mapping them to copies; when copying a way or relation,
          * the copy references the copies of their child objects */
         new Visitor(){
@@ -104,16 +110,21 @@
                     osm.visit(this);
             }
         }.visitAll();
-
-        Main.pasteBuffer = pasteBuffer;
-        Main.main.menu.paste.setEnabled(true); /* now we have a paste buffer we can make paste available */
-
-        for(JosmAction a : listeners) {
-            a.pasteBufferChanged(Main.pasteBuffer);
-        }
+        
+        return pasteBuffer;
     }
 
     public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
         setEnabled(! newSelection.isEmpty());
     }
+    
+    private static boolean noSelection() {
+        Collection<OsmPrimitive> sel = Main.ds.getSelected();
+        if (sel.isEmpty()) {
+            JOptionPane.showMessageDialog(Main.parent,
+                    tr("Please select something to copy."));
+            return true;
+        }
+        return false;
+    }
 }
Index: src/org/openstreetmap/josm/actions/DuplicateAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/DuplicateAction.java	(revision 1348)
+++ src/org/openstreetmap/josm/actions/DuplicateAction.java	(working copy)
@@ -21,12 +21,11 @@
             tr("Duplicate selection by copy and immediate paste."),
             Shortcut.registerShortcut("system:duplicate", tr("Edit: {0}", tr("Duplicate")), KeyEvent.VK_D, Shortcut.GROUP_MENU), true);
         setEnabled(false);
-            DataSet.selListeners.add(this);
+        DataSet.selListeners.add(this);
     }
 
     public void actionPerformed(ActionEvent e) {
-        Main.main.menu.copy.actionPerformed(e);
-        Main.main.menu.paste.actionPerformed(e);
+        org.openstreetmap.josm.actions.PasteAction.pasteData(org.openstreetmap.josm.actions.CopyAction.copyData(), e);
     }
 
     public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
Index: src/org/openstreetmap/josm/actions/PasteAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/PasteAction.java	(revision 1348)
+++ src/org/openstreetmap/josm/actions/PasteAction.java	(working copy)
@@ -30,12 +30,14 @@
     public PasteAction() {
         super(tr("Paste"), "paste", tr("Paste contents of paste buffer."),
             Shortcut.registerShortcut("system:paste", tr("Edit: {0}", tr("Paste")), KeyEvent.VK_V, Shortcut.GROUP_MENU), true);
-            setEnabled(false);
+        setEnabled(false);
     }
 
     public void actionPerformed(ActionEvent e) {
-        DataSet pasteBuffer = Main.pasteBuffer;
-
+        pasteData(Main.pasteBuffer, e);
+    }
+    
+    public static void pasteData(DataSet pasteBuffer, ActionEvent e) {
         /* Find the middle of the pasteBuffer area */
         double maxEast = -1E100, minEast = 1E100, maxNorth = -1E100, minNorth = 1E100;
         for (Node n : pasteBuffer.nodes) {
