Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/TagChecker.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/TagChecker.java	(revision 20154)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/TagChecker.java	(revision 20155)
@@ -5,4 +5,5 @@
 
 import java.awt.Dimension;
+import java.awt.GridBagConstraints;
 import java.awt.GridBagLayout;
 import java.awt.event.ActionEvent;
@@ -41,4 +42,5 @@
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
 import org.openstreetmap.josm.data.osm.OsmUtils;
 import org.openstreetmap.josm.data.osm.Relation;
@@ -149,5 +151,5 @@
     {
         super(tr("Properties checker :"),
-              tr("This plugin checks for errors in property keys and values."));
+                tr("This plugin checks for errors in property keys and values."));
     }
 
@@ -327,7 +329,7 @@
             /*  for(String a : OsmPrimitive.getDirectionKeys())
                 presetsValueData.add(a);
-            */
+             */
             for(String a : Main.pref.getCollection(PreferenceEditor.PREFIX + ".knownkeys",
-            Arrays.asList(new String[]{"is_in", "int_ref", "fixme", "population"})))
+                    Arrays.asList(new String[]{"is_in", "int_ref", "fixme", "population"})))
                 presetsValueData.add(a);
             for(TaggingPreset p : presets)
@@ -431,15 +433,16 @@
                 {
                     errors.add( new TestError(this, Severity.ERROR, tr("Illegal tag/value combinations"),
-                    tr("Illegal tag/value combinations"), tr("Illegal tag/value combinations"), 1272, p) );
+                            tr("Illegal tag/value combinations"), tr("Illegal tag/value combinations"), 1272, p) );
                     withErrors.add(p, "TC");
                 }
             }
 
+            Map<String, String> keys = p.getKeys();
             for(CheckerData d : checkerData)
             {
-                if(d.match(p))
+                if(d.match(p, keys))
                 {
                     errors.add( new TestError(this, d.getSeverity(), tr("Illegal tag/value combinations"),
-                    d.getDescription(), d.getDescriptionOrig(), d.getCode(), p) );
+                            d.getDescription(), d.getDescriptionOrig(), d.getCode(), p) );
                     withErrors.add(p, "TC");
                 }
@@ -456,5 +459,5 @@
                     translated the stuff before. Makes the ignore file language dependend. */
                     errors.add( new TestError(this, Severity.WARNING, tr("Painting problem"),
-                    s, s, PAINT, p) );
+                            s, s, PAINT, p) );
                     withErrors.add(p, "P");
                 }
@@ -471,5 +474,5 @@
             {
                 errors.add( new TestError(this, Severity.WARNING, tr("Tags with empty values"),
-                tr(s, key), MessageFormat.format(s, key), EMPTY_VALUES, p) );
+                        tr(s, key), MessageFormat.format(s, key), EMPTY_VALUES, p) );
                 withErrors.add(p, "EV");
             }
@@ -477,5 +480,5 @@
             {
                 errors.add( new TestError(this, Severity.WARNING, tr("Invalid property key"),
-                tr(s, key), MessageFormat.format(s, key), INVALID_KEY, p) );
+                        tr(s, key), MessageFormat.format(s, key), INVALID_KEY, p) );
                 withErrors.add(p, "IPK");
             }
@@ -483,5 +486,5 @@
             {
                 errors.add( new TestError(this, Severity.WARNING, tr("Invalid white space in property key"),
-                tr(s, key), MessageFormat.format(s, key), INVALID_KEY_SPACE, p) );
+                        tr(s, key), MessageFormat.format(s, key), INVALID_KEY_SPACE, p) );
                 withErrors.add(p, "IPK");
             }
@@ -489,5 +492,5 @@
             {
                 errors.add( new TestError(this, Severity.OTHER, tr("Property values start or end with white space"),
-                tr(s, key), MessageFormat.format(s, key), INVALID_SPACE, p) );
+                        tr(s, key), MessageFormat.format(s, key), INVALID_SPACE, p) );
                 withErrors.add(p, "SPACE");
             }
@@ -495,5 +498,5 @@
             {
                 errors.add( new TestError(this, Severity.OTHER, tr("Property values contain HTML entity"),
-                tr(s, key), MessageFormat.format(s, key), INVALID_HTML, p) );
+                        tr(s, key), MessageFormat.format(s, key), INVALID_HTML, p) );
                 withErrors.add(p, "HTML");
             }
