Index: trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java	(revision 11339)
+++ trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java	(revision 11343)
@@ -45,4 +45,16 @@
 public class AddImageryLayerAction extends JosmAction implements AdaptableAction {
     private final transient ImageryInfo info;
+
+    static class SelectWmsLayersDialog extends ExtendedDialog {
+        SelectWmsLayersDialog(WMSLayerTree tree, JComboBox<String> formats) {
+            super(Main.parent, tr("Select WMS layers"), new String[]{tr("Add layers"), tr("Cancel")});
+            final JScrollPane scrollPane = new JScrollPane(tree.getLayerTree());
+            scrollPane.setPreferredSize(new Dimension(400, 400));
+            final JPanel panel = new JPanel(new GridBagLayout());
+            panel.add(scrollPane, GBC.eol().fill());
+            panel.add(formats, GBC.eol().fill(GBC.HORIZONTAL));
+            setContent(panel);
+        }
+    }
 
     /**
@@ -151,15 +163,6 @@
         formats.setToolTipText(tr("Select image format for WMS layer"));
 
-        if (!GraphicsEnvironment.isHeadless()) {
-            if (1 != new ExtendedDialog(Main.parent, tr("Select WMS layers"), new String[]{tr("Add layers"), tr("Cancel")}) { {
-                final JScrollPane scrollPane = new JScrollPane(tree.getLayerTree());
-                scrollPane.setPreferredSize(new Dimension(400, 400));
-                final JPanel panel = new JPanel(new GridBagLayout());
-                panel.add(scrollPane, GBC.eol().fill());
-                panel.add(formats, GBC.eol().fill(GBC.HORIZONTAL));
-                setContent(panel);
-            } }.showDialog().getValue()) {
-                return null;
-            }
+        if (!GraphicsEnvironment.isHeadless() && 1 != new SelectWmsLayersDialog(tree, formats).showDialog().getValue()) {
+            return null;
         }
 
Index: trunk/src/org/openstreetmap/josm/actions/JumpToAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/JumpToAction.java	(revision 11339)
+++ trunk/src/org/openstreetmap/josm/actions/JumpToAction.java	(revision 11343)
@@ -36,4 +36,9 @@
 public class JumpToAction extends JosmAction {
 
+    private final JosmTextField url = new JosmTextField();
+    private final JosmTextField lat = new JosmTextField();
+    private final JosmTextField lon = new JosmTextField();
+    private final JosmTextField zm = new JosmTextField();
+
     /**
      * Constructs a new {@code JumpToAction}.
@@ -46,8 +51,11 @@
     }
 
-    private final JosmTextField url = new JosmTextField();
-    private final JosmTextField lat = new JosmTextField();
-    private final JosmTextField lon = new JosmTextField();
-    private final JosmTextField zm = new JosmTextField();
+    static class JumpToPositionDialog extends ExtendedDialog {
+        JumpToPositionDialog(String[] buttons, JPanel panel) {
+            super(Main.parent, tr("Jump to Position"), buttons);
+            setContent(panel);
+            setCancelButton(2);
+        }
+    }
 
     class OsmURLListener implements DocumentListener {
@@ -143,8 +151,5 @@
         double zoomLvl = 100;
         while (ll == null) {
-            final int option = new ExtendedDialog(Main.parent, tr("Jump to Position"), buttons) {{
-                setContent(panel);
-                setCancelButton(2);
-            }}.showDialog().getValue();
+            final int option = new JumpToPositionDialog(buttons, panel).showDialog().getValue();
 
             if (option != 1) return;
Index: trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java	(revision 11339)
+++ trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java	(revision 11343)
@@ -59,4 +59,15 @@
     protected final transient List<Class<? extends DownloadTask>> downloadTasks;
 
+    static class WhichTasksToPerformDialog extends ExtendedDialog {
+        WhichTasksToPerformDialog(JList<DownloadTask> list) {
+            super(Main.parent, tr("Which tasks to perform?"), new String[]{tr("Ok"), tr("Cancel")}, true);
+            setButtonIcons(new String[]{"ok", "cancel"});
+            final JPanel pane = new JPanel(new GridLayout(2, 1));
+            pane.add(new JLabel(tr("Which tasks to perform?")));
+            pane.add(list);
+            setContent(pane);
+        }
+    }
+
     /**
      * Create an open action. The name is "Open a file".
@@ -237,12 +248,5 @@
         final JList<DownloadTask> list = new JList<>(tasks.toArray(new DownloadTask[tasks.size()]));
         list.addSelectionInterval(0, tasks.size() - 1);
-        final ExtendedDialog dialog = new ExtendedDialog(Main.parent,
-                tr("Which tasks to perform?"), new String[]{tr("Ok"), tr("Cancel")}, true) { {
-            setButtonIcons(new String[]{"ok", "cancel"});
-            final JPanel pane = new JPanel(new GridLayout(2, 1));
-            pane.add(new JLabel(tr("Which tasks to perform?")));
-            pane.add(list);
-            setContent(pane);
-        } };
+        final ExtendedDialog dialog = new WhichTasksToPerformDialog(list);
         dialog.showDialog();
         return dialog.getValue() == 1 ? list.getSelectedValuesList() : Collections.<DownloadTask>emptyList();
Index: trunk/src/org/openstreetmap/josm/actions/PurgeAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/PurgeAction.java	(revision 11339)
+++ trunk/src/org/openstreetmap/josm/actions/PurgeAction.java	(revision 11343)
@@ -89,4 +89,13 @@
     }
 
+    /** force selection to be active for all entries */
+    static class SelectionForcedOsmPrimitivRenderer extends OsmPrimitivRenderer {
+        @Override
+        public Component getListCellRendererComponent(JList<? extends OsmPrimitive> list,
+                OsmPrimitive value, int index, boolean isSelected, boolean cellHasFocus) {
+            return super.getListCellRendererComponent(list, value, index, true, false);
+        }
+    }
+
     @Override
     public void actionPerformed(ActionEvent e) {
@@ -128,6 +137,5 @@
         toPurgeChecked = new HashSet<>();
 
-        // Add referrer, unless the object to purge is not new
-        // and the parent is a relation
+        // Add referrer, unless the object to purge is not new and the parent is a relation
         Set<OsmPrimitive> toPurgeRecursive = new HashSet<>();
         while (!toPurge.isEmpty()) {
@@ -169,6 +177,5 @@
             }
 
-        // Add untagged way nodes. Do not add nodes that have other
-        // referrers not yet to-be-purged.
+        // Add untagged way nodes. Do not add nodes that have other referrers not yet to-be-purged.
         if (Main.pref.getBoolean("purge.add_untagged_waynodes", true)) {
             Set<OsmPrimitive> wayNodes = new HashSet<>();
@@ -206,7 +213,5 @@
             }
 
-            /**
-             * Add higher level relations (list gets extended while looping over it)
-             */
+            // Add higher level relations (list gets extended while looping over it)
             List<Relation> relLst = new ArrayList<>(relSet);
             for (int i = 0; i < relLst.size(); ++i) { // foreach loop not applicable since list gets extended while looping over it
@@ -262,14 +267,5 @@
             JList<OsmPrimitive> list = new JList<>(toPurgeAdditionally.toArray(new OsmPrimitive[toPurgeAdditionally.size()]));
             /* force selection to be active for all entries */
-            list.setCellRenderer(new OsmPrimitivRenderer() {
-                @Override
-                public Component getListCellRendererComponent(JList<? extends OsmPrimitive> list,
-                        OsmPrimitive value,
-                        int index,
-                        boolean isSelected,
-                        boolean cellHasFocus) {
-                    return super.getListCellRendererComponent(list, value, index, true, false);
-                }
-            });
+            list.setCellRenderer(new SelectionForcedOsmPrimitivRenderer());
             JScrollPane scroll = new JScrollPane(list);
             scroll.setPreferredSize(new Dimension(250, 300));
Index: trunk/src/org/openstreetmap/josm/actions/RenameLayerAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/RenameLayerAction.java	(revision 11339)
+++ trunk/src/org/openstreetmap/josm/actions/RenameLayerAction.java	(revision 11343)
@@ -44,4 +44,17 @@
     }
 
+    static class InitialValueOptionPane extends JOptionPane {
+        InitialValueOptionPane(Box panel, JosmTextField initial) {
+            super(panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, null, initial);
+        }
+
+        @Override
+        public void selectInitialValue() {
+            JosmTextField initial = (JosmTextField) getInitialValue();
+            initial.requestFocusInWindow();
+            initial.selectAll();
+        }
+    }
+
     @Override
     public void actionPerformed(ActionEvent e) {
@@ -56,10 +69,5 @@
         }
 
-        final JOptionPane optionPane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION) {
-            @Override public void selectInitialValue() {
-                name.requestFocusInWindow();
-                name.selectAll();
-            }
-        };
+        final JOptionPane optionPane = new InitialValueOptionPane(panel, name);
         final JDialog dlg = optionPane.createDialog(Main.parent, tr("Rename layer"));
         dlg.setModalityType(ModalityType.DOCUMENT_MODAL);
Index: trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java	(revision 11339)
+++ trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java	(revision 11343)
@@ -264,17 +264,5 @@
                 }
             });
