Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/UtilsPlugin2.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/UtilsPlugin2.java	(revision 30370)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/UtilsPlugin2.java	(revision 30384)
@@ -29,4 +29,5 @@
 import org.openstreetmap.josm.plugins.utilsplugin2.multitagger.MultiTagAction;
 import org.openstreetmap.josm.plugins.utilsplugin2.replacegeometry.ReplaceGeometryAction;
+import org.openstreetmap.josm.plugins.utilsplugin2.search.UtilsSimpleMatchFactory;
 import org.openstreetmap.josm.plugins.utilsplugin2.search.UtilsUnaryMatchFactory;
 import org.openstreetmap.josm.plugins.utilsplugin2.selection.AdjacentNodesAction;
@@ -124,4 +125,5 @@
         // register search operators
         SearchCompiler.addMatchFactory(new UtilsUnaryMatchFactory());
+        SearchCompiler.addMatchFactory(new UtilsSimpleMatchFactory());
     }
 
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTagDialog.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTagDialog.java	(revision 30370)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTagDialog.java	(revision 30384)
@@ -67,4 +67,5 @@
     private final HighlightHelper highlightHelper = new HighlightHelper();
     private final HistoryComboBox cbTagSet = new HistoryComboBox();
+    private List<OsmPrimitive> currentSelection;
     
     private static final String HISTORY_KEY = "utilsplugin2.multitaghistory";
@@ -72,6 +73,4 @@
         "highway, name, ${id}, ${length}",
         "name name:en name:ru name:de"};
