Index: applications/editors/josm/plugins/utilsplugin2/build.xml
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/build.xml	(revision 30388)
+++ applications/editors/josm/plugins/utilsplugin2/build.xml	(revision 30389)
@@ -3,5 +3,5 @@
 
     <!-- enter the SVN commit message -->
-    <property name="commit.message" value="[josm_utilsplugin2]: usedinways/usedinrealtions; multitagger: center on double-click"/>
+    <property name="commit.message" value="[josm_utilsplugin2]: search parents:/children:; multitagger: select, sync"/>
     <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
     <property name="plugin.main.version" value="6317"/>
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 30388)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTagDialog.java	(revision 30389)
@@ -30,5 +30,4 @@
 import javax.swing.KeyStroke;
 import javax.swing.ListSelectionModel;
-import javax.swing.SwingUtilities;
 import javax.swing.event.ListSelectionEvent;
 import javax.swing.event.ListSelectionListener;
@@ -40,12 +39,9 @@
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
-import org.openstreetmap.josm.data.preferences.StringProperty;
 import org.openstreetmap.josm.gui.ExtendedDialog;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.gui.tagging.TagCellEditor;
 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField;
 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionList;
 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager;
-import org.openstreetmap.josm.gui.util.GuiHelper;
 import org.openstreetmap.josm.gui.util.HighlightHelper;
 import org.openstreetmap.josm.gui.util.TableHelper;
@@ -88,5 +84,15 @@
         pnl.add(cbTagSet,GBC.std().fill(GBC.HORIZONTAL));
         pnl.add(new JButton(new DeleteFromHistoryAction()),GBC.std());
-        pnl.add(new JButton(new FindMatchingAction()),GBC.eol());
+        pnl.add(new JButton(new FindMatchingAction()),GBC.std());
+        final JToggleButton jt = new JToggleButton("", ImageProvider.get("restart"), true);
+        jt.setToolTipText(tr("Sync with JOSM selection"));
+        jt.addActionListener(new ActionListener(){
+            @Override public void actionPerformed(ActionEvent e) {
+                tableModel.setWatchSelection(jt.isSelected());
+            };
+        });
+        pnl.add(jt,GBC.eol());
+        
+
         pnl.add(createTypeFilterPanel(), GBC.eol().fill(GBC.HORIZONTAL));
         pnl.add(tbl.getTableHeader(),GBC.eop().fill(GBC.HORIZONTAL));
@@ -103,11 +109,11 @@
     private JTable createTable() {
         JTable t = new JTable(tableModel);
+        tableModel.setTable(t);
         t.setFillsViewportHeight(true);
-        t.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+        t.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
         t.addMouseListener(tableMouseAdapter);
         t.setRowSelectionAllowed(true);
         t.setColumnSelectionAllowed(true);
         t.setDefaultRenderer(OsmPrimitiveType.class, new PrimitiveTypeIconRenderer());
-        t.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
         t.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
         t.getSelectionModel().addListSelectionListener(selectionListener);
@@ -216,4 +222,10 @@
                     AutoScaleAction.zoomTo(currentSelection);
                 }
+            }
+        });
+        menu.add(new AbstractAction(tr("Select"), ImageProvider.get("dialogs", "select")) {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                Main.main.getCurrentDataSet().setSelected(getSelectedPrimitives());
             }
         });
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTaggerTableModel.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTaggerTableModel.java	(revision 30388)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTaggerTableModel.java	(revision 30389)
@@ -10,5 +10,7 @@
 import java.util.List;
 import java.util.Set;
+import javax.swing.JTable;
 import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableCellEditor;
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.command.ChangePropertyCommand;
@@ -32,4 +34,6 @@
     private boolean autoCommit = true;
     List<Command> cmds = new ArrayList<Command>();
+    private boolean watchSelection = true;
+    private JTable table;
 
     public MultiTaggerTableModel() {
@@ -47,4 +51,9 @@
     }
 