@@ -523,5 +526,5 @@
                         String i = marktr("Key ''{0}'' not in presets.");
                         errors.add( new TestError(this, Severity.OTHER, tr("Presets do not contain property key"),
-                        tr(i, key), MessageFormat.format(i, key), INVALID_VALUE, p) );
+                                tr(i, key), MessageFormat.format(i, key), INVALID_VALUE, p) );
                         withErrors.add(p, "UPK");
                     }
@@ -546,19 +549,19 @@
                         String i = marktr("Value ''{0}'' for key ''{1}'' not in presets.");
                         errors.add( new TestError(this, Severity.OTHER, tr("Presets do not contain property value"),
-                        tr(i, prop.getValue(), key), MessageFormat.format(i, prop.getValue(), key), INVALID_VALUE, p) );
+                                tr(i, prop.getValue(), key), MessageFormat.format(i, prop.getValue(), key), INVALID_VALUE, p) );
                         withErrors.add(p, "UPV");
                     }
                 }
             }
-			if (checkFixmes && value != null && value.length() > 0) {
-				if ((value.toLowerCase().contains("FIXME")
-						|| value.contains("check and delete")
-						|| key.contains("todo") || key.toLowerCase().contains("fixme"))
-						&& !withErrors.contains(p, "FIXME")) {
-					errors.add(new TestError(this, Severity.OTHER,
-							tr("FIXMES"), FIXME, p));
-					withErrors.add(p, "FIXME");
-				}
-			}
+            if (checkFixmes && value != null && value.length() > 0) {
+                if ((value.toLowerCase().contains("FIXME")
+                        || value.contains("check and delete")
+                        || key.contains("todo") || key.toLowerCase().contains("fixme"))
+                        && !withErrors.contains(p, "FIXME")) {
+                    errors.add(new TestError(this, Severity.OTHER,
+                            tr("FIXMES"), FIXME, p));
+                    withErrors.add(p, "FIXME");
+                }
+            }
         }
     }
@@ -600,5 +603,5 @@
     {
         GBC a = GBC.eol();
-        a.anchor = GBC.EAST;
+        a.anchor = GridBagConstraints.EAST;
 
         testPanel.add( new JLabel(name), GBC.eol().insets(3,0,0,0) );
@@ -637,5 +640,5 @@
                         tr("TagChecker source"),
                         JOptionPane.QUESTION_MESSAGE
-                        );
+                );
                 if (source != null)
                     ((DefaultListModel)Sources.getModel()).addElement(source);
@@ -668,5 +671,5 @@
                                 tr("Information"),
                                 JOptionPane.INFORMATION_MESSAGE
-                                );
+                        );
                     }
                 }
@@ -703,7 +706,7 @@
 
         testPanel.add(new JLabel(tr("Data sources")), GBC.eol().insets(23,0,0,0));
-        testPanel.add(new JScrollPane(Sources), GBC.eol().insets(23,0,0,0).fill(GBC.HORIZONTAL));
+        testPanel.add(new JScrollPane(Sources), GBC.eol().insets(23,0,0,0).fill(GridBagConstraints.HORIZONTAL));
         final JPanel buttonPanel = new JPanel(new GridBagLayout());
-        testPanel.add(buttonPanel, GBC.eol().fill(GBC.HORIZONTAL));
+        testPanel.add(buttonPanel, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
         buttonPanel.add(addSrcButton, GBC.std().insets(0,5,0,0));
         buttonPanel.add(editSrcButton, GBC.std().insets(5,5,5,0));
@@ -837,5 +840,5 @@
                         {
                             commands.add( new ChangePropertyKeyCommand(Collections.singleton(primitives.get(i)),
-                            key, replacementKey) );
+                                    key, replacementKey) );
                         }
                     }
@@ -879,11 +882,7 @@
         private String description;
         private List<CheckerElement> data = new ArrayList<CheckerElement>();
-        private Integer type = 0;
-        private Integer code;
+        private OsmPrimitiveType type;
+        private int code;
         protected Severity severity;
-        protected static int NODE = 1;
-        protected static int WAY = 2;
-        protected static int RELATION = 3;
-        protected static int ALL = 4;
         protected static int TAG_CHECK_ERROR  = 1250;
         protected static int TAG_CHECK_WARN   = 1260;
@@ -915,29 +914,27 @@
                 else
                     tag = n.startsWith("/") ? getPattern(n) : n;
