Index: /applications/editors/josm/plugins/photo_geotagging/.classpath
===================================================================
--- /applications/editors/josm/plugins/photo_geotagging/.classpath	(revision 22551)
+++ /applications/editors/josm/plugins/photo_geotagging/.classpath	(revision 22551)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
Index: /applications/editors/josm/plugins/photo_geotagging/.project
===================================================================
--- /applications/editors/josm/plugins/photo_geotagging/.project	(revision 22551)
+++ /applications/editors/josm/plugins/photo_geotagging/.project	(revision 22551)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>photo_geotaging</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
Index: /applications/editors/josm/plugins/photo_geotagging/build.xml
===================================================================
--- /applications/editors/josm/plugins/photo_geotagging/build.xml	(revision 22550)
+++ /applications/editors/josm/plugins/photo_geotagging/build.xml	(revision 22551)
@@ -27,5 +27,5 @@
 	<property name="commit.message" value="update to josm latest; only recompile (setCancelButton)" />
 	<!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
-	<property name="plugin.main.version" value="3403" />
+	<property name="plugin.main.version" value="3408" />
 
 
@@ -148,8 +148,8 @@
 
 	<!--
-	************************** Publishing the plugin *********************************** 
+	************************** Publishing the plugin ***********************************
 	-->
 	<!--
-		** extracts the JOSM release for the JOSM version in ../core and saves it in the 
+		** extracts the JOSM release for the JOSM version in ../core and saves it in the
 		** property ${coreversion.info.entry.revision}
 		**
@@ -200,15 +200,15 @@
 
 	<!--
-		** commits the plugin.jar 
+		** commits the plugin.jar
 		-->
 	<target name="commit-dist">
 		<echo>
 	***** Properties of published ${plugin.jar} *****
-	Commit message    : '${commit.message}'					
+	Commit message    : '${commit.message}'
 	Plugin-Mainversion: ${plugin.main.version}
 	JOSM build version: ${coreversion.info.entry.revision}
 	Plugin-Version    : ${version.entry.commit.revision}
-	***** / Properties of published ${plugin.jar} *****					
-						
+	***** / Properties of published ${plugin.jar} *****
+
 	Now commiting ${plugin.jar} ...
 	</echo>
Index: /applications/editors/josm/plugins/photo_geotagging/src/org/openstreetmap/josm/plugins/photo_geotagging/GeotaggingAction.java
===================================================================
--- /applications/editors/josm/plugins/photo_geotagging/src/org/openstreetmap/josm/plugins/photo_geotagging/GeotaggingAction.java	(revision 22550)
+++ /applications/editors/josm/plugins/photo_geotagging/src/org/openstreetmap/josm/plugins/photo_geotagging/GeotaggingAction.java	(revision 22551)
@@ -4,15 +4,16 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 
+import java.awt.Component;
 import java.awt.Dimension;
 import java.awt.GridBagLayout;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
-
+import java.io.File;
 import java.io.IOException;
-import java.io.File;
-
+import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.swing.AbstractAction;
 import javax.swing.BorderFactory;
 import javax.swing.DefaultListModel;
@@ -21,4 +22,5 @@
 import javax.swing.JLabel;
 import javax.swing.JList;
+import javax.swing.JMenuItem;
 import javax.swing.JOptionPane;
 import javax.swing.JPanel;
@@ -27,17 +29,19 @@
 import javax.swing.UIManager;
 
-import java.text.DecimalFormat;
-
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.gui.ExtendedDialog;
 import org.openstreetmap.josm.gui.PleaseWaitRunnable;
+import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
+import org.openstreetmap.josm.gui.layer.Layer;
+import org.openstreetmap.josm.gui.layer.Layer.LayerAction;
 import org.openstreetmap.josm.gui.layer.geoimage.GeoImageLayer;
 import org.openstreetmap.josm.gui.layer.geoimage.ImageEntry;
 import org.openstreetmap.josm.tools.GBC;
+import org.openstreetmap.josm.tools.ImageProvider;
 
 /**
  * The action to aks the user for confirmation and then do the tagging.
  */