-    TagCellEditor cellEditor;
-    
     
     public MultiTagDialog() {
@@ -168,6 +167,6 @@
         @Override
         public void mouseClicked(MouseEvent e) {
-            if (e.getButton() == MouseEvent.BUTTON3) {
-                AutoScaleAction.zoomTo(Collections.singletonList(getSelectedPrimitive()));
+            if (e.getClickCount()>1 && Main.isDisplayingMapView()) {
+                AutoScaleAction.zoomTo(currentSelection);
             }
         }
@@ -177,7 +176,7 @@
         @Override
         public void valueChanged(ListSelectionEvent e) {
-            List<OsmPrimitive> prims = getSelectedPrimitives();
-            if (prims != null && Main.isDisplayingMapView() ) {
-                if (highlightHelper.highlightOnly(prims)) {
+            currentSelection = getSelectedPrimitives();
+            if (currentSelection != null && Main.isDisplayingMapView() ) {
+                if (highlightHelper.highlightOnly(currentSelection)) {
                     Main.map.mapView.repaint();
                 }
@@ -211,4 +210,12 @@
     private JPopupMenu createPopupMenu() {
         JPopupMenu menu = new JPopupMenu();
+        menu.add(new AbstractAction(tr("Zoom to objects"), ImageProvider.get("dialogs/autoscale", "selection")) {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                if (Main.isDisplayingMapView()) {
+                    AutoScaleAction.zoomTo(currentSelection);
+                }
+            }
+        });
         menu.add(new AbstractAction(tr("Remove tag"), ImageProvider.get("dialogs", "delete")){
             @Override
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/RangeMatch.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/RangeMatch.java	(revision 30384)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/RangeMatch.java	(revision 30384)
@@ -0,0 +1,42 @@
+package org.openstreetmap.josm.plugins.utilsplugin2.search;
+
+import org.openstreetmap.josm.actions.search.PushbackTokenizer;
+import org.openstreetmap.josm.actions.search.SearchCompiler;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+
+/**
+ * TODO: remove this copied class and make it public in JOSM core
+ */
+public abstract class RangeMatch extends SearchCompiler.Match {
+
+        private final long min;
+        private final long max;
+
+        public RangeMatch(long min, long max) {
+            this.min = Math.min(min, max);
+            this.max = Math.max(min, max);
+        }
+
+        public RangeMatch(PushbackTokenizer.Range range) {
+            this(range.getStart(), range.getEnd());
+        }
+
+        protected abstract Long getNumber(OsmPrimitive osm);
+
+        protected abstract String getString();
+
+        @Override
+        public boolean match(OsmPrimitive osm) {
+            Long num = getNumber(osm);
+            if (num == null)
+                return false;
+            else
+                return (num >= min) && (num <= max);
+        }
+
+        @Override
+        public String toString() {
+            return getString() + "=" + min + "-" + max;
+        }
+    }
+
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UsedInRelationsMatch.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UsedInRelationsMatch.java	(revision 30384)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UsedInRelationsMatch.java	(revision 30384)
@@ -0,0 +1,40 @@
+
+package org.openstreetmap.josm.plugins.utilsplugin2.search;
+
+import org.openstreetmap.josm.actions.search.PushbackTokenizer;
+import org.openstreetmap.josm.actions.search.SearchCompiler;
+import org.openstreetmap.josm.data.osm.Changeset;
+import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.data.osm.visitor.Visitor;
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+/**
+ * Matches primitives used in specied number of relations
+ */
+public class UsedInRelationsMatch extends RangeMatch {
+    public UsedInRelationsMatch(PushbackTokenizer.Range range) {super(range);}
+    public UsedInRelationsMatch(PushbackTokenizer tokenizer) throws SearchCompiler.ParseError {
+        this(tokenizer.readRange(tr("Range of referencing relation count")));
+    }
+    private class RelationCounter implements Visitor {
+        int count;
+        @Override
+        public void visit(Way w) {  }
+        @Override   public void visit(Node n) { }
+        @Override   public void visit(Relation r) { count++;  }
+        @Override   public void visit(Changeset cs) {   }
+    }
+    RelationCounter counter = new RelationCounter();
+
+    @Override protected Long getNumber(OsmPrimitive osm) {
+        counter.count=0;
+        osm.visitReferrers(counter);
+        return new Long(counter.count);
+    }
+    @Override protected String getString() {
+        return "usedinrelations";
+    }
+}
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UsedInWaysMatch.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UsedInWaysMatch.java	(revision 30384)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UsedInWaysMatch.java	(revision 30384)
@@ -0,0 +1,42 @@
+
+package org.openstreetmap.josm.plugins.utilsplugin2.search;
+
+import org.openstreetmap.josm.actions.search.PushbackTokenizer;
+import org.openstreetmap.josm.actions.search.SearchCompiler;
+import org.openstreetmap.josm.data.osm.Changeset;
+import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.data.osm.visitor.Visitor;
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+/**
+ * Matches objects with a version number in the given range.
+ */
+public class UsedInWaysMatch extends RangeMatch {
+    public UsedInWaysMatch(PushbackTokenizer.Range range) {super(range);}
+    public UsedInWaysMatch(PushbackTokenizer tokenizer) throws SearchCompiler.ParseError {
+        this(tokenizer.readRange(tr("Range of attached way cuunt")));
+    }
+    private class WayCounter implements Visitor {
+        int count;
+        @Override
+        public void visit(Way w) { count++; }
+        @Override   public void visit(Node n) { }
+        @Override   public void visit(Relation r) {   }
+        @Override   public void visit(Changeset cs) {   }
+    }
+    WayCounter counter = new WayCounter();
+
+@Override protected Long getNumber(OsmPrimitive osm) {
+        if (osm instanceof Node) {
+            counter.count=0;
+            osm.visitReferrers(counter);
+            return new Long(counter.count);
+        } else return null;
+    }
+    @Override protected String getString() {
+        return "wayrefs";
+    }
+}
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UtilsSimpleMatchFactory.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UtilsSimpleMatchFactory.java	(revision 30384)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UtilsSimpleMatchFactory.java	(revision 30384)
@@ -0,0 +1,29 @@
+package org.openstreetmap.josm.plugins.utilsplugin2.search;
+
+import java.util.Arrays;
+import java.util.Collection;
+import org.openstreetmap.josm.actions.search.PushbackTokenizer;
+import org.openstreetmap.josm.actions.search.SearchCompiler;
+import org.openstreetmap.josm.actions.search.SearchCompiler.SimpleMatchFactory;
+
+public class UtilsSimpleMatchFactory implements SimpleMatchFactory {
+    
+    private static Collection<String> keywords = Arrays.asList("usedinways", "usedinrelations");
+
+    @Override
+    public Collection<String> getKeywords() {
+        return keywords;
+    }
+
+    @Override
+    public SearchCompiler.Match get(String keyword, PushbackTokenizer tokenizer) throws SearchCompiler.ParseError {
+        if ("usedinways".equals(keyword)) {
+            return new UsedInWaysMatch(tokenizer);
+        } else 
+        if ("usedinrelations".equals(keyword)) {
+            return new UsedInRelationsMatch(tokenizer);
+        } else 
+            return null; 
+    };
+    
+}
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UtilsUnaryMatchFactory.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UtilsUnaryMatchFactory.java	(revision 30370)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UtilsUnaryMatchFactory.java	(revision 30384)
@@ -24,5 +24,5 @@
         } else if ("allintersecting".equals(keyword)) {
             return new IntersectingMatch(matchOperand, true);
-        }
+        } 
         return null;
     }
