Index: trunk/src/org/openstreetmap/josm/actions/AddNodeAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/AddNodeAction.java	(revision 1806)
+++ trunk/src/org/openstreetmap/josm/actions/AddNodeAction.java	(revision 1807)
@@ -17,4 +17,6 @@
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.coor.LatLon;
+import org.openstreetmap.josm.gui.layer.Layer;
+import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener;
 import org.openstreetmap.josm.tools.GBC;
 import org.openstreetmap.josm.tools.Shortcut;
@@ -24,13 +26,26 @@
  * and when ok is pressed, a new node is created at the specified position.
  */
-public final class AddNodeAction extends JosmAction {
+public final class AddNodeAction extends JosmAction implements LayerChangeListener {
 
     public AddNodeAction() {
         super(tr("Add Node..."), "addnode", tr("Add a node by entering latitude and longitude."),
-        Shortcut.registerShortcut("addnode", tr("Edit: {0}", tr("Add Node...")), KeyEvent.VK_D, Shortcut.GROUP_EDIT,
-        Shortcut.SHIFT_DEFAULT), true);
+                Shortcut.registerShortcut("addnode", tr("Edit: {0}", tr("Add Node...")), KeyEvent.VK_D, Shortcut.GROUP_EDIT,
+                        Shortcut.SHIFT_DEFAULT), true);
+        Layer.listeners.add(this);
+        refreshEnabled();
+    }
+
+    protected void refreshEnabled() {
+        setEnabled(Main.map != null
+                && Main.map.mapView != null
+                && Main.map.mapView.getEditLayer() != null);
     }
 
     public void actionPerformed(ActionEvent e) {
+        // we abort if we are not in the context of an OsmDataLayer
+        //
+        if (!isEnabled())
+            return;
+
         JPanel p = new JPanel(new GridBagLayout());
         p.add(new JLabel("<html>"+
@@ -56,13 +71,27 @@
             try {
                 LatLon ll = new LatLon(Double.parseDouble(lat.getText()), Double.parseDouble(lon.getText()));
-                if (!ll.isOutSideWorld()) nnew = new Node(ll);
+                if (!ll.isOutSideWorld()) {
+                    nnew = new Node(ll);
+                }
             } catch (Exception ex) { }
         }
 
         /* Now execute the commands to add the dupicated contents of the paste buffer to the map */
-
         Main.main.undoRedo.add(new AddCommand(nnew));
         Main.ds.setSelected(nnew);
         Main.map.mapView.repaint();
     }
+
+    public void activeLayerChange(Layer oldLayer, Layer newLayer) {
+        refreshEnabled();
+    }
+
+    public void layerAdded(Layer newLayer) {
+        refreshEnabled();
+
+    }
+
+    public void layerRemoved(Layer oldLayer) {
+        refreshEnabled();
+    }
 }
