Index: trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java	(revision 7089)
+++ trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java	(revision 7090)
@@ -36,6 +36,8 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
+
 import javax.swing.AbstractButton;
 import javax.swing.FocusManager;
+
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.Bounds;
@@ -83,5 +85,5 @@
     static {
         noThreads = Main.pref.getInteger(
-                "mappaint.StyledMapRenderer.style_creation.numberOfThreads", 
+                "mappaint.StyledMapRenderer.style_creation.numberOfThreads",
                 Runtime.getRuntime().availableProcessors());
         styleCreatorPool = noThreads <= 1 ? null : Executors.newFixedThreadPool(noThreads);
@@ -240,12 +242,17 @@
     /**
      * Joined List build from two Lists (read-only).
-     * 
+     *
      * Extremely simple single-purpose implementation.
-     * @param <T> 
+     * @param <T>
      */
     public static class CompositeList<T> extends AbstractList<T> {
-        List<T> a,b;
-
-        public CompositeList(List<T> a, List<T> b) {
+        List<? extends T> a,b;
+
+        /**
+         * Constructs a new {@code CompositeList} from two lists.
+         * @param a First list
+         * @param b Second list
+         */
+        public CompositeList(List<? extends T> a, List<? extends T> b) {
             this.a = a;
             this.b = b;
@@ -293,5 +300,4 @@
     }
 
-    private ElemStyles styles;
     private double circum;
 
@@ -1340,4 +1346,155 @@
     }
 
+    private class ComputeStyleListWorker implements Callable<List<StyleRecord>>, Visitor {
+        private final List<? extends OsmPrimitive> input;
+        private final int from;
+        private final int to;
+        private final List<StyleRecord> output;
+        private final DataSet data;
+
+        private final ElemStyles styles = MapPaintStyles.getStyles();
+
+        private final boolean drawArea = circum <= Main.pref.getInteger("mappaint.fillareas", 10000000);
+        private final boolean drawMultipolygon = drawArea && Main.pref.getBoolean("mappaint.multipolygon", true);
+        private final boolean drawRestriction = Main.pref.getBoolean("mappaint.restriction", true);
+
+        /**
+         * Constructor for CreateStyleRecordsWorker.
+         * @param input the primitives to process
+         * @param from first index of <code>input</code> to use
+         * @param to last index + 1
+         */
+        public ComputeStyleListWorker(final List<? extends OsmPrimitive> input, int from, int to, List<StyleRecord> output, DataSet data) {
+            this.input = input;
+            this.from = from;
+            this.to = to;
+            this.output = output;
+            this.data = data;
+            this.styles.setDrawMultipolygon(drawMultipolygon);
+        }
+
+        @Override
+        public List<StyleRecord> call() throws Exception {
+            for (int i = from; i<to; i++) {
+                OsmPrimitive osm = input.get(i);
+                if (osm.isDrawable()) {
+                    osm.accept(this);
+                }
+            }
+            return output;
+        }
+
+        @Override
+        public void visit(Node n) {
+            if (n.isDisabled()) {
+                add(n, FLAG_DISABLED);
+            } else if (data.isSelected(n)) {
+                add(n, FLAG_SELECTED);
+            } else if (n.isMemberOfSelected()) {
+                add(n, FLAG_MEMBER_OF_SELECTED);
+            } else {
+                add(n, FLAG_NORMAL);
+            }
+        }
+
+        @Override
+        public void visit(Way w) {
+            if (w.isDisabled()) {
+                add(w, FLAG_DISABLED);
+            } else if (data.isSelected(w)) {
+                add(w, FLAG_SELECTED);
+            } else if (w.isMemberOfSelected()) {
+                add(w, FLAG_MEMBER_OF_SELECTED);
+            } else {
+                add(w, FLAG_NORMAL);
+            }
+        }
+
+        @Override
+        public void visit(Relation r) {
+            if (r.isDisabled()) {
+                add(r, FLAG_DISABLED);
+            } else if (data.isSelected(r)) {
+                add(r, FLAG_SELECTED);
+            } else {
+                add(r, FLAG_NORMAL);
+            }
+        }
+
+        @Override
+        public void visit(Changeset cs) {
+            throw new UnsupportedOperationException();
+        }
+
+        public void add(Node osm, int flags) {
+            StyleList sl = styles.get(osm, circum, nc);
+            for (ElemStyle s : sl) {
+                output.add(new StyleRecord(s, osm, flags));
+            }
+        }
+
+        public void add(Relation osm, int flags) {
+            StyleList sl = styles.get(osm, circum, nc);
+            for (ElemStyle s : sl) {
+                if (drawMultipolygon && drawArea && s instanceof AreaElemStyle && (flags & FLAG_DISABLED) == 0) {
+                    output.add(new StyleRecord(s, osm, flags));
+                } else if (drawRestriction && s instanceof NodeElemStyle) {
+                    output.add(new StyleRecord(s, osm, flags));
+                }
+            }
+        }
+
+        public void add(Way osm, int flags) {
+            StyleList sl = styles.get(osm, circum, nc);
+            for (ElemStyle s : sl) {
+                if (!(drawArea && (flags & FLAG_DISABLED) == 0) && s instanceof AreaElemStyle) {
+                    continue;
+                }
+                output.add(new StyleRecord(s, osm, flags));
+            }
+        }
+    }
+
+    private class ConcurrentTasksHelper {
+
+        private final List<StyleRecord> allStyleElems;
+        private final DataSet data;
+
+        public ConcurrentTasksHelper(List<StyleRecord> allStyleElems, DataSet data) {
+            this.allStyleElems = allStyleElems;
+            this.data = data;
+        }
+
+        void process(List<? extends OsmPrimitive> prims) {
+            final List<ComputeStyleListWorker> tasks = new ArrayList<>();
+            final int bucketsize = Math.max(100, prims.size()/noThreads/3);
+            final int noBuckets = (prims.size() + bucketsize - 1) / bucketsize;
+            final boolean singleThread = noThreads == 1 || noBuckets == 1;
+            for (int i=0; i<noBuckets; i++) {
+                int from = i*bucketsize;
+                int to = Math.min((i+1)*bucketsize, prims.size());
+                List<StyleRecord> target = singleThread ? allStyleElems : new ArrayList<StyleRecord>(to - from);
+                tasks.add(new ComputeStyleListWorker(prims, from, to, target, data));
+            }
+            if (singleThread) {
+                try {
+                    for (ComputeStyleListWorker task : tasks) {
+                        task.call();
+                    }
+                } catch (Exception ex) {
+                    throw new RuntimeException(ex);
+                }
+            } else if (tasks.size() > 1) {
+                try {
+                    for (Future<List<StyleRecord>> future : styleCreatorPool.invokeAll(tasks)) {
+                            allStyleElems.addAll(future.get());
+                    }
+                } catch (InterruptedException | ExecutionException ex) {
+                    throw new RuntimeException(ex);
+                }
+            }
+        }
+    }
+
     @Override
     public void render(final DataSet data, boolean renderVirtualNodes, Bounds bounds) {
@@ -1345,11 +1502,4 @@
         getSettings(renderVirtualNodes);
 
-        final boolean drawArea = circum <= Main.pref.getInteger("mappaint.fillareas", 10000000);
-        final boolean drawMultipolygon = drawArea && Main.pref.getBoolean("mappaint.multipolygon", true);
-        final boolean drawRestriction = Main.pref.getBoolean("mappaint.restriction", true);
-
-        styles = MapPaintStyles.getStyles();
-        styles.setDrawMultipolygon(drawMultipolygon);
-        
         highlightWaySegments = data.getHighlightedWaySegments();
 
@@ -1361,154 +1511,20 @@
         }
 
-        class ComputeStyleListWorker implements Callable<List<StyleRecord>>, Visitor {
-            private final List<? extends OsmPrimitive> input;
-            private final int from;
-            private final int to;
-            private final List<StyleRecord> output;
-
-            /**
-             * Constructor for CreateStyleRecordsWorker.
-             * @param input the primitives to process
-             * @param from first index of <code>input</code> to use
-             * @param to last index + 1
-             */
-            public ComputeStyleListWorker(final List<? extends OsmPrimitive> input, int from, int to, List<StyleRecord> output) {
-                this.input = input;
-                this.from = from;
-                this.to = to;
-                this.output = output;
-            }
-
-            @Override
-            public List<StyleRecord> call() throws Exception {
-                for (int i = from; i<to; i++) {
-                    OsmPrimitive osm = input.get(i);
-                    if (osm.isDrawable()) {
-                        osm.accept(this);
-                    }
-                }
-                return output;
-            }
-
-            @Override
-            public void visit(Node n) {
-                if (n.isDisabled()) {
-                    add(n, FLAG_DISABLED);
-                } else if (data.isSelected(n)) {
-                    add(n, FLAG_SELECTED);
-                } else if (n.isMemberOfSelected()) {
-                    add(n, FLAG_MEMBER_OF_SELECTED);
-                } else {
-                    add(n, FLAG_NORMAL);
-                }
-            }
-
-            @Override
-            public void visit(Way w) {
-                if (w.isDisabled()) {
-                    add(w, FLAG_DISABLED);
-                } else if (data.isSelected(w)) {
-                    add(w, FLAG_SELECTED);
-                } else if (w.isMemberOfSelected()) {
-                    add(w, FLAG_MEMBER_OF_SELECTED);
-                } else {
-                    add(w, FLAG_NORMAL);
-                }
-            }
-
-            @Override
-            public void visit(Relation r) {
-                if (r.isDisabled()) {
-                    add(r, FLAG_DISABLED);
-                } else if (data.isSelected(r)) {
-                    add(r, FLAG_SELECTED);
-                } else {
-                    add(r, FLAG_NORMAL);
-                }
-            }
-
-            @Override
-            public void visit(Changeset cs) {
-                throw new UnsupportedOperationException();
-            }
-
-            public void add(Node osm, int flags) {
-                StyleList sl = styles.get(osm, circum, nc);
-                for (ElemStyle s : sl) {
-                    output.add(new StyleRecord(s, osm, flags));
-                }
-            }
-
-            public void add(Relation osm, int flags) {
-                StyleList sl = styles.get(osm, circum, nc);
-                for (ElemStyle s : sl) {
-                    if (drawMultipolygon && drawArea && s instanceof AreaElemStyle && (flags & FLAG_DISABLED) == 0) {
-                        output.add(new StyleRecord(s, osm, flags));
-                    } else if (drawRestriction && s instanceof NodeElemStyle) {
-                        output.add(new StyleRecord(s, osm, flags));
-                    }
-                }
-            }
-
-            public void add(Way osm, int flags) {
-                StyleList sl = styles.get(osm, circum, nc);
-                for (ElemStyle s : sl) {
-                    if (!(drawArea && (flags & FLAG_DISABLED) == 0) && s instanceof AreaElemStyle) {
-                        continue;
-                    }
-                    output.add(new StyleRecord(s, osm, flags));
-                }
-            }
-        }
         List<Node> nodes = data.searchNodes(bbox);
         List<Way> ways = data.searchWays(bbox);
         List<Relation> relations = data.searchRelations(bbox);
-        
+
         final List<StyleRecord> allStyleElems = new ArrayList<>(nodes.size()+ways.size()+relations.size());
 
-        class ConcurrentTasksHelper {
-
-            void process(List<? extends OsmPrimitive> prims) {
-                final List<ComputeStyleListWorker> tasks = new ArrayList<>();
-                final int bucketsize = Math.max(100, prims.size()/noThreads/3);
-                final int noBuckets = (prims.size() + bucketsize - 1) / bucketsize;
-                final boolean singleThread = noThreads == 1 || noBuckets == 1;
-                for (int i=0; i<noBuckets; i++) {
-                    int from = i*bucketsize;
-                    int to = Math.min((i+1)*bucketsize, prims.size());
-                    List<StyleRecord> target = singleThread ? allStyleElems : new ArrayList<StyleRecord>(to - from);
-                    tasks.add(new ComputeStyleListWorker(prims, from, to, target));
-                }
-                if (singleThread) {
-                    try {
-                        for (ComputeStyleListWorker task : tasks) {
-                            task.call();
-                        }
-                    } catch (Exception ex) {
-                        throw new RuntimeException(ex);
-                    }
-                } else if (tasks.size() > 1) {
-                    try {
-                        for (Future<List<StyleRecord>> future : styleCreatorPool.invokeAll(tasks)) {
-                                allStyleElems.addAll(future.get());
-                        }
-                    } catch (InterruptedException | ExecutionException ex) {
-                        throw new RuntimeException(ex);
-                    }
-                }
-            }
-        }
-        ConcurrentTasksHelper helper = new ConcurrentTasksHelper();
+        ConcurrentTasksHelper helper = new ConcurrentTasksHelper(allStyleElems, data);
 
         // Need to process all relations first.
         // Reason: Make sure, ElemStyles.getStyleCacheWithRange is
-        // not called for the same primtive in parallel threads.
+        // not called for the same primitive in parallel threads.
         // (Could be synchronized, but try to avoid this for
         // performance reasons.)
         helper.process(relations);
-        @SuppressWarnings("unchecked")
-        List<OsmPrimitive> nodesAndWays = (List) new CompositeList(nodes, ways);
-        helper.process(nodesAndWays);
-        
+        helper.process(new CompositeList<>(nodes, ways));
+
         if (Main.isTraceEnabled()) {
             timePhase1 = System.currentTimeMillis();
Index: trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java	(revision 7089)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java	(revision 7090)
@@ -126,5 +126,5 @@
         return group != null ? group.getRawName() + "/" + name : name;
     }
-    
+
     /**
      * Returns the preset icon.
@@ -254,5 +254,5 @@
             link.addToPanel(p, selected, presetInitiallyMatches);
         }
-        
+
         // "Add toolbar button"
         JToggleButton tb = new JToggleButton(new ToolbarButtonAction());
@@ -320,5 +320,35 @@
     }
 
-    public int showDialog(Collection<OsmPrimitive> sel, final boolean showNewRelation) {
+    private static class PresetDialog extends ExtendedDialog {
+        public PresetDialog(Component content, String title, ImageIcon icon, boolean disableApply, boolean showNewRelation) {
+            super(Main.parent, title,
+                    showNewRelation?
+                            new String[] { tr("Apply Preset"), tr("New relation"), tr("Cancel") }:
+                                new String[] { tr("Apply Preset"), tr("Cancel") },
+                                true);
+            if (icon != null)
+                setIconImage(icon.getImage());
+            contentInsets = new Insets(10,5,0,5);
+            if (showNewRelation) {
+                setButtonIcons(new String[] {"ok.png", "dialogs/addrelation.png", "cancel.png" });
+            } else {
+                setButtonIcons(new String[] {"ok.png", "cancel.png" });
+            }
+            setContent(content);
+            setDefaultButton(1);
+            setupDialog();
+            buttons.get(0).setEnabled(!disableApply);
+            buttons.get(0).setToolTipText(title);
+            // Prevent dialogs of being too narrow (fix #6261)
+            Dimension d = getSize();
+            if (d.width < 350) {
+                d.width = 350;
+                setSize(d);
+            }
+            showDialog();
+        }
+    }
+
+    public int showDialog(Collection<OsmPrimitive> sel, boolean showNewRelation) {
         PresetPanel p = createPanel(sel);
         if (p == null)
@@ -336,36 +366,6 @@
             }
 
-            class PresetDialog extends ExtendedDialog {
-                public PresetDialog(Component content, String title, ImageIcon icon, boolean disableApply) {
-                    super(Main.parent,
-                            title,
-                            showNewRelation?
-                                    new String[] { tr("Apply Preset"), tr("New relation"), tr("Cancel") }:
-                                        new String[] { tr("Apply Preset"), tr("Cancel") },
-                                        true);
-                    if (icon != null)
-                        setIconImage(icon.getImage());
-                    contentInsets = new Insets(10,5,0,5);
-                    if (showNewRelation) {
-                        setButtonIcons(new String[] {"ok.png", "dialogs/addrelation.png", "cancel.png" });
-                    } else {
-                        setButtonIcons(new String[] {"ok.png", "cancel.png" });
-                    }
-                    setContent(content);
-                    setDefaultButton(1);
-                    setupDialog();
-                    buttons.get(0).setEnabled(!disableApply);
-                    buttons.get(0).setToolTipText(title);
-                    // Prevent dialogs of being too narrow (fix #6261)
-                    Dimension d = getSize();
-                    if (d.width < 350) {
-                        d.width = 350;
-                        setSize(d);
-                    }
-                    showDialog();
-                }
-            }
-
-            answer = new PresetDialog(p, title, (ImageIcon) getValue(Action.SMALL_ICON), sel.isEmpty()).getValue();
+            answer = new PresetDialog(p, title, (ImageIcon) getValue(Action.SMALL_ICON),
+                    sel.isEmpty(), showNewRelation).getValue();
         }
         if (!showNewRelation && answer == 2)
@@ -502,5 +502,5 @@
         });
     }
-    
+
     /**
      * Action that adds or removes the button on main toolbar
@@ -522,5 +522,5 @@
         }
     }
-    
+
     public String getToolbarString() {
         ToolbarPreferences.ActionDefinition aDef
Index: trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 7089)
+++ trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 7090)
@@ -733,22 +733,21 @@
     }
 
+    /** Quit parsing, when a certain condition is met */
+    private static class SAXReturnException extends SAXException {
+        private final String result;
+
+        public SAXReturnException(String result) {
+            this.result = result;
+        }
+
+        public String getResult() {
+            return result;
+        }
+    }
+
     /**
      * Reads the wiki page on a certain file in html format in order to find the real image URL.
      */
     private static String getImgUrlFromWikiInfoPage(final String base, final String fn) {
-
-        /** Quit parsing, when a certain condition is met */
-        class SAXReturnException extends SAXException {
-            private final String result;
-
-            public SAXReturnException(String result) {
-                this.result = result;
-            }
-
-            public String getResult() {
-                return result;
-            }
-        }
-
         try {
             final XMLReader parser = XMLReaderFactory.createXMLReader();
