Index: applications/editors/josm/plugins/piclayer/build.xml
===================================================================
--- applications/editors/josm/plugins/piclayer/build.xml	(revision 22548)
+++ applications/editors/josm/plugins/piclayer/build.xml	(revision 22549)
@@ -24,5 +24,5 @@
 
 	<property name="commit.message" value="Changed the constructor signature of the plugin main class" />
-	<property name="plugin.main.version" value="2830" />
+	<property name="plugin.main.version" value="3408" />
 
 	<!--
@@ -138,8 +138,8 @@
 
 	<!--
-		 ************************** Publishing the plugin *********************************** 
-		-->
-	<!--
-		** extracts the JOSM release for the JOSM version in ../core and saves it in the 
+		 ************************** Publishing the plugin ***********************************
+		-->
+	<!--
+		** extracts the JOSM release for the JOSM version in ../core and saves it in the
 		** property ${coreversion.info.entry.revision}
 		**
@@ -190,15 +190,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/piclayer/src/org/openstreetmap/josm/plugins/piclayer/NewLayerFromClipboardAction.java
===================================================================
--- applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/NewLayerFromClipboardAction.java	(revision 22548)
+++ applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/NewLayerFromClipboardAction.java	(revision 22549)
@@ -51,5 +51,5 @@
 		// Add layer only if successfully initialized
 		try {
-			layer.Initialize();
+			layer.initialize();
 		}
 		catch (IOException e) {
Index: applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/NewLayerFromFileAction.java
===================================================================
--- applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/NewLayerFromFileAction.java	(revision 22548)
+++ applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/NewLayerFromFileAction.java	(revision 22549)
@@ -91,5 +91,5 @@
 			// Add layer only if successfully initialized
 			try {
-				layer.Initialize();
+				layer.initialize();
 			}
 			catch (IOException e) {
Index: applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerAbstract.java
===================================================================
--- applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerAbstract.java	(revision 22548)
+++ applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerAbstract.java	(revision 22549)
@@ -29,13 +29,15 @@
 import java.awt.Image;
 import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
 import java.awt.image.BufferedImage;
 import java.io.IOException;
+import java.util.List;
 import java.util.Properties;
 
+import javax.swing.AbstractAction;
+import javax.swing.Action;
 import javax.swing.Icon;
 import javax.swing.ImageIcon;
 import javax.swing.JMenu;
-import javax.swing.JMenuItem;
-import javax.swing.JSeparator;
 
 import org.openstreetmap.josm.Main;
@@ -69,6 +71,4 @@
     // The scale that was set on the map during image creation
     private double m_initial_scale = 0;
-    // Popup menu items
-    private Component m_popupmenu[] = null;
     // Layer icon
     private Icon m_layericon = null;
@@ -93,20 +93,4 @@
         m_counter++;
 
-        // Create popup menu
-        // Reset submenu
-        JMenu reset_submenu = new JMenu(tr("Reset"));
-        reset_submenu.add( new ResetPictureAllAction( this ) );
-        reset_submenu.addSeparator();
-        reset_submenu.add( new ResetPicturePositionAction( this ) );
-        reset_submenu.add( new ResetPictureAngleAction( this ) );
-        reset_submenu.add( new ResetPictureScaleAction( this ) );
-        // Main menu
-        m_popupmenu = new Component[]{
-                reset_submenu,
-                new JSeparator(),
-                new JMenuItem( new SavePictureCalibrationAction(this)),
-                new JMenuItem( new LoadPictureCalibrationAction(this)),
-        };
-
         // Load layer icon
         m_layericon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(PicLayerAbstract.class.getResource("/images/layericon.png")));
@@ -117,5 +101,5 @@
      * initial parameters. Throws exception if something fails.
      */
-    public void Initialize() throws IOException {
+    public void initialize() throws IOException {
 
         // Create image
@@ -165,6 +149,12 @@
 
     @Override
-    public Component[] getMenuEntries() {
-        return m_popupmenu;
+    public Action[] getMenuEntries() {
+        // Main menu
+        return new Action[] {
+                new ResetSubmenuAction(),
+                SeparatorLayerAction.INSTANCE,
+                new SavePictureCalibrationAction(this),
+                new LoadPictureCalibrationAction(this),
+        };
     }
 
@@ -189,5 +179,5 @@
     public void paint(Graphics2D g2, MapView mv, Bounds bounds) {
 
-        if ( m_image != null && g2 instanceof Graphics2D) {
+        if ( m_image != null) {
 
             // Position image at the right graphical place
@@ -320,3 +310,28 @@
             Main.map.mapView.repaint();
     }
+
+    private class ResetSubmenuAction extends AbstractAction implements LayerAction {
+
+    	public ResetSubmenuAction() {
+    		super(tr("Reset"));
+		}
+
+		public void actionPerformed(ActionEvent e) {
+		}
+
+		public Component createMenuComponent() {
+			JMenu reset_submenu = new JMenu(this);
+	        reset_submenu.add( new ResetPictureAllAction( PicLayerAbstract.this ) );
+	        reset_submenu.addSeparator();
+	        reset_submenu.add( new ResetPicturePositionAction( PicLayerAbstract.this ) );
+	        reset_submenu.add( new ResetPictureAngleAction( PicLayerAbstract.this ) );
+	        reset_submenu.add( new ResetPictureScaleAction( PicLayerAbstract.this ) );
+	        return reset_submenu;
+		}
+
+		public boolean supportLayers(List<Layer> layers) {
+			return layers.size() == 1 && layers.get(0) instanceof PicLayerAbstract;
+		}
+
+    }
 }
Index: applications/editors/josm/plugins/routes/build.xml
===================================================================
--- applications/editors/josm/plugins/routes/build.xml	(revision 22548)
+++ applications/editors/josm/plugins/routes/build.xml	(revision 22549)
@@ -28,5 +28,5 @@
 
 	<property name="commit.message" value="Changed the constructor signature of the plugin main class" />
-	<property name="plugin.main.version" value="3116" />
+	<property name="plugin.main.version" value="3408" />
 
 	<property name="josm"                   location="../../core/dist/josm-custom.jar"/>
Index: applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RouteLayer.java
===================================================================
--- applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RouteLayer.java	(revision 22548)
+++ applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RouteLayer.java	(revision 22549)
@@ -2,5 +2,4 @@
 
 import java.awt.Color;
-import java.awt.Component;
 import java.awt.Graphics2D;
 import java.awt.Stroke;
@@ -8,4 +7,5 @@
 import java.util.List;
 
+import javax.swing.Action;
 import javax.swing.Icon;
 
@@ -73,6 +73,6 @@
 
 	@Override
-	public Component[] getMenuEntries() {
-		return new Component[0];
+	public Action[] getMenuEntries() {
+		return new Action[0];
 	}
 
Index: applications/editors/josm/plugins/routing/build.xml
===================================================================
--- applications/editors/josm/plugins/routing/build.xml	(revision 22548)
+++ applications/editors/josm/plugins/routing/build.xml	(revision 22549)
@@ -18,5 +18,5 @@
 **
 ** To build against the core in ../../core, create a correct manifest and deploy to
-** SVN, 
+** SVN,
 **    set the properties commit.message and plugin.main.version
 ** and run
@@ -28,5 +28,5 @@
 
 	<property name="commit.message" value="Changed the constructor signature of the plugin main class" />
-	<property name="plugin.main.version" value="2830" />
+	<property name="plugin.main.version" value="3408" />
 
 	<!-- Define some properties -->
@@ -106,8 +106,8 @@
 
 	<!--
-		 ************************** Publishing the plugin *********************************** 
-		-->
-	<!--
-		** extracts the JOSM release for the JOSM version in ../core and saves it in the 
+		 ************************** Publishing the plugin ***********************************
+		-->
+	<!--
+		** extracts the JOSM release for the JOSM version in ../core and saves it in the
 		** property ${coreversion.info.entry.revision}
 		**
@@ -158,15 +158,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/routing/src/com/innovant/josm/plugin/routing/RoutingLayer.java
===================================================================
--- applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/RoutingLayer.java	(revision 22548)
+++ applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/RoutingLayer.java	(revision 22549)
@@ -30,5 +30,4 @@
 import java.awt.BasicStroke;
 import java.awt.Color;
-import java.awt.Component;
 import java.awt.Graphics;
 import java.awt.Graphics2D;
@@ -39,7 +38,6 @@
 import java.util.List;
 
+import javax.swing.Action;
 import javax.swing.Icon;
-import javax.swing.JMenuItem;
-import javax.swing.JSeparator;
 
 import org.apache.log4j.Logger;
@@ -182,14 +180,14 @@
      */
     @Override
-    public Component[] getMenuEntries() {
-        Collection<Component> components = new ArrayList<Component>();
-        components.add(new JMenuItem(LayerListDialog.getInstance().createShowHideLayerAction(this)));
+    public Action[] getMenuEntries() {
+        Collection<Action> components = new ArrayList<Action>();
+        components.add(LayerListDialog.getInstance().createShowHideLayerAction());
 //        components.add(new JMenuItem(new LayerListDialog.ShowHideMarkerText(this)));
-        components.add(new JMenuItem(LayerListDialog.getInstance().createDeleteLayerAction(this)));
-        components.add(new JSeparator());
-        components.add(new JMenuItem(new RenameLayerAction(getAssociatedFile(), this)));
-        components.add(new JSeparator());
-        components.add(new JMenuItem(new LayerListPopup.InfoAction(this)));
-        return components.toArray(new Component[0]);
+        components.add(LayerListDialog.getInstance().createDeleteLayerAction());
+        components.add(SeparatorLayerAction.INSTANCE);
+        components.add(new RenameLayerAction(getAssociatedFile(), this));
+        components.add(SeparatorLayerAction.INSTANCE);
+        components.add(new LayerListPopup.InfoAction(this));
+        return components.toArray(new Action[0]);
     }
 
Index: applications/editors/josm/plugins/walkingpapers/build.xml
===================================================================
--- applications/editors/josm/plugins/walkingpapers/build.xml	(revision 22548)
+++ applications/editors/josm/plugins/walkingpapers/build.xml	(revision 22549)
@@ -14,5 +14,5 @@
 **
 ** To build against the core in ../../core, create a correct manifest and deploy to
-** SVN, 
+** SVN,
 **    set the properties commit.message and plugin.main.version
 ** and run
@@ -23,11 +23,11 @@
 <project name="walkingpapers" default="dist" basedir=".">
 
-	<!-- 
-	** update before publishing 
+	<!--
+	** update before publishing
 	-->
 	<property name="commit.message" value="Changed the constructor signature of the plugin main class" />
-	<property name="plugin.main.version" value="2830" />
+	<property name="plugin.main.version" value="3408" />
 
-	
+
 	<property name="josm"                   location="../../core/dist/josm-custom.jar"/>
 	<property name="plugin.dist.dir"        value="../../dist"/>
@@ -87,8 +87,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}
 		**
@@ -139,15 +139,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/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersLayer.java
===================================================================
--- applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersLayer.java	(revision 22548)
+++ applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersLayer.java	(revision 22549)
@@ -4,5 +4,4 @@
 
 import java.awt.Color;
-import java.awt.Component;
 import java.awt.Graphics2D;
 import java.awt.Image;
@@ -14,7 +13,6 @@
 import java.util.TreeSet;
 
+import javax.swing.Action;
 import javax.swing.Icon;
-import javax.swing.JMenuItem;
-import javax.swing.JSeparator;
 
 import org.openstreetmap.josm.Main;
@@ -119,5 +117,5 @@
 	}
 
-	class TileTimeComp implements Comparator<WalkingPapersTile> {
+	static class TileTimeComp implements Comparator<WalkingPapersTile> {
 		public int compare(WalkingPapersTile s1, WalkingPapersTile s2) {
 			long t1 = s1.access_time();
@@ -349,13 +347,13 @@
 
 	@Override
-	public Component[] getMenuEntries() {
-		return new Component[] {
-				new JMenuItem(LayerListDialog.getInstance().createShowHideLayerAction(this)),
-				new JMenuItem(LayerListDialog.getInstance().createDeleteLayerAction(this)),
-				new JSeparator(),
+	public Action[] getMenuEntries() {
+		return new Action[] {
+				LayerListDialog.getInstance().createShowHideLayerAction(),
+				LayerListDialog.getInstance().createDeleteLayerAction(),
+				SeparatorLayerAction.INSTANCE,
 				// color,
 				// new JMenuItem(new RenameLayerAction(associatedFile, this)),
-				new JSeparator(),
-				new JMenuItem(new LayerListPopup.InfoAction(this)) };
+				SeparatorLayerAction.INSTANCE,
+				new LayerListPopup.InfoAction(this) };
 	}
 
