Index: /trunk/src/org/openstreetmap/josm/actions/search/PushbackTokenizer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/search/PushbackTokenizer.java	(revision 2972)
+++ /trunk/src/org/openstreetmap/josm/actions/search/PushbackTokenizer.java	(revision 2973)
@@ -15,4 +15,5 @@
     private Token currentToken;
     private String currentText;
+    private long currentNumber;
     private int c;
 
@@ -25,5 +26,6 @@
         NOT(marktr("<not>")), OR(marktr("<or>")), LEFT_PARENT(marktr("<left parent>")),
         RIGHT_PARENT(marktr("<right parent>")), COLON(marktr("<colon>")), EQUALS(marktr("<equals>")),
-        KEY(marktr("<key>")), QUESTION_MARK(marktr("<question mark>")), EOF(marktr("<end-of-file>"));
+        KEY(marktr("<key>")), QUESTION_MARK(marktr("<question mark>")), NUMBER(marktr("<number>")),
+        EOF(marktr("<end-of-file>"));
 
         private Token(String name) {
@@ -46,4 +48,13 @@
             throw new RuntimeException(e.getMessage(), e);
         }
+    }
+
+    private long getNumber() {
+        long result = 0;
+        while (Character.isDigit(c)) {
+            result = result * 10 + (c - '0');
+            getChar();
+        }
+        return result;
     }
 
@@ -78,5 +89,9 @@
         case '-':
             getChar();
-            return Token.NOT;
+            if (Character.isDigit(c)) {
+                currentNumber = -1 * getNumber();
+                return Token.NUMBER;
+            } else
+                return Token.NOT;
         case '(':
             getChar();
@@ -111,4 +126,9 @@
         default:
         {
+            if (Character.isDigit(c)) {
+                currentNumber = getNumber();
+                return Token.NUMBER;
+            }
+
             StringBuilder s = new StringBuilder();
             while (!(c == -1 || Character.isWhitespace(c) || c == '"'|| c == ':' || c == '(' || c == ')' || c == '|' || c == '=' || c == '?')) {
@@ -149,4 +169,11 @@
     }
 
+    public long readNumber(String errorMessage) throws ParseError {
+        if (nextToken() == Token.NUMBER)
+            return currentNumber;
+        else
+            throw new ParseError(errorMessage);
+    }
+
     public String getText() {
         return currentText;
Index: /trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java	(revision 2972)
+++ /trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java	(revision 2973)
@@ -122,7 +122,9 @@
     private static class Id extends Match {
         private long id;
-        public Id(long id) {this.id = id;}
-        @Override public boolean match(OsmPrimitive osm) {
-            return osm.getId() == id;
+        public Id(long id) {
+            this.id = id;
+        }
+        @Override public boolean match(OsmPrimitive osm) {
+            return osm.getUniqueId() == id;
         }
         @Override public String toString() {return "id="+id;}
@@ -663,5 +665,8 @@
                 return new ExactKeyValue(regexSearch, key, tokenizer.readText());
             else if (tokenizer.readIfEqual(Token.COLON))
-                return parseKV(key, tokenizer.readText());
+                if ("id".equals(key))
+                    return new Id(tokenizer.readNumber(tr("Primitive id expected")));
+                else
+                    return parseKV(key, tokenizer.readText());
             else if (tokenizer.readIfEqual(Token.QUESTION_MARK))
                 return new BooleanMatch(key, false);
@@ -725,10 +730,4 @@
             }
 
-        } else if (key.equals("id")) {
-            try {
-                return new Id(Long.parseLong(value));
-            } catch (NumberFormatException x) {
-                throw new ParseError(tr("Incorrect value of id operator: {0}. Number is expected.", value));
-            }
         } else if (key.equals("changeset")) {
             try {
Index: /trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java	(revision 2972)
+++ /trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java	(revision 2973)
@@ -73,5 +73,5 @@
     /**
      * Decorates the name of primitive with its id, if the preference
-     * <tt>osm-primitives.showid</tt> is set.
+     * <tt>osm-primitives.showid</tt> is set. Shows unique id if osm-primitives.showid.new-primitives is set
      *
      * @param name  the name without the id
@@ -81,5 +81,8 @@
     protected String decorateNameWithId(String name, OsmPrimitive primitive) {
         if (Main.pref.getBoolean("osm-primitives.showid"))
-            return name + tr(" [id: {0}]", primitive.getId());
+            if (Main.pref.getBoolean("osm-primitives.showid.new-primitives"))
+                return name + tr(" [id: {0}]", primitive.getUniqueId());
+            else
+                return name + tr(" [id: {0}]", primitive.getId());
         else
             return name;
