Index: trunk/src/org/openstreetmap/josm/actions/AbstractInfoAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/AbstractInfoAction.java	(revision 2020)
+++ trunk/src/org/openstreetmap/josm/actions/AbstractInfoAction.java	(revision 2025)
@@ -52,5 +52,5 @@
         Iterator<OsmPrimitive> it = primitivesToShow.iterator();
         while(it.hasNext()) {
-            if (it.next().id == 0) {
+            if (it.next().getId() == 0) {
                 it.remove();
             }
Index: trunk/src/org/openstreetmap/josm/actions/ApiPreconditionChecker.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/ApiPreconditionChecker.java	(revision 2020)
+++ trunk/src/org/openstreetmap/josm/actions/ApiPreconditionChecker.java	(revision 2025)
@@ -1,3 +1,2 @@
-// License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.actions;
 
@@ -71,5 +70,5 @@
             for (Entry<String,String> e : osmPrimitive.entrySet()) {
                 if(e.getValue().length() > 255) {
-                    if (osmPrimitive.deleted) {
+                    if (osmPrimitive.isDeleted()) {
                         // if OsmPrimitive is going to be deleted we automatically shorten the
                         // value
@@ -77,5 +76,5 @@
                                 tr("Warning: automatically truncating value of tag ''{0}'' on deleted primitive {1}",
                                         e.getKey(),
-                                        Long.toString(osmPrimitive.id)
+                                        Long.toString(osmPrimitive.getId())
                                 )
                         );
@@ -85,5 +84,5 @@
                     JOptionPane.showMessageDialog(Main.parent,
                             tr("Length of value for tag ''{0}'' on primitive {1} exceeds the max. allowed length {2}. Values length is {3}.",
-                                    e.getKey(), Long.toString(osmPrimitive.id), 255, e.getValue().length()
+                                    e.getKey(), Long.toString(osmPrimitive.getId()), 255, e.getValue().length()
                             ),
                             tr("Precondition Violation"),
@@ -103,5 +102,5 @@
                         tr("{0} nodes in way {1} exceed the max. allowed number of nodes {2}",
                                 ((Way)osmPrimitive).getNodesCount(),
-                                Long.toString(osmPrimitive.id),
+                                Long.toString(osmPrimitive.getId()),
                                 maxNodes
                         ),
Index: trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java	(revision 2020)
+++ trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java	(revision 2025)
@@ -90,5 +90,5 @@
         HashSet<Relation> relationsUsingWays = new HashSet<Relation>();
         for (Relation r : getCurrentDataSet().relations) {
-            if (r.deleted || r.incomplete) {
+            if (r.isDeleted() || r.incomplete) {
                 continue;
             }
@@ -177,5 +177,5 @@
         for (Way w : selectedWays) {
             modifyWay = w;
-            if (w.id != 0) {
+            if (w.getId() != 0) {
                 break;
             }
Index: trunk/src/org/openstreetmap/josm/actions/ExitAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/ExitAction.java	(revision 2020)
+++ trunk/src/org/openstreetmap/josm/actions/ExitAction.java	(revision 2025)
@@ -21,9 +21,9 @@
     public ExitAction() {
         super(tr("Exit"), "exit", tr("Exit the application."),
-        Shortcut.registerShortcut("system:menuexit", tr("Exit"), KeyEvent.VK_Q, Shortcut.GROUP_MENU), true);
+                Shortcut.registerShortcut("system:menuexit", tr("Exit"), KeyEvent.VK_Q, Shortcut.GROUP_MENU), true);
     }
 
     public void actionPerformed(ActionEvent e) {
-        if (!Main.breakBecauseUnsavedChanges()) {
+        if (Main.saveUnsavedModifications()) {
             Main.saveGuiGeometry();
             System.exit(0);
Index: trunk/src/org/openstreetmap/josm/actions/HistoryInfoAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/HistoryInfoAction.java	(revision 2020)
+++ trunk/src/org/openstreetmap/josm/actions/HistoryInfoAction.java	(revision 2025)
@@ -21,5 +21,5 @@
     @Override
     protected  String createInfoUrl(OsmPrimitive primitive) {
-        return getBaseURL() + "/" + OsmPrimitiveType.from(primitive).getAPIName() + "/" + primitive.id + "/history";
+        return getBaseURL() + "/" + OsmPrimitiveType.from(primitive).getAPIName() + "/" + primitive.getId() + "/history";
     }
 }
Index: trunk/src/org/openstreetmap/josm/actions/InfoAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/InfoAction.java	(revision 2020)
+++ trunk/src/org/openstreetmap/josm/actions/InfoAction.java	(revision 2025)
@@ -21,5 +21,5 @@
     @Override
     protected  String createInfoUrl(OsmPrimitive primitive) {
-        return getBaseURL() + "/" + OsmPrimitiveType.from(primitive).getAPIName() + "/" + primitive.id;
+        return getBaseURL() + "/" + OsmPrimitiveType.from(primitive).getAPIName() + "/" + primitive.getId();
     }
 }
Index: trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java	(revision 2020)
+++ trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java	(revision 2025)
@@ -95,5 +95,5 @@
         Node useNode = null;
         for (Node n: selectedNodes) {
-            if (n.id > 0) {
+            if (n.getId() > 0) {
                 useNode = n;
                 break;
@@ -127,5 +127,5 @@
         HashSet<Relation> relationsUsingNodes = new HashSet<Relation>();
         for (Relation r : getCurrentDataSet().relations) {
-            if (r.deleted || r.incomplete) {
+            if (r.isDeleted() || r.incomplete) {
                 continue;
             }
@@ -217,5 +217,5 @@
 
         for (Way w : getCurrentDataSet().ways) {
-            if (w.deleted || w.incomplete || w.getNodesCount() < 1) {
+            if (w.isDeleted() || w.incomplete || w.getNodesCount() < 1) {
                 continue;
             }
Index: trunk/src/org/openstreetmap/josm/actions/PasteTagsAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/PasteTagsAction.java	(revision 2020)
+++ trunk/src/org/openstreetmap/josm/actions/PasteTagsAction.java	(revision 2025)
@@ -126,5 +126,5 @@
     protected Map<OsmPrimitiveType, Integer> getSourceStatistics() {
         HashMap<OsmPrimitiveType, Integer> ret = new HashMap<OsmPrimitiveType, Integer>();
-        for (Class type: new Class[] {Node.class, Way.class, Relation.class}) {
+        for (Class<? extends OsmPrimitive> type: new Class[] {Node.class, Way.class, Relation.class}) {
             if (!getSourceTagsByType(type).isEmpty()) {
                 ret.put(OsmPrimitiveType.from(type), getSourcePrimitivesByType(type).size());
@@ -136,5 +136,5 @@
     protected Map<OsmPrimitiveType, Integer> getTargetStatistics() {
         HashMap<OsmPrimitiveType, Integer> ret = new HashMap<OsmPrimitiveType, Integer>();
-        for (Class type: new Class[] {Node.class, Way.class, Relation.class}) {
+        for (Class<? extends OsmPrimitive> type: new Class[] {Node.class, Way.class, Relation.class}) {
             int count = getSubcollectionByType(getEditLayer().data.getSelected(), type).size();
             if (count > 0) {
@@ -156,10 +156,8 @@
     protected void pasteFromHomogeneousSource(Collection<? extends OsmPrimitive> targets) {
         TagCollection tc = null;
-        Class sourceType = null;
-        for (Class type : new Class[] {Node.class, Way.class, Relation.class}) {
+        for (Class<? extends OsmPrimitive> type : new Class[] {Node.class, Way.class, Relation.class}) {
             TagCollection tc1 = getSourceTagsByType(type);
             if (!tc1.isEmpty()) {
                 tc = tc1;
-                sourceType = type;
             }
         }
Index: trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java	(revision 2020)
+++ trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java	(revision 2025)
@@ -72,4 +72,7 @@
             layer.setName(file.getName());
             layer.setAssociatedFile(file);
+            if (layer instanceof OsmDataLayer) {
+                ((OsmDataLayer) layer).onPostSaveToFile();
+            }
             Main.parent.repaint();
         } catch (IOException e) {
@@ -88,23 +91,4 @@
      */
     public boolean checkSaveConditions(Layer layer) {
-        if (layer == null) {
-            JOptionPane.showMessageDialog(
-                    Main.parent,
-                    tr("Internal Error: cannot check conditions for no layer. Please report this as a bug."),
-                    tr("Error"),
-                    JOptionPane.ERROR_MESSAGE
-            );
-            return false;
-        }
-        if (Main.map == null) {
-            JOptionPane.showMessageDialog(
-                    Main.parent,
-                    tr("No document open so nothing to save."),
-                    tr("Warning"),
-                    JOptionPane.WARNING_MESSAGE
-            );
-            return false;
-        }
-
         if (layer instanceof OsmDataLayer && isDataSetEmpty((OsmDataLayer)layer) && 1 != new ExtendedDialog(Main.parent, tr("Empty document"), tr("The document contains no data."), new String[] {tr("Save anyway"), tr("Cancel")}, new String[] {"save.png", "cancel.png"}).getValue())
             return false;
@@ -144,5 +128,5 @@
     private boolean isDataSetEmpty(OsmDataLayer layer) {
         for (OsmPrimitive osm : layer.data.allNonDeletedPrimitives())
-            if (!osm.deleted || osm.id > 0)
+            if (!osm.isDeleted() || osm.getId() > 0)
                 return false;
         return true;
Index: trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java	(revision 2020)
+++ trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java	(revision 2025)
@@ -102,5 +102,5 @@
             for (Node n : selectedNodes) {
                 for (Way w : getCurrentDataSet().ways) {
-                    if (w.deleted || w.incomplete) {
+                    if (w.isDeleted() || w.incomplete) {
                         continue;
                     }
@@ -293,5 +293,5 @@
 
         for (Relation r : getCurrentDataSet().relations) {
-            if (r.deleted || r.incomplete) {
+            if (r.isDeleted() || r.incomplete) {
                 continue;
             }
Index: trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java	(revision 2020)
+++ trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java	(revision 2025)
@@ -66,5 +66,5 @@
             int count = 0;
             for (Way w : getCurrentDataSet().ways) {
-                if (w.deleted || w.incomplete || w.getNodesCount() < 1) {
+                if (w.isDeleted() || w.incomplete || w.getNodesCount() < 1) {
                     continue;
                 }
@@ -91,5 +91,5 @@
                 int count = 0;
                 for (Way w : getCurrentDataSet().ways) {
-                    if (w.deleted || w.incomplete || w.getNodesCount() < 1) {
+                    if (w.isDeleted() || w.incomplete || w.getNodesCount() < 1) {
                         continue;
                     }
@@ -321,5 +321,5 @@
         HashSet<String> rolesToReAdd = null;
         for (Relation r : getCurrentDataSet().relations) {
-            if (r.deleted || r.incomplete) {
+            if (r.isDeleted() || r.incomplete) {
                 continue;
             }
@@ -368,5 +368,5 @@
             // modify all ways containing the nodes
             for (Way w : getCurrentDataSet().ways) {
-                if (w.deleted || w.incomplete || w.getNodesCount() < 1) {
+                if (w.isDeleted() || w.incomplete || w.getNodesCount() < 1) {
                     continue;
                 }
Index: trunk/src/org/openstreetmap/josm/actions/UpdateDataAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/UpdateDataAction.java	(revision 2020)
+++ trunk/src/org/openstreetmap/josm/actions/UpdateDataAction.java	(revision 2025)
@@ -79,5 +79,5 @@
             // bounds defined? => use the bbox downloader
             //
-            new DownloadOsmTaskList().download(false, areas, new PleaseWaitProgressMonitor());
+            new DownloadOsmTaskList().download(false, areas, new PleaseWaitProgressMonitor(tr("Updating data")));
         }
     }
Index: trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java	(revision 2020)
+++ trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java	(revision 2025)
@@ -166,10 +166,10 @@
         protected void initMultiFetchReaderWithNodes(MultiFetchServerObjectReader reader) {
             for (OsmPrimitive primitive : toUpdate) {
-                if (primitive instanceof Node && primitive.id > 0) {
+                if (primitive instanceof Node && primitive.getId() > 0) {
                     reader.append((Node)primitive);
                 } else if (primitive instanceof Way) {
                     Way way = (Way)primitive;
                     for (Node node: way.getNodes()) {
-                        if (node.id > 0) {
+                        if (node.getId() > 0) {
                             reader.append(node);
                         }
@@ -181,5 +181,5 @@
         protected void initMultiFetchReaderWithWays(MultiFetchServerObjectReader reader) {
             for (OsmPrimitive primitive : toUpdate) {
-                if (primitive instanceof Way && primitive.id > 0) {
+                if (primitive instanceof Way && primitive.getId() > 0) {
                     reader.append((Way)primitive);
                 }
@@ -189,5 +189,5 @@
         protected void initMultiFetchReaderWithRelations(MultiFetchServerObjectReader reader) {
             for (OsmPrimitive primitive : toUpdate) {
-                if (primitive instanceof Relation && primitive.id > 0) {
+                if (primitive instanceof Relation && primitive.getId() > 0) {
                     reader.append((Relation)primitive);
                 }
Index: trunk/src/org/openstreetmap/josm/actions/UploadAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/UploadAction.java	(revision 2020)
+++ trunk/src/org/openstreetmap/josm/actions/UploadAction.java	(revision 2025)
@@ -26,4 +26,5 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.APIDataSet;
 import org.openstreetmap.josm.data.conflict.ConflictCollection;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -34,4 +35,5 @@
 import org.openstreetmap.josm.gui.PleaseWaitRunnable;
 import org.openstreetmap.josm.gui.historycombobox.SuggestingJHistoryComboBox;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
 import org.openstreetmap.josm.io.OsmApi;
@@ -108,4 +110,29 @@
     }
 
+    public boolean checkPreUploadConditions(OsmDataLayer layer) {
+        return checkPreUploadConditions(layer, new APIDataSet(layer.data));
+    }
+
+    public boolean checkPreUploadConditions(OsmDataLayer layer, APIDataSet apiData) {
+        ConflictCollection conflicts = layer.getConflicts();
+        if (conflicts !=null && !conflicts.isEmpty()) {
+            JOptionPane.showMessageDialog(
+                    Main.parent,
+                    tr("<html>There are unresolved conflicts in layer ''{0}''.<br>"
+                            + "You have to resolve them first.<html>", layer.getName()),
+                            tr("Warning"),
+                            JOptionPane.WARNING_MESSAGE
+            );
+            return false;
+        }
+        // Call all upload hooks in sequence. The upload confirmation dialog
+        // is one of these.
+        for(UploadHook hook : uploadHooks)
+            if(!hook.checkUpload(apiData.getPrimitivesToAdd(), apiData.getPrimitivesToUpdate(), apiData.getPrimitivesToDelete()))
+                return false;
+
+        return true;
+    }
+
     public void actionPerformed(ActionEvent e) {
         if (!isEnabled())
@@ -121,54 +148,17 @@
         }
 
-        ConflictCollection conflicts = Main.map.mapView.getEditLayer().getConflicts();
-        if (conflicts !=null && !conflicts.isEmpty()) {
-            JOptionPane.showMessageDialog(
-                    Main.parent,
-                    tr("There are unresolved conflicts. You have to resolve these first."),
-                    tr("Warning"),
-                    JOptionPane.WARNING_MESSAGE
-            );
-            Main.map.conflictDialog.showDialog();
-            return;
-        }
-
-        final LinkedList<OsmPrimitive> add = new LinkedList<OsmPrimitive>();
-        final LinkedList<OsmPrimitive> update = new LinkedList<OsmPrimitive>();
-        final LinkedList<OsmPrimitive> delete = new LinkedList<OsmPrimitive>();
-        for (OsmPrimitive osm : getCurrentDataSet().allPrimitives()) {
-            if (osm.get("josm/ignore") != null) {
-                continue;
-            }
-            if (osm.id == 0 && !osm.deleted) {
-                add.addLast(osm);
-            } else if (osm.modified && !osm.deleted) {
-                update.addLast(osm);
-            } else if (osm.deleted && osm.id != 0) {
-                delete.addFirst(osm);
-            }
-        }
-
-        if (add.isEmpty() && update.isEmpty() && delete.isEmpty()) {
+        APIDataSet apiData = new APIDataSet(Main.main.getCurrentDataSet());
+        if (apiData.isEmpty()) {
             JOptionPane.showMessageDialog(
                     Main.parent,
                     tr("No changes to upload."),
                     tr("Warning"),
-                    JOptionPane.WARNING_MESSAGE
+                    JOptionPane.INFORMATION_MESSAGE
             );
             return;
         }
-
-        // Call all upload hooks in sequence. The upload confirmation dialog
-        // is one of these.
-        for(UploadHook hook : uploadHooks)
-            if(!hook.checkUpload(add, update, delete))
-                return;
-
-        final Collection<OsmPrimitive> all = new LinkedList<OsmPrimitive>();
-        all.addAll(add);
-        all.addAll(update);
-        all.addAll(delete);
-
-        Main.worker.execute(new UploadDiffTask(all));
+        if (!checkPreUploadConditions(Main.map.mapView.getEditLayer(), apiData))
+            return;
+        Main.worker.execute(createUploadTask(Main.map.mapView.getEditLayer(), apiData.getPrimitives()));
     }
 
@@ -235,11 +225,11 @@
         );
         switch(ret) {
-        case JOptionPane.CLOSED_OPTION: return;
-        case JOptionPane.CANCEL_OPTION: return;
-        case 0: synchronizePrimitive(id); break;
-        case 1: synchronizeDataSet(); break;
-        default:
-            // should not happen
-            throw new IllegalStateException(tr("unexpected return value. Got {0}", ret));
+            case JOptionPane.CLOSED_OPTION: return;
+            case JOptionPane.CANCEL_OPTION: return;
+            case 0: synchronizePrimitive(id); break;
+            case 1: synchronizeDataSet(); break;
+            default:
+                // should not happen
+                throw new IllegalStateException(tr("unexpected return value. Got {0}", ret));
         }
     }
@@ -275,10 +265,10 @@
         );
         switch(ret) {
-        case JOptionPane.CLOSED_OPTION: return;
-        case 1: return;
-        case 0: synchronizeDataSet(); break;
-        default:
-            // should not happen
-            throw new IllegalStateException(tr("unexpected return value. Got {0}", ret));
+            case JOptionPane.CLOSED_OPTION: return;
+            case 1: return;
+            case 0: synchronizeDataSet(); break;
+            default:
+                // should not happen
+                throw new IllegalStateException(tr("unexpected return value. Got {0}", ret));
         }
     }
@@ -522,14 +512,19 @@
     }
 
-
-    class UploadDiffTask extends  PleaseWaitRunnable {
+    public UploadDiffTask createUploadTask(OsmDataLayer layer, Collection<OsmPrimitive> toUpload) {
+        return new UploadDiffTask(layer, toUpload);
+    }
+
+    public class UploadDiffTask extends  PleaseWaitRunnable {
         private boolean uploadCancelled = false;
         private Exception lastException = null;
         private Collection <OsmPrimitive> toUpload;
         private OsmServerWriter writer;
-
-        public UploadDiffTask(Collection <OsmPrimitive> toUpload) {
-            super(tr("Uploading"),false /* don't ignore exceptions */);
+        private OsmDataLayer layer;
+
+        private UploadDiffTask(OsmDataLayer layer, Collection <OsmPrimitive> toUpload) {
+            super(tr("Uploading data for layer ''{0}''", layer.getName()),false /* don't ignore exceptions */);
             this.toUpload = toUpload;
+            this.layer = layer;
         }
 
@@ -537,5 +532,6 @@
             writer = new OsmServerWriter();
             try {
-                writer.uploadOsm(getCurrentDataSet().version, toUpload, progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false));
+                ProgressMonitor monitor = progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false);
+                writer.uploadOsm(layer.data.version, toUpload, monitor);
             } catch (Exception sxe) {
                 if (uploadCancelled) {
@@ -554,9 +550,11 @@
             // partially uploaded
             //
-            getEditLayer().cleanupAfterUpload(writer.getProcessedPrimitives());
-            DataSet.fireSelectionChanged(getEditLayer().data.getSelected());
-            getEditLayer().fireDataChange();
+            layer.cleanupAfterUpload(writer.getProcessedPrimitives());
+            DataSet.fireSelectionChanged(layer.data.getSelected());
+            layer.fireDataChange();
             if (lastException != null) {
                 handleFailedUpload(lastException);
+            } else {
+                layer.onPostUploadToServer();
             }
         }
@@ -568,4 +566,16 @@
             }
         }
+
+        public boolean isSuccessful() {
+            return !isCancelled() && !isFailed();
+        }
+
+        public boolean isCancelled() {
+            return uploadCancelled;
+        }
+
+        public boolean isFailed() {
+            return lastException != null;
+        }
     }
 }
Index: trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java	(revision 2020)
+++ trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java	(revision 2025)
@@ -765,5 +765,5 @@
         Way way = null;
         for (Way w : getCurrentDataSet().ways) {
-            if (w.deleted || w.incomplete || w.getNodesCount() < 1) {
+            if (w.isDeleted() || w.incomplete || w.getNodesCount() < 1) {
                 continue;
             }
Index: trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java	(revision 2020)
+++ trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java	(revision 2025)
@@ -227,42 +227,42 @@
 
             switch (mode) {
-            case NONE:
-                return false;
-            case MISSING_KEY:
-                return osm.get(key) == null;
-            case ANY:
-                return true;
-            case ANY_VALUE:
-                return osm.get(key) != null;
-            case ANY_KEY:
-                for (String v:osm.getKeys().values()) {
-                    if (v.equals(value))
-                        return true;
-                }
-                return false;
-            case EXACT:
-                return value.equals(osm.get(key));
-            case ANY_KEY_REGEXP:
-                for (String v:osm.getKeys().values()) {
-                    if (valuePattern.matcher(v).matches())
-                        return true;
-                }
-                return false;
-            case ANY_VALUE_REGEXP:
-            case EXACT_REGEXP:
-                for (Entry<String, String> entry:osm.entrySet()) {
-                    if (keyPattern.matcher(entry.getKey()).matches()) {
-                        if (mode == Mode.ANY_VALUE_REGEXP
-                                || valuePattern.matcher(entry.getValue()).matches())
+                case NONE:
+                    return false;
+                case MISSING_KEY:
+                    return osm.get(key) == null;
+                case ANY:
+                    return true;
+                case ANY_VALUE:
+                    return osm.get(key) != null;
+                case ANY_KEY:
+                    for (String v:osm.getKeys().values()) {
+                        if (v.equals(value))
                             return true;
                     }
-                }
-                return false;
-            case MISSING_KEY_REGEXP:
-                for (String k:osm.keySet()) {
-                    if (keyPattern.matcher(k).matches())
-                        return false;
-                }
-                return true;
+                    return false;
+                case EXACT:
+                    return value.equals(osm.get(key));
+                case ANY_KEY_REGEXP:
+                    for (String v:osm.getKeys().values()) {
+                        if (valuePattern.matcher(v).matches())
+                            return true;
+                    }
+                    return false;
+                case ANY_VALUE_REGEXP:
+                case EXACT_REGEXP:
+                    for (Entry<String, String> entry:osm.entrySet()) {
+                        if (keyPattern.matcher(entry.getKey()).matches()) {
+                            if (mode == Mode.ANY_VALUE_REGEXP
+                                    || valuePattern.matcher(entry.getValue()).matches())
+                                return true;
+                        }
+                    }
+                    return false;
+                case MISSING_KEY_REGEXP:
+                    for (String k:osm.keySet()) {
+                        if (keyPattern.matcher(k).matches())
+                            return false;
+                    }
+                    return true;
             }
             throw new AssertionError("Missed state");
@@ -402,5 +402,5 @@
     private static class Modified extends Match {
         @Override public boolean match(OsmPrimitive osm) {
-            return osm.modified || osm.id == 0;
+            return osm.isModified() || osm.getId() == 0;
         }
         @Override public String toString() {return "modified";}
Index: trunk/src/org/openstreetmap/josm/actions/search/SelectionWebsiteLoader.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/search/SelectionWebsiteLoader.java	(revision 2020)
+++ trunk/src/org/openstreetmap/josm/actions/search/SelectionWebsiteLoader.java	(revision 2025)
@@ -48,5 +48,5 @@
             Map<Long, String> ids = idReader.parseIds(in);
             for (OsmPrimitive osm : Main.main.getCurrentDataSet().allNonDeletedPrimitives()) {
-                if (ids.containsKey(osm.id) && osm.getClass().getName().toLowerCase().endsWith(ids.get(osm.id))) {
+                if (ids.containsKey(osm.getId()) && osm.getClass().getName().toLowerCase().endsWith(ids.get(osm.getId()))) {
                     if (mode == SearchAction.SearchMode.remove) {
                         sel.remove(osm);
