Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java	(revision 5330)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java	(revision 5331)
@@ -25,6 +25,7 @@
 import java.awt.event.WindowEvent;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
+import java.util.LinkedList;
 import java.util.List;
 
@@ -757,17 +758,24 @@
     }
 
-    @SuppressWarnings("unchecked")
     protected Component createLayout(Component data, boolean scroll, Collection<SideButton> buttons) {
-        return createLayout(data, scroll, Collections.singletonList(buttons));
-    }
-
-    protected Component createLayout(Component data, boolean scroll, List<Collection<SideButton>> buttons) {
+        return createLayout(data, scroll, buttons, (Collection<SideButton>[]) null);
+    }
+
+    protected Component createLayout(Component data, boolean scroll, Collection<SideButton> firstButtons, Collection<SideButton>... nextButtons) {
         if (scroll) {
             data = new JScrollPane(data);
         }
+        LinkedList<Collection<SideButton>> buttons = new LinkedList<Collection<SideButton>>();
+        buttons.addFirst(firstButtons);
+        if (nextButtons != null) {
+            buttons.addAll(Arrays.asList(nextButtons));
+        }
         add(data, BorderLayout.CENTER);
-        if (buttons != null && buttons.size() > 0 && buttons.get(0) != null && !buttons.get(0).isEmpty()) {
+        if (buttons.size() > 0 && buttons.get(0) != null && !buttons.get(0).isEmpty()) {
             buttonsPanel = new JPanel(new GridLayout(buttons.size(), 1));
             for (Collection<SideButton> buttonRow : buttons) {
+                if (buttonRow == null) {
+                    continue;
+                }
                 final JPanel buttonRowPanel = new JPanel(Main.pref.getBoolean("dialog.align.left", false)
                         ? new FlowLayout(FlowLayout.LEFT) : new GridLayout(1, buttonRow.size()));
