Index: trunk/presets/presets.xml
===================================================================
--- trunk/presets/presets.xml	(revision 1359)
+++ trunk/presets/presets.xml	(revision 1360)
@@ -8,4 +8,9 @@
 -->
 <!--
+item:
+  name: the text to display
+  icon: the icon to display
+  type: the data types - way,node,relation,closedway (separated by comma)
+
 link: link to the relating map features website
 
@@ -35,8 +40,10 @@
   default: ticked on/off
   delete_if_empty: true/false
+
+See also http://josm.openstreetmap.de/wiki/TaggingPresets.
 -->
 <annotations>
     <group name="Streets" icon="presets/way_secondary.png">
-        <item name="Motorway" icon="presets/motorway.png">
+        <item name="Motorway" icon="presets/motorway.png" type="way">
             <link href="http://wiki.openstreetmap.org/wiki/Tag:highway=motorway"
                   de:href="http://wiki.openstreetmap.org/wiki/DE:Tag:highway=motorway" />
@@ -57,5 +64,5 @@
             </optional>
         </item>
-        <item name="Motorway Link" icon="presets/motorway.png">
+        <item name="Motorway Link" icon="presets/motorway.png" type="way">
             <link href="http://wiki.openstreetmap.org/wiki/Tag:highway=motorway_link"
                   de:href="http://wiki.openstreetmap.org/wiki/DE:Tag:highway=motorway_link" />
@@ -74,5 +81,5 @@
             </optional>
         </item>
-        <item name="Trunk" icon="presets/trunk.png">
+        <item name="Trunk" icon="presets/trunk.png" type="way">
             <link href="http://wiki.openstreetmap.org/wiki/Tag:highway=trunk"
                   de:href="http://wiki.openstreetmap.org/wiki/DE:Tag:highway=trunk" />
@@ -93,5 +100,5 @@
             </optional>
         </item>
-        <item name="Trunk Link" icon="presets/trunk.png">
+        <item name="Trunk Link" icon="presets/trunk.png" type="way">
             <link href="http://wiki.openstreetmap.org/wiki/Tag:highway=trunk_link" 
                   de:href="http://wiki.openstreetmap.org/wiki/DE:Tag:highway=trunk_link"/>
@@ -112,5 +119,5 @@
         </item>
         <separator/>
-        <item name="Primary" icon="presets/way_primary.png">
+        <item name="Primary" icon="presets/way_primary.png" type="way">
             <link href="http://wiki.openstreetmap.org/wiki/Tag:highway=primary" 
                   de:href="http://wiki.openstreetmap.org/wiki/DE:Tag:highway=primary" />
@@ -131,5 +138,5 @@
             </optional>
         </item>
-        <item name="Primary Link" icon="presets/way_primary.png">
+        <item name="Primary Link" icon="presets/way_primary.png" type="way">
             <label text="Edit a Primary Link" />
             <space />
@@ -146,5 +153,5 @@
             </optional>
         </item>
-        <item name="Secondary" icon="presets/way_secondary.png">
+        <item name="Secondary" icon="presets/way_secondary.png" type="way">
             <link href="http://wiki.openstreetmap.org/wiki/Tag:highway=secondary"
                   de:href="http://wiki.openstreetmap.org/wiki/DE:Tag:highway=secondary"
@@ -166,5 +173,5 @@
             </optional>
         </item>
-        <item name="Tertiary" icon="presets/way_tertiary.png">
+        <item name="Tertiary" icon="presets/way_tertiary.png" type="way">
             <link href="http://wiki.openstreetmap.org/wiki/Tag:highway=tertiary"
                   de:href="http://wiki.openstreetmap.org/wiki/DE:Tag:highway=tertiary"
@@ -185,5 +192,5 @@
             </optional>
         </item>
