Index: trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMerger.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMerger.java	(revision 6145)
+++ trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMerger.java	(revision 6146)
@@ -51,5 +51,5 @@
  * A UI component for resolving conflicts in two lists of entries of type T.
  *
- * @param T  the type of the entries
+ * @param <T>  the type of the entries
  * @see ListMergeModel
  */
@@ -413,4 +413,8 @@
     }
 
+    /**
+     * Constructs a new {@code ListMerger}.
+     * @param model
+     */
     public ListMerger(ListMergeModel<T> model) {
         this.model = model;
@@ -421,24 +425,32 @@
 
     /**
+     * Base class of all other Copy* inner classes.
+     */
+    abstract class CopyAction extends AbstractAction implements ListSelectionListener {
+        
+        protected CopyAction(String icon_name, String action_name, String short_description) {
+            ImageIcon icon = ImageProvider.get("dialogs/conflict", icon_name+".png");
+            putValue(Action.SMALL_ICON, icon);
+            if (icon == null) {
+                putValue(Action.NAME, action_name);
+            }
+            putValue(Action.SHORT_DESCRIPTION, short_description);
+            setEnabled(false);
+        }
+    }
+    
+    /**
      * Action for copying selected nodes in the list of my nodes to the list of merged
      * nodes. Inserts the nodes at the beginning of the list of merged nodes.
-     *
      */
-    class CopyStartLeftAction extends AbstractAction implements ListSelectionListener {
+    class CopyStartLeftAction extends CopyAction {
 
         public CopyStartLeftAction() {
-            ImageIcon icon = ImageProvider.get("dialogs/conflict", "copystartleft.png");
-            putValue(Action.SMALL_ICON, icon);
-            if (icon == null) {
-                putValue(Action.NAME, tr("> top"));
-            }
-            putValue(Action.SHORT_DESCRIPTION, tr("Copy my selected nodes to the start of the merged node list"));
-            setEnabled(false);
-        }
-
-        @Override
-        public void actionPerformed(ActionEvent arg0) {
-            int [] rows = myEntriesTable.getSelectedRows();
-            model.copyMyToTop(rows);
+            super("copystartleft", tr("> top"), tr("Copy my selected nodes to the start of the merged node list"));
+        }
+
+        @Override
+        public void actionPerformed(ActionEvent e) {
+            model.copyMyToTop(myEntriesTable.getSelectedRows());
         }
 
@@ -452,22 +464,14 @@
      * Action for copying selected nodes in the list of my nodes to the list of merged
      * nodes. Inserts the nodes at the end of the list of merged nodes.
-     *
      */
-    class CopyEndLeftAction extends AbstractAction implements ListSelectionListener {
+    class CopyEndLeftAction extends CopyAction {
 
         public CopyEndLeftAction() {
-            ImageIcon icon = ImageProvider.get("dialogs/conflict", "copyendleft.png");
-            putValue(Action.SMALL_ICON, icon);
-            if (icon == null) {
-                putValue(Action.NAME, tr("> bottom"));
-            }
-            putValue(Action.SHORT_DESCRIPTION, tr("Copy my selected elements to the end of the list of merged elements."));
-            setEnabled(false);
-        }
-
-        @Override
-        public void actionPerformed(ActionEvent arg0) {
-            int [] rows = myEntriesTable.getSelectedRows();
-            model.copyMyToEnd(rows);
+            super("copyendleft", tr("> bottom"), tr("Copy my selected elements to the end of the list of merged elements."));
+        }
+
+        @Override
+        public void actionPerformed(ActionEvent e) {
+            model.copyMyToEnd(myEntriesTable.getSelectedRows());
         }
 
@@ -481,24 +485,18 @@
      * Action for copying selected nodes in the list of my nodes to the list of merged
      * nodes. Inserts the nodes before the first selected row in the list of merged nodes.
-     *
      */
-    class CopyBeforeCurrentLeftAction extends AbstractAction implements ListSelectionListener {
+    class CopyBeforeCurrentLeftAction extends CopyAction {
 
         public CopyBeforeCurrentLeftAction() {
-            ImageIcon icon = ImageProvider.get("dialogs/conflict", "copybeforecurrentleft.png");
-            putValue(Action.SMALL_ICON, icon);
-            if (icon == null) {
-                putValue(Action.NAME, "> before");
-            }
-            putValue(Action.SHORT_DESCRIPTION, tr("Copy my selected elements before the first selected element in the list of merged elements."));
-            setEnabled(false);
-        }
-
-        @Override
-        public void actionPerformed(ActionEvent arg0) {
-            int [] myRows = myEntriesTable.getSelectedRows();
+            super("copybeforecurrentleft", tr("> before"), 
+                    tr("Copy my selected elements before the first selected element in the list of merged elements."));
+        }
+
+        @Override
+        public void actionPerformed(ActionEvent e) {
             int [] mergedRows = mergedEntriesTable.getSelectedRows();
             if (mergedRows == null || mergedRows.length == 0)
                 return;
+            int [] myRows = myEntriesTable.getSelectedRows();
             int current = mergedRows[0];
             model.copyMyBeforeCurrent(myRows, current);
@@ -509,5 +507,5 @@
             setEnabled(
                     !myEntriesTable.getSelectionModel().isSelectionEmpty()
-                    && ! mergedEntriesTable.getSelectionModel().isSelectionEmpty()
+                    && !mergedEntriesTable.getSelectionModel().isSelectionEmpty()
             );
         }
@@ -517,24 +515,18 @@
      * Action for copying selected nodes in the list of my nodes to the list of merged
      * nodes. Inserts the nodes after the first selected row in the list of merged nodes.
-     *
      */
-    class CopyAfterCurrentLeftAction extends AbstractAction implements ListSelectionListener {
+    class CopyAfterCurrentLeftAction extends CopyAction {
 
         public CopyAfterCurrentLeftAction() {
-            ImageIcon icon = ImageProvider.get("dialogs/conflict", "copyaftercurrentleft.png");
-            putValue(Action.SMALL_ICON, icon);
-            if (icon == null) {
-                putValue(Action.NAME, "> after");
-            }
-            putValue(Action.SHORT_DESCRIPTION, tr("Copy my selected elements after the first selected element in the list of merged elements."));
-            setEnabled(false);
-        }
-
-        @Override
-        public void actionPerformed(ActionEvent arg0) {
-            int [] myRows = myEntriesTable.getSelectedRows();
+            super("copyaftercurrentleft", tr("> after"), 
+                    tr("Copy my selected elements after the first selected element in the list of merged elements."));
+        }
+
+        @Override
+        public void actionPerformed(ActionEvent e) {
             int [] mergedRows = mergedEntriesTable.getSelectedRows();
             if (mergedRows == null || mergedRows.length == 0)
                 return;
+            int [] myRows = myEntriesTable.getSelectedRows();
             int current = mergedRows[0];
             model.copyMyAfterCurrent(myRows, current);
@@ -545,25 +537,18 @@
             setEnabled(
                     !myEntriesTable.getSelectionModel().isSelectionEmpty()
-                    && ! mergedEntriesTable.getSelectionModel().isSelectionEmpty()
+                    && !mergedEntriesTable.getSelectionModel().isSelectionEmpty()
             );
         }
     }
 
-    class CopyStartRightAction extends AbstractAction implements ListSelectionListener {
+    class CopyStartRightAction extends CopyAction {
 
         public CopyStartRightAction() {
-            ImageIcon icon = ImageProvider.get("dialogs/conflict", "copystartright.png");
-            putValue(Action.SMALL_ICON, icon);
-            if (icon == null) {
-                putValue(Action.NAME, "< top");
-            }
-            putValue(Action.SHORT_DESCRIPTION, tr("Copy their selected element to the start of the list of merged elements."));
-            setEnabled(false);
-        }
-
-        @Override
-        public void actionPerformed(ActionEvent arg0) {
-            int [] rows = theirEntriesTable.getSelectedRows();
-            model.copyTheirToTop(rows);
+            super("copystartright", tr("< top"), tr("Copy their selected element to the start of the list of merged elements."));
+        }
+
+        @Override
+        public void actionPerformed(ActionEvent e) {
+            model.copyTheirToTop(theirEntriesTable.getSelectedRows());
         }
 
@@ -574,20 +559,13 @@
     }
 
-    class CopyEndRightAction extends AbstractAction implements ListSelectionListener {
+    class CopyEndRightAction extends CopyAction {
 
         public CopyEndRightAction() {
-            ImageIcon icon = ImageProvider.get("dialogs/conflict", "copyendright.png");
-            putValue(Action.SMALL_ICON, icon);
-            if (icon == null) {
-                putValue(Action.NAME, "< bottom");
-            }
-            putValue(Action.SHORT_DESCRIPTION, tr("Copy their selected elements to the end of the list of merged elements."));
-            setEnabled(false);
+            super("copyendright", tr("< bottom"), tr("Copy their selected elements to the end of the list of merged elements."));
         }
 
         @Override
         public void actionPerformed(ActionEvent arg0) {
-            int [] rows = theirEntriesTable.getSelectedRows();
-            model.copyTheirToEnd(rows);
+            model.copyTheirToEnd(theirEntriesTable.getSelectedRows());
         }
 
@@ -598,22 +576,17 @@
     }
 
-    class CopyBeforeCurrentRightAction extends AbstractAction implements ListSelectionListener {
+    class CopyBeforeCurrentRightAction extends CopyAction {
 
         public CopyBeforeCurrentRightAction() {
-            ImageIcon icon = ImageProvider.get("dialogs/conflict", "copybeforecurrentright.png");
-            putValue(Action.SMALL_ICON, icon);
-            if (icon == null) {
-                putValue(Action.NAME, "< before");
-            }
-            putValue(Action.SHORT_DESCRIPTION, tr("Copy their selected elements before the first selected element in the list of merged elements."));
-            setEnabled(false);
-        }
-
-        @Override
-        public void actionPerformed(ActionEvent arg0) {
-            int [] myRows = theirEntriesTable.getSelectedRows();
+            super("copybeforecurrentright", tr("< before"), 
+                    tr("Copy their selected elements before the first selected element in the list of merged elements."));
+        }
+
+        @Override
+        public void actionPerformed(ActionEvent e) {
             int [] mergedRows = mergedEntriesTable.getSelectedRows();
             if (mergedRows == null || mergedRows.length == 0)
                 return;
+            int [] myRows = theirEntriesTable.getSelectedRows();
             int current = mergedRows[0];
             model.copyTheirBeforeCurrent(myRows, current);
@@ -624,27 +597,22 @@
             setEnabled(
                     !theirEntriesTable.getSelectionModel().isSelectionEmpty()
-                    && ! mergedEntriesTable.getSelectionModel().isSelectionEmpty()
+                    && !mergedEntriesTable.getSelectionModel().isSelectionEmpty()
             );
         }
     }
 
-    class CopyAfterCurrentRightAction extends AbstractAction implements ListSelectionListener {
+    class CopyAfterCurrentRightAction extends CopyAction {
 
         public CopyAfterCurrentRightAction() {
-            ImageIcon icon = ImageProvider.get("dialogs/conflict", "copyaftercurrentright.png");
-            putValue(Action.SMALL_ICON, icon);
-            if (icon == null) {
-                putValue(Action.NAME, "< after");
-            }
-            putValue(Action.SHORT_DESCRIPTION, tr("Copy their selected element after the first selected element in the list of merged elements"));
-            setEnabled(false);
-        }
-
-        @Override
-        public void actionPerformed(ActionEvent arg0) {
-            int [] myRows = theirEntriesTable.getSelectedRows();
+            super("copyaftercurrentright", tr("< after"), 
+                    tr("Copy their selected element after the first selected element in the list of merged elements"));
+        }
+
+        @Override
+        public void actionPerformed(ActionEvent e) {
             int [] mergedRows = mergedEntriesTable.getSelectedRows();
             if (mergedRows == null || mergedRows.length == 0)
                 return;
+            int [] myRows = theirEntriesTable.getSelectedRows();
             int current = mergedRows[0];
             model.copyTheirAfterCurrent(myRows, current);
@@ -655,5 +623,5 @@
             setEnabled(
                     !theirEntriesTable.getSelectionModel().isSelectionEmpty()
-                    && ! mergedEntriesTable.getSelectionModel().isSelectionEmpty()
+                    && !mergedEntriesTable.getSelectionModel().isSelectionEmpty()
             );
         }