-class GeotaggingAction implements ActionListener {
+class GeotaggingAction extends AbstractAction implements LayerAction {
     final static boolean debug = false;
     final static String KEEP_BACKUP = "plugins.photo_geotagging.keep_backup";
@@ -45,10 +49,12 @@
     final static int MTIME_MODE_PREVIOUS_VALUE = 2;
 
-    final private GeoImageLayer layer;
-    public GeotaggingAction(GeoImageLayer layer) {
-        this.layer = layer;
+    public GeotaggingAction() {
+    	super(tr("Write coordinates to image header"), ImageProvider.get("geotagging"));
     }
 
     public void actionPerformed(ActionEvent arg0) {
+
+    	GeoImageLayer layer = getLayer();
+
         final List<ImageEntry> images = new ArrayList<ImageEntry>();
         for (ImageEntry e : layer.getImages()) {
@@ -125,5 +131,5 @@
     }
 
-    class GeoTaggingRunnable extends PleaseWaitRunnable {
+    static class GeoTaggingRunnable extends PleaseWaitRunnable {
         final private List<ImageEntry> images;
         final private boolean keep_backup;
@@ -164,5 +170,5 @@
                         testMTimeReadAndWrite(e.getFile());
                     }
-                    
+
                     Long mTime = null;
                     if (mTimeMode == MTIME_MODE_PREVIOUS_VALUE) {
@@ -281,7 +287,7 @@
             }
         }
-        
+
         boolean testMTimeReadAndWriteDone = false;
-        
+
         private void testMTimeReadAndWrite(File file) throws IOException {
             if (testMTimeReadAndWriteDone)  // do this only once
@@ -308,3 +314,28 @@
         }
     }
+
+    private GeoImageLayer getLayer() {
+    	return (GeoImageLayer)LayerListDialog.getInstance().getModel().getSelectedLayers().get(0);
+    }
+
+    /**
+     * Check if there is any suitable image.
+     */
+    private boolean enabled(GeoImageLayer layer) {
+        for (ImageEntry e : layer.getImages()) {
+            if (e.getPos() != null && e.getGpsTime() != null)
+                return true;
+        }
+        return false;
+    }
+
+	public Component createMenuComponent() {
+        JMenuItem geotaggingItem = new JMenuItem(this);
+        geotaggingItem.setEnabled(enabled(getLayer()));
+        return geotaggingItem;
+	}
+
+	public boolean supportLayers(List<Layer> layers) {
+		return layers.size() == 1 && layers.get(0) instanceof GeoImageLayer;
+	}
 }
Index: /applications/editors/josm/plugins/photo_geotagging/src/org/openstreetmap/josm/plugins/photo_geotagging/GeotaggingPlugin.java
===================================================================
--- /applications/editors/josm/plugins/photo_geotagging/src/org/openstreetmap/josm/plugins/photo_geotagging/GeotaggingPlugin.java	(revision 22550)
+++ /applications/editors/josm/plugins/photo_geotagging/src/org/openstreetmap/josm/plugins/photo_geotagging/GeotaggingPlugin.java	(revision 22551)
@@ -2,16 +2,7 @@
 package org.openstreetmap.josm.plugins.photo_geotagging;
 
-import static org.openstreetmap.josm.tools.I18n.tr;
-
-import java.awt.Component;
-
-import javax.swing.JMenuItem;
-
-import org.openstreetmap.josm.gui.layer.Layer;
 import org.openstreetmap.josm.gui.layer.geoimage.GeoImageLayer;
-import org.openstreetmap.josm.gui.layer.geoimage.ImageEntry;
 import org.openstreetmap.josm.plugins.Plugin;
 import org.openstreetmap.josm.plugins.PluginInformation;
-import org.openstreetmap.josm.tools.ImageProvider;
 
 /**
@@ -27,28 +18,6 @@
     public GeotaggingPlugin(PluginInformation info) {
         super(info);
-        GeoImageLayer.registerMenuAddition(new GeotaggingMenuAddition());
+        GeoImageLayer.registerMenuAddition(new GeotaggingAction());
     }
 
-    /**
-     * Adds a menu entry to the right click menu of each geoimage layer.
-     */
-    class GeotaggingMenuAddition implements GeoImageLayer.LayerMenuAddition {
-        public Component getComponent(Layer layer) {
-            JMenuItem geotaggingItem = new JMenuItem(tr("Write coordinates to image header"), ImageProvider.get("geotagging"));;
-            geotaggingItem.addActionListener(new GeotaggingAction((GeoImageLayer) layer));
-            geotaggingItem.setEnabled(enabled((GeoImageLayer) layer));
-            return geotaggingItem;
-        }
-
-        /**
-         * Check if there is any suitable image.
-         */
-        private boolean enabled(GeoImageLayer layer) {
-            for (ImageEntry e : layer.getImages()) {
-                if (e.getPos() != null && e.getGpsTime() != null)
-                    return true;
-            }
-            return false;
-        }
-    }
 }