-        <item name="Unclassified" icon="presets/way_unclassified.png">
+        <item name="Unclassified" icon="presets/way_unclassified.png" type="way">
             <link href="http://wiki.openstreetmap.org/wiki/Tag:highway=unclassified"
                   de:href="http://wiki.openstreetmap.org/wiki/DE:Tag:highway=unclassified"
@@ -204,5 +211,5 @@
             </optional>
         </item>
-        <item name="Residential" icon="presets/residential.png">
+        <item name="Residential" icon="presets/residential.png" type="way">
             <link href="http://wiki.openstreetmap.org/wiki/Tag:highway=residential"
                   de:href="http://wiki.openstreetmap.org/wiki/DE:Tag:highway=residential" />
@@ -222,5 +229,5 @@
             </optional>
         </item>
-        <item name="Living Street" icon="presets/living_street.png">
+        <item name="Living Street" icon="presets/living_street.png" type="way">
             <link href="http://wiki.openstreetmap.org/wiki/Tag:highway=living_street" 
                   de:href="http://wiki.openstreetmap.org/wiki/DE:Tag:highway=living_street" />
@@ -240,5 +247,5 @@
             </optional>
         </item>
-        <item name="Service" icon="presets/way_unclassified.png">
+        <item name="Service" icon="presets/way_unclassified.png" type="way">
             <link href="http://wiki.openstreetmap.org/wiki/Tag:highway=service"
                   de:href="http://wiki.openstreetmap.org/wiki/DE:Tag:highway=service" />
@@ -259,5 +266,5 @@
             </optional>
         </item>
-        <item name="Parking Aisle" icon="presets/way_unclassified.png">
+        <item name="Parking Aisle" icon="presets/way_unclassified.png" type="way">
             <link href="http://wiki.openstreetmap.org/wiki/Tag:service=parking_aisle"
                   de:href="http://wiki.openstreetmap.org/wiki/DE:Tag:service=parking_aisle"
@@ -273,6 +280,6 @@
         </item>
         <separator/>
-        <item name="Road (Unknown Type)" icon="presets/way_unclassified.png">
-            <link href="http://wiki.openstreetmap.org/wiki/Tag:highway=road" 
+        <item name="Road (Unknown Type)" icon="presets/way_unclassified.png" type="way">
+            <link href="http://wiki.openstreetmap.org/wiki/Tag:highway=road"
                   de:href="http://wiki.openstreetmap.org/wiki/DE:Tag:highway=road" />
             <label text="Edit a Road of unknown type" />
@@ -2864,6 +2871,5 @@
         </item>
     </group> <!-- Natural -->
-<!-- FIXME: parameter type and element role not yet supported! -->
-<!-- type should be used for all other items also to say if they are used for nodes/ways -->
+<!-- FIXME: element role not yet supported! -->
     <group name="Relations" icon="presets/empty.png">
         <item name="Multipolygon" icon="presets/empty.png" type="relation">
Index: trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java	(revision 1359)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java	(revision 1360)
@@ -2,4 +2,5 @@
 package org.openstreetmap.josm.gui.tagging;
 
+import static org.openstreetmap.josm.tools.I18n.marktr;
 import static org.openstreetmap.josm.tools.I18n.tr;
 import static org.openstreetmap.josm.tools.I18n.trn;
@@ -14,4 +15,5 @@
 import java.io.Reader;
 import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
@@ -39,4 +41,7 @@
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.OsmUtils;
+import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.data.osm.Relation;
 import org.openstreetmap.josm.io.MirroredInputStream;
 import org.openstreetmap.josm.gui.QuadStateCheckBox;
@@ -412,5 +417,5 @@
      * The types as preparsed collection.
      */
-    public Collection<Class<?>> types;
+    public List<String> types;
     public List<Item> data = new LinkedList<Item>();
     private static HashMap<String,String> lastValue = new HashMap<String,String>();
@@ -462,15 +467,11 @@
      * Called from the XML parser to set the types this preset affects
      */