+    public void setWatchSelection(boolean watchSelection) {
+        this.watchSelection = watchSelection;
+        if (watchSelection && Main.main.hasEditLayer()) selectionChanged(Main.main.getCurrentDataSet().getSelected());
+    }
+    
     @Override
     public Object getValueAt(int rowIndex, int columnIndex) {
@@ -86,5 +95,6 @@
     @Override
     public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
-        updateData(newSelection);
+        if (watchSelection)
+            updateData(newSelection);
     }
 
@@ -164,5 +174,7 @@
 
     void updateData(Collection<? extends OsmPrimitive> sel) {
-        list.clear();
+       if (table.isEditing()) table.getCellEditor().stopCellEditing();
+       
+       list.clear();
         for (OsmPrimitive p : sel) {
             if (shownTypes.contains(p.getDisplayType())) {
@@ -181,3 +193,7 @@
         cmds.clear();
     }
+
+    void setTable(JTable t) {
+        table = t;
+    }
 }
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ChildrenMatch.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ChildrenMatch.java	(revision 30389)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ChildrenMatch.java	(revision 30389)
@@ -0,0 +1,35 @@
+
+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;
+import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.data.osm.Way;
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+/**
+ * Matches objects with a number of child primitives in the given range.
+ */
+public class ChildrenMatch extends RangeMatch {
+    public ChildrenMatch(PushbackTokenizer.Range range) {super(range);}
+    public ChildrenMatch(PushbackTokenizer tokenizer) throws SearchCompiler.ParseError {
+        this(tokenizer.readRange(tr("Range of child primitives count")));
+    }
+
+    @Override 
+    protected Long getNumber(OsmPrimitive osm) {
+        if (osm instanceof Way) {
+            return (long) ((Way)osm).getNodesCount();
+        } else if (osm instanceof Relation) {
+            return (long) ((Relation)osm).getMembersCount();
+        } else {
+            return null;
+        }
+    }
+
+    @Override 
+    protected String getString() {
+        return "children";
+    }
+}
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ParentsMatch.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ParentsMatch.java	(revision 30389)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ParentsMatch.java	(revision 30389)
@@ -0,0 +1,25 @@
+
+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;
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+/**
+ * Matches objects with a number of parent primitives in the given range.
+ */
+public class ParentsMatch extends RangeMatch {
+    public ParentsMatch(PushbackTokenizer.Range range) {super(range);}
+    public ParentsMatch(PushbackTokenizer tokenizer) throws SearchCompiler.ParseError {
+        this(tokenizer.readRange(tr("Range of parent primitives count")));
+    }
+    @Override 
+    protected Long getNumber(OsmPrimitive osm) {
+        return new Long(osm.getReferrers().size());
+    }
+    @Override 
+    protected String getString() {
+        return "parents";
+    }
+}
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 30388)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UsedInRelationsMatch.java	(revision 30389)
@@ -30,10 +30,12 @@
     RelationCounter counter = new RelationCounter();
 
-    @Override protected Long getNumber(OsmPrimitive osm) {
+    @Override 
+    protected Long getNumber(OsmPrimitive osm) {
         counter.count=0;
         osm.visitReferrers(counter);
         return new Long(counter.count);
     }
-    @Override protected String getString() {
+    @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 30388)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UsedInWaysMatch.java	(revision 30389)
@@ -13,10 +13,10 @@
 
 /**
- * Matches objects with a version number in the given range.
+ * Matches nodes that are attached to given range of ways
  */
 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")));
+        this(tokenizer.readRange(tr("Range of attached ways count")));
     }
     private class WayCounter implements Visitor {
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 30388)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UtilsSimpleMatchFactory.java	(revision 30389)
@@ -9,5 +9,5 @@
 public class UtilsSimpleMatchFactory implements SimpleMatchFactory {
     
-    private static Collection<String> keywords = Arrays.asList("usedinways", "usedinrelations");
+    private static Collection<String> keywords = Arrays.asList("usedinways", "usedinrelations", "parents", "children");
 
     @Override
@@ -24,4 +24,10 @@
             return new UsedInRelationsMatch(tokenizer);
         } else 
+        if ("parents".equals(keyword)) {
+            return new ParentsMatch(tokenizer);
+        } else
+        if ("children".equals(keyword)) {
+            return new ChildrenMatch(tokenizer);
+        } else
             return null; 
     };