-            list.setCellRenderer(new DefaultListCellRenderer() {
-                @Override
-                public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
-                    final Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
-                    final String name = DefaultNameFormatter.getInstance().format((Way) value);
-                    // get rid of id from DefaultNameFormatter.decorateNameWithId()
-                    final String nameWithoutId = name
-                            .replace(tr(" [id: {0}]", ((Way) value).getId()), "")
-                            .replace(tr(" [id: {0}]", ((Way) value).getUniqueId()), "");
-                    ((JLabel) c).setText(tr("Segment {0}: {1}", index + 1, nameWithoutId));
-                    return c;
-                }
-            });
+            list.setCellRenderer(new SegmentListCellRenderer());
         }
 
@@ -306,4 +294,18 @@
                 Main.getLayerManager().getEditDataSet().setSelected(result.getNewSelection());
             }
+        }
+    }
+
+    static class SegmentListCellRenderer extends DefaultListCellRenderer {
+        @Override
+        public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
+            final Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
+            final String name = DefaultNameFormatter.getInstance().format((Way) value);
+            // get rid of id from DefaultNameFormatter.decorateNameWithId()
+            final String nameWithoutId = name
+                    .replace(tr(" [id: {0}]", ((Way) value).getId()), "")
+                    .replace(tr(" [id: {0}]", ((Way) value).getUniqueId()), "");
+            ((JLabel) c).setText(tr("Segment {0}: {1}", index + 1, nameWithoutId));
+            return c;
         }
     }
