Index: /trunk/src/org/openstreetmap/josm/actions/WireframeToggleAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/WireframeToggleAction.java	(revision 2530)
+++ /trunk/src/org/openstreetmap/josm/actions/WireframeToggleAction.java	(revision 2530)
@@ -0,0 +1,69 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.actions;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.ButtonModel;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.tools.Shortcut;
+
+public class WireframeToggleAction extends JosmAction {
+    private final List<ButtonModel> buttonModels = new ArrayList<ButtonModel>();
+    //FIXME: replace with property Action.SELECTED_KEY when migrating to
+    // Java 6
+    private boolean selected;
+    public WireframeToggleAction() {
+        super(
+                tr("Wireframe View"),
+                null, /* no icon */
+                tr("Enable/disable rendering the map as wireframe only"),
+                Shortcut.registerShortcut("menu:view:wireframe", tr("Toggle Wireframe view"),KeyEvent.VK_W, Shortcut.GROUP_MENU),
+                true /* register shortcut */
+        );
+        selected = Main.pref.getBoolean("draw.wireframe", false);
+        notifySelectedState();
+    }
+
+    public void addButtonModel(ButtonModel model) {
+        if (model != null && !buttonModels.contains(model)) {
+            buttonModels.add(model);
+        }
+    }
+
+    public void removeButtonModel(ButtonModel model) {
+        if (model != null && buttonModels.contains(model)) {
+            buttonModels.remove(model);
+        }
+    }
+
+    protected void notifySelectedState() {
+        for (ButtonModel model: buttonModels) {
+            if (model.isSelected() != selected) {
+                model.setSelected(selected);
+            }
+        }
+    }
+
+    protected void toggleSelectedState() {
+        selected = !selected;
+        Main.pref.put("draw.wireframe", selected);
+        notifySelectedState();
+        if (Main.map != null) {
+            Main.map.mapView.repaint();
+        }
+    }
+    public void actionPerformed(ActionEvent e) {
+        toggleSelectedState();
+    }
+
+    @Override
+    protected void updateEnabledState() {
+        setEnabled(Main.map != null && Main.main.getEditLayer() != null);
+    }
+}
Index: /trunk/src/org/openstreetmap/josm/gui/MainMenu.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/MainMenu.java	(revision 2529)
+++ /trunk/src/org/openstreetmap/josm/gui/MainMenu.java	(revision 2530)
@@ -3,4 +3,5 @@
 package org.openstreetmap.josm.gui;
 
+import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
 import static org.openstreetmap.josm.tools.I18n.marktr;
 import static org.openstreetmap.josm.tools.I18n.tr;
@@ -25,4 +26,5 @@
 import org.openstreetmap.josm.actions.AlignInLineAction;
 import org.openstreetmap.josm.actions.AutoScaleAction;
+import org.openstreetmap.josm.actions.CloseChangesetAction;
 import org.openstreetmap.josm.actions.CombineWayAction;
 import org.openstreetmap.josm.actions.CopyAction;
@@ -58,5 +60,4 @@
 import org.openstreetmap.josm.actions.ShowStatusReportAction;
 import org.openstreetmap.josm.actions.SplitWayAction;
-import org.openstreetmap.josm.actions.CloseChangesetAction;
 import org.openstreetmap.josm.actions.ToggleGPXLinesAction;
 import org.openstreetmap.josm.actions.UnGlueAction;
@@ -67,4 +68,5 @@
 import org.openstreetmap.josm.actions.UploadAction;
 import org.openstreetmap.josm.actions.UploadSelectionAction;
+import org.openstreetmap.josm.actions.WireframeToggleAction;
 import org.openstreetmap.josm.actions.ZoomInAction;
 import org.openstreetmap.josm.actions.ZoomOutAction;
@@ -81,5 +83,4 @@
 import org.openstreetmap.josm.tools.PlatformHookUnixoid;
 import org.openstreetmap.josm.tools.Shortcut;
-import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
 /**
  * This is the JOSM main menu bar. It is overwritten to initialize itself and provide all menu
@@ -237,18 +238,11 @@
         add(editMenu, preferences);
 
-        // TODO move code to an "action" like the others?
-        final JCheckBoxMenuItem wireframe = new JCheckBoxMenuItem(tr("Wireframe View"));
-        wireframe.setSelected(Main.pref.getBoolean("draw.wireframe", false));
-        wireframe.setAccelerator(Shortcut.registerShortcut("menu:view:wireframe", tr("Toggle Wireframe view"),
-                KeyEvent.VK_W, Shortcut.GROUP_MENU).getKeyStroke());
-        wireframe.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent ev) {
-                Main.pref.put("draw.wireframe", wireframe.isSelected());
-                if (Main.map != null) {
-                    Main.map.mapView.repaint();
-                }
-            }
-        });
+        // -- wireframe toggle action
+        WireframeToggleAction wireFrameToggleAction = new WireframeToggleAction();
+        final JCheckBoxMenuItem wireframe = new JCheckBoxMenuItem(wireFrameToggleAction);
         viewMenu.add(wireframe);
+        wireframe.setAccelerator(wireFrameToggleAction.getShortcut().getKeyStroke());
+        wireFrameToggleAction.addButtonModel(wireframe.getModel());
+
         viewMenu.addSeparator();
         add(viewMenu, new ZoomInAction());
