Index: src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
===================================================================
--- src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java	(revision 1351)
+++ src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java	(working copy)
@@ -127,13 +127,12 @@
      * @param row The row of the table from which the value is edited.
      */
     void propertyEdit(int row) {
+        Collection<OsmPrimitive> sel = Main.ds.getSelected();
+        if (sel.isEmpty()) return;
+
         String key = propertyData.getValueAt(row, 0).toString();
         objKey=key;
-        Collection<OsmPrimitive> sel = Main.ds.getSelected();
-        if (sel.isEmpty()) {
-            JOptionPane.showMessageDialog(Main.parent, tr("Please select the objects you want to change properties for."));
-            return;
-        }
+
         String msg = "<html>"+trn("This will change up to {0} object.", "This will change up to {0} objects.", sel.size(), sel.size())+"<br><br>("+tr("An empty value deletes the key.", key)+")</html>";
 
         JPanel panel = new JPanel(new BorderLayout());
@@ -303,10 +302,7 @@
      */
     void add() {
         Collection<OsmPrimitive> sel = Main.ds.getSelected();
-        if (sel.isEmpty()) {
-            JOptionPane.showMessageDialog(Main.parent, tr("Please select objects for which you want to change properties."));
-            return;
-        }
+        if (sel.isEmpty()) return;
 
         JPanel p = new JPanel(new BorderLayout());
         p.add(new JLabel("<html>"+trn("This will change up to {0} object.","This will change up to {0} objects.", sel.size(),sel.size())+"<br><br>"+tr("Please select a key")),
@@ -401,7 +397,7 @@
         Main.main.undoRedo.add(new ChangePropertyCommand(sel, key, null));
         Main.ds.fireSelectionChanged(sel);
         selectionChanged(sel); // update table
-          
+
         int rowCount = propertyTable.getRowCount();
         propertyTable.changeSelection((row < rowCount ? row : (rowCount-1)), 0, false, false);
     }
@@ -438,7 +434,15 @@
 
     public JComboBox taggingPresets = new JComboBox();
 
+    /**
+     * The Add/Edit/Delete buttons (needed to be able to disable them)
+     */
+    private final SideButton btnAdd;
+    private final SideButton btnEdit;
+    private final SideButton btnDel;
 
+    private final JLabel selectSth = new JLabel(tr("Please select the objects you want to change properties for."));
+
     /**
      * Create a new PropertiesDialog
      */
@@ -547,6 +551,7 @@
         // combine both tables and wrap them in a scrollPane
         JPanel bothTables = new JPanel();
         bothTables.setLayout(new GridBagLayout());
+        bothTables.add(selectSth, GBC.eol().fill().insets(10, 10, 10, 10));
         bothTables.add(propertyTable.getTableHeader(), GBC.eol().fill(GBC.HORIZONTAL));
         bothTables.add(propertyTable, GBC.eol().fill(GBC.BOTH));
         bothTables.add(membershipTable.getTableHeader(), GBC.eol().fill(GBC.HORIZONTAL));
@@ -600,37 +605,33 @@
                 else
                 {
                     int sel = propertyTable.getSelectedRow();
-                    if (e.getActionCommand().equals("Edit")) {
-                        if(propertyTable.getRowCount() == 1)
-                            sel = 0;
-                        if (sel == -1)
-                            JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to edit."));
-                        else
-                            propertyEdit(sel);
-                    } else if (e.getActionCommand().equals("Delete")) {
-                        if (sel == -1)
-                            JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to delete."));
-                        else
-                            delete(sel);
-                    }
+                    // Although we might edit/delete the wrong tag here, chances are still better
+                    // than just displaying an error message (which always "fails").
+                    if (e.getActionCommand().equals("Edit"))
+                        propertyEdit(sel >= 0 ? sel : 0);
+                    else if (e.getActionCommand().equals("Delete"))
+                        delete(sel >= 0 ? sel : 0);
                 }
             }
         };
 
         Shortcut s = Shortcut.registerShortcut("properties:add", tr("Add Properties"), KeyEvent.VK_B,
         Shortcut.GROUP_MNEMONIC);
-        buttonPanel.add(new SideButton(marktr("Add"),"add","Properties",
-                tr("Add a new key/value pair to all objects"), s, buttonAction));
+        this.btnAdd = new SideButton(marktr("Add"),"add","Properties",
+                tr("Add a new key/value pair to all objects"), s, buttonAction);
+        buttonPanel.add(this.btnAdd);
 
         s = Shortcut.registerShortcut("properties:edit", tr("Edit Properties"), KeyEvent.VK_I,
         Shortcut.GROUP_MNEMONIC);
-        buttonPanel.add(new SideButton(marktr("Edit"),"edit","Properties",
-                tr("Edit the value of the selected key for all objects"), s, buttonAction));
+        this.btnEdit = new SideButton(marktr("Edit"),"edit","Properties",
+                tr("Edit the value of the selected key for all objects"), s, buttonAction);
+        buttonPanel.add(this.btnEdit);
 
         s = Shortcut.registerShortcut("properties:delete", tr("Delete Properties"), KeyEvent.VK_Q,
         Shortcut.GROUP_MNEMONIC);
-        buttonPanel.add(new SideButton(marktr("Delete"),"delete","Properties",
-                tr("Delete the selected key in all objects"), s, buttonAction));
+        this.btnDel = new SideButton(marktr("Delete"),"delete","Properties",
+                tr("Delete the selected key in all objects"), s, buttonAction);
+        buttonPanel.add(this.btnDel);
         add(buttonPanel, BorderLayout.SOUTH);
 
         DataSet.selListeners.add(this);
@@ -651,7 +652,6 @@
             propertyTable.getCellEditor().cancelCellEditing();
 
         // re-load property data
-
         propertyData.setRowCount(0);
 
         Map<String, Integer> keyCount = new HashMap<String, Integer>();
@@ -680,6 +680,16 @@
             propertyData.addRow(new Object[]{e.getKey(), e.getValue()});
         }
 
+        boolean hasTags = !newSelection.isEmpty() && propertyData.getRowCount() > 0;
+        boolean hasSelection = !newSelection.isEmpty();
+        btnAdd.setEnabled(hasSelection);
+        btnEdit.setEnabled(hasTags);
+        btnDel.setEnabled(hasTags);
+        propertyTable.setVisible(hasSelection);
+        propertyTable.getTableHeader().setVisible(hasSelection);
+        selectSth.setVisible(!hasSelection);
+        if(hasTags) propertyTable.changeSelection(0, 0, false, false);
+
         // re-load membership data
         // this is rather expensive since we have to walk through all members of all existing relationships.
         // could use back references here for speed if necessary.
@@ -707,9 +717,10 @@
         }
 
         membershipTable.getTableHeader().setVisible(membershipData.getRowCount() > 0);
+        membershipTable.setVisible(membershipData.getRowCount() > 0);
 
         if(propertyData.getRowCount() != 0 || membershipData.getRowCount() != 0) {
-            setTitle(tr("Properties: {0} / Memberships: {1}", 
+            setTitle(tr("Properties: {0} / Memberships: {1}",
                 propertyData.getRowCount(), membershipData.getRowCount()), true);
         } else {
             setTitle(tr("Properties / Memberships"), false);