-                noMatch = m.group(2).equals("!=");
-                n = m.group(3).trim();
-                if(n.equals("*"))
-                    valueAll = true;
-                else if(n.equals("BOOLEAN_TRUE"))
-                {
-                    valueBool = true;
-                    value = OsmUtils.trueval;
-                }
-                else if(n.equals("BOOLEAN_FALSE"))
-                {
-                    valueBool = true;
-                    value = OsmUtils.falseval;
-                }
-                else
-                    value = n.startsWith("/") ? getPattern(n) : n;
-            }
-            public boolean match(OsmPrimitive osm)
-            {
-                for(Entry<String, String> prop: osm.getKeys().entrySet())
-                {
+                    noMatch = m.group(2).equals("!=");
+                    n = m.group(3).trim();
+                    if(n.equals("*"))
+                        valueAll = true;
+                    else if(n.equals("BOOLEAN_TRUE"))
+                    {
+                        valueBool = true;
+                        value = OsmUtils.trueval;
+                    }
+                    else if(n.equals("BOOLEAN_FALSE"))
+                    {
+                        valueBool = true;
+                        value = OsmUtils.falseval;
+                    }
+                    else
+                        value = n.startsWith("/") ? getPattern(n) : n;
+            }
+            public boolean match(OsmPrimitive osm, Map<String, String> keys) {
+                for(Entry<String, String> prop: keys.entrySet()) {
                     String key = prop.getKey();
                     String val = valueBool ? OsmUtils.getNamedOsmBoolean(prop.getValue()) : prop.getValue();
                     if((tagAll || (tag instanceof Pattern ? ((Pattern)tag).matcher(key).matches() : key.equals(tag)))
-                    && (valueAll || (value instanceof Pattern ? ((Pattern)value).matcher(val).matches() : val.equals(value))))
+                            && (valueAll || (value instanceof Pattern ? ((Pattern)value).matcher(val).matches() : val.equals(value))))
                         return !noMatch;
                 }
@@ -962,13 +959,16 @@
             String[] n = str.split(" *: *", 3);
             if(n[0].equals("way"))
-                type = WAY;
+                type = OsmPrimitiveType.WAY;
             else if(n[0].equals("node"))
-                type = NODE;
+                type = OsmPrimitiveType.NODE;
             else if(n[0].equals("relation"))
-                type = RELATION;
+                type = OsmPrimitiveType.RELATION;
             else if(n[0].equals("*"))
-                type = ALL;
-            if(type == 0 || n.length != 3)
+                type = null;
+            else
                 return tr("Could not find element type");
+            if (n.length != 3)
+                return tr("Incorrect number of parameters");
+
             if(n[1].equals("W"))
             {
@@ -1005,12 +1005,11 @@
             return null;
         }
-        public boolean match(OsmPrimitive osm)
-        {
-            if(osm.getKeys() == null || (type == NODE && !(osm instanceof Node))
-            || (type == RELATION && !(osm instanceof Relation)) || (type == WAY && !(osm instanceof Way)))
+        public boolean match(OsmPrimitive osm, Map<String, String> keys)
+        {
+            if (type != null && OsmPrimitiveType.from(osm) != type)
                 return false;
-            for(CheckerElement ce : data)
-            {
-                if(!ce.match(osm))
+
+            for(CheckerElement ce : data) {
+                if(!ce.match(osm, keys))
                     return false;
             }
@@ -1029,7 +1028,11 @@
             return severity;
         }
-        public int getCode()
-        {
-            return code + type;
+
+        public int getCode() {
+            if (type == null) {
+                return code;
+            } else {
+                return code + type.ordinal() + 1;
+            }
         }
     }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/AgregatePrimitivesVisitor.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/AgregatePrimitivesVisitor.java	(revision 20154)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/AgregatePrimitivesVisitor.java	(revision 20155)
@@ -2,5 +2,5 @@
 
 import java.util.Collection;
-import java.util.LinkedList;
+import java.util.HashSet;
 
 import org.openstreetmap.josm.data.osm.Node;
@@ -21,13 +21,5 @@
 {
     /** Aggregated data */
-    Collection<OsmPrimitive> aggregatedData;
-
-    /**
-     * Constructor
-     */
-    public AgregatePrimitivesVisitor()
-    {
-        aggregatedData = new LinkedList<OsmPrimitive>();
-    }
+    final Collection<OsmPrimitive> aggregatedData = new HashSet<OsmPrimitive>();
 
     /**