+    private static Collection<String> allowedtypes = Arrays.asList(new String[]
+    {marktr("way"), marktr("node"), marktr("relation"), marktr("closedway")});
     public void setType(String types) throws SAXException {
-        try {
-            for (String type : types.split(",")) {
-                type = Character.toUpperCase(type.charAt(0))+type.substring(1);
-                if (this.types == null)
-                    this.types = new LinkedList<Class<?>>();
-                this.types.add(Class.forName("org.openstreetmap.josm.data.osm."+type));
-            }
-        } catch (ClassNotFoundException e) {
-            e.printStackTrace();
-            throw new SAXException(tr("Unknown type"));
+        this.types = Arrays.asList(types.split(","));
+        for (String type : this.types) {
+            if(!allowedtypes.contains(type))
+                throw new SAXException(tr("Unknown type: {0}", type));
         }
     }
@@ -563,4 +564,15 @@
         JPanel p = new JPanel(new GridBagLayout());
         LinkedList<Item> l = new LinkedList<Item>();
+        if(types != null)
+        {
+            JPanel pp = new JPanel();
+            for(String t : types)
+            {
+                JLabel la = new JLabel(ImageProvider.get("Mf_" + t));
+                la.setToolTipText(tr("Elements of type {0} are supported.", tr(t)));
+                pp.add(la);
+            }
+            p.add(pp, GBC.eol());
+        }
 
         for (Item i : data)
@@ -577,5 +589,5 @@
 
     public void actionPerformed(ActionEvent e) {
-        Collection<OsmPrimitive> sel = Main.ds.getSelected();
+        Collection<OsmPrimitive> sel = createSelection(Main.ds.getSelected());
         JPanel p = createPanel(sel);
         if (p == null)
@@ -593,5 +605,9 @@
                 }
             };
-            optionPane.createDialog(Main.parent, trn("Change {0} object", "Change {0} objects", sel.size(), sel.size())).setVisible(true);
+            String title = trn("Change {0} object", "Change {0} objects", sel.size(), sel.size());
+            if(sel.size() == 0)
+                title = tr("Nothing selected!");
+
+            optionPane.createDialog(Main.parent, title).setVisible(true);
             Object answerObj = optionPane.getValue();
             if (answerObj == null || answerObj == JOptionPane.UNINITIALIZED_VALUE ||
@@ -599,6 +615,6 @@
                 answer = JOptionPane.CANCEL_OPTION;
         }
-        if (answer == JOptionPane.OK_OPTION) {
-            Command cmd = createCommand(Main.ds.getSelected());
+        if (sel.size() != 0 && answer == JOptionPane.OK_OPTION) {
+            Command cmd = createCommand(sel);
             if (cmd != null)
                 Main.main.undoRedo.add(cmd);
@@ -607,12 +623,31 @@
     }
 
-    private Command createCommand(Collection<OsmPrimitive> participants) {
+    private Collection<OsmPrimitive> createSelection(Collection<OsmPrimitive> participants) {
         Collection<OsmPrimitive> sel = new LinkedList<OsmPrimitive>();
         for (OsmPrimitive osm : participants)
-            if (types == null || types.contains(osm.getClass()))
-                sel.add(osm);
-        if (sel.isEmpty())
-            return null;
-
+        {
+            if (types != null)
+            {
+                if(osm instanceof Relation)
+                {
+                    if(!types.contains("relation")) continue;
+                }
+                else if(osm instanceof Node)
+                {
+                    if(!types.contains("node")) continue;
+                }
+                else if(osm instanceof Way)
+                {
+                    if(!types.contains("way") &&
+                    !(types.contains("closedway") && ((Way)osm).isClosed()))
+                        continue;
+                }
+            }
+            sel.add(osm);
+        }
+        return sel;
+    }
+
+    private Command createCommand(Collection<OsmPrimitive> sel) {
         List<Command> cmds = new LinkedList<Command>();
         for (Item i : data)
