Index: /trunk/src/org/openstreetmap/josm/Main.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/Main.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/Main.java	(revision 6336)
@@ -544,6 +544,5 @@
      */
     public OsmDataLayer getEditLayer() {
-        if (map == null) return null;
-        if (map.mapView == null) return null;
+        if (!isDisplayingMapView()) return null;
         return map.mapView.getEditLayer();
     }
@@ -565,6 +564,5 @@
      */
     public Layer getActiveLayer() {
-        if (map == null) return null;
-        if (map.mapView == null) return null;
+        if (!isDisplayingMapView()) return null;
         return map.mapView.getActiveLayer();
     }
@@ -762,5 +760,5 @@
      */
     public static boolean saveUnsavedModifications() {
-        if (map == null || map.mapView == null) return true;
+        if (!isDisplayingMapView()) return true;
         return saveUnsavedModifications(map.mapView.getLayersOfType(OsmDataLayer.class), true);
     }
Index: /trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java	(revision 6336)
@@ -62,6 +62,5 @@
      */
     public static void zoomToSelection() {
-        if (Main.main == null || Main.main.getEditLayer() == null) return;
-        if (Main.map == null || Main.map.mapView == null) return;
+        if (Main.main == null || !Main.main.hasEditLayer()) return;
         Collection<OsmPrimitive> sel = Main.main.getEditLayer().data.getSelected();
         if (sel.isEmpty()) {
Index: /trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java	(revision 6336)
@@ -67,5 +67,5 @@
     @Override
     public void actionPerformed(ActionEvent e) {
-        if (Main.main.getEditLayer() == null) {
+        if (!Main.main.hasEditLayer()) {
             new Notification(
                     tr("No data loaded."))
Index: /trunk/src/org/openstreetmap/josm/actions/DownloadReferrersAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/DownloadReferrersAction.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/DownloadReferrersAction.java	(revision 6336)
@@ -81,7 +81,7 @@
     @Override
     public void actionPerformed(ActionEvent e) {
-        if (!isEnabled() || ! Main.isDisplayingMapView())
+        if (!isEnabled())
             return;
-        OsmDataLayer layer = Main.map.mapView.getEditLayer();
+        OsmDataLayer layer = Main.main.getEditLayer();
         if (layer == null)
             return;
Index: /trunk/src/org/openstreetmap/josm/actions/InfoAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/InfoAction.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/InfoAction.java	(revision 6336)
@@ -1,3 +1,3 @@
-//License: GPL. Copyright 2007 by Immanuel Scholz and others
+// License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.actions;
 
@@ -17,4 +17,7 @@
 public class InfoAction extends JosmAction {
 
+    /**
+     * Constructs a new {@code InfoAction}.
+     */
     public InfoAction() {
         super(tr("Advanced info"), "about",
@@ -30,5 +33,5 @@
         DataSet set = getCurrentDataSet();
         if (set != null) {
-            new InspectPrimitiveDialog(set.getAllSelected(), Main.map.mapView.getEditLayer()).showDialog();
+            new InspectPrimitiveDialog(set.getAllSelected(), Main.main.getEditLayer()).showDialog();
         }
     }
Index: /trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java	(revision 6336)
@@ -519,5 +519,5 @@
         // Delete the discarded inner ways
         if (!discardedWays.isEmpty()) {
-            Command deleteCmd = DeleteCommand.delete(Main.map.mapView.getEditLayer(), discardedWays, true);
+            Command deleteCmd = DeleteCommand.delete(Main.main.getEditLayer(), discardedWays, true);
             if (deleteCmd != null) {
                 cmds.add(deleteCmd);
@@ -835,5 +835,5 @@
 
         if (chunks.size() > 1) {
-            SplitWayResult split = SplitWayAction.splitWay(Main.map.mapView.getEditLayer(), way, chunks, Collections.<OsmPrimitive>emptyList());
+            SplitWayResult split = SplitWayAction.splitWay(Main.main.getEditLayer(), way, chunks, Collections.<OsmPrimitive>emptyList());
 
             //execute the command, we need the results
Index: /trunk/src/org/openstreetmap/josm/actions/PasteAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/PasteAction.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/PasteAction.java	(revision 6336)
@@ -131,5 +131,5 @@
             if (data instanceof NodeData) {
                 NodeData nodeData = (NodeData)data;
-                if (Main.map.mapView.getEditLayer() == source) {
+                if (Main.main.getEditLayer() == source) {
                     nodeData.setEastNorth(nodeData.getEastNorth().add(offsetEast, offsetNorth));
                 }
Index: /trunk/src/org/openstreetmap/josm/actions/PurgeAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/PurgeAction.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/PurgeAction.java	(revision 6336)
@@ -90,5 +90,5 @@
 
         Collection<OsmPrimitive> sel = getCurrentDataSet().getAllSelected();
-        layer = Main.map.mapView.getEditLayer();
+        layer = Main.main.getEditLayer();
 
         toPurge = new HashSet<OsmPrimitive>(sel);
@@ -209,5 +209,5 @@
         Main.pref.put("purge.clear_undo_redo", cbClearUndoRedo.isSelected());
 
-        Main.main.undoRedo.add(new PurgeCommand(Main.map.mapView.getEditLayer(), toPurgeChecked, makeIncomplete));
+        Main.main.undoRedo.add(new PurgeCommand(Main.main.getEditLayer(), toPurgeChecked, makeIncomplete));
 
         if (cbClearUndoRedo.isSelected()) {
Index: /trunk/src/org/openstreetmap/josm/actions/SimplifyWayAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/SimplifyWayAction.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/SimplifyWayAction.java	(revision 6336)
@@ -48,5 +48,5 @@
 
     protected boolean confirmWayWithNodesOutsideBoundingBox(List<? extends OsmPrimitive> primitives) {
-        return DeleteCommand.checkAndConfirmOutlyingDelete(Main.map.mapView.getEditLayer(), primitives, null);
+        return DeleteCommand.checkAndConfirmOutlyingDelete(Main.main.getEditLayer(), primitives, null);
     }
 
Index: /trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java	(revision 6336)
@@ -40,5 +40,5 @@
         try {
             DataSet ds = reader.parseOsm(NullProgressMonitor.INSTANCE);
-            Main.map.mapView.getEditLayer().mergeFrom(ds);
+            Main.main.getEditLayer().mergeFrom(ds);
         } catch(Exception e) {
             ExceptionDialogUtil.explainException(e);
Index: /trunk/src/org/openstreetmap/josm/actions/UploadAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/UploadAction.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/UploadAction.java	(revision 6336)
@@ -269,5 +269,5 @@
         }
         APIDataSet apiData = new APIDataSet(Main.main.getCurrentDataSet());
-        uploadData(Main.map.mapView.getEditLayer(), apiData);
+        uploadData(Main.main.getEditLayer(), apiData);
     }
 }
Index: /trunk/src/org/openstreetmap/josm/actions/ViewportFollowToggleAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/ViewportFollowToggleAction.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/ViewportFollowToggleAction.java	(revision 6336)
@@ -42,5 +42,5 @@
     @Override
     protected void updateEnabledState() {
-        setEnabled(Main.isDisplayingMapView() && Main.main.getEditLayer() != null);
+        setEnabled(Main.main.hasEditLayer());
     }
 }
Index: /trunk/src/org/openstreetmap/josm/actions/WireframeToggleAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/WireframeToggleAction.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/WireframeToggleAction.java	(revision 6336)
@@ -37,5 +37,5 @@
     @Override
     protected void updateEnabledState() {
-        setEnabled(Main.isDisplayingMapView() && Main.main.getEditLayer() != null);
+        setEnabled(Main.main.hasEditLayer());
     }
 
Index: /trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java	(revision 6336)
@@ -223,5 +223,5 @@
         protected OsmDataLayer getEditLayer() {
             if (!Main.isDisplayingMapView()) return null;
-            return Main.map.mapView.getEditLayer();
+            return Main.main.getEditLayer();
         }
 
Index: /trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java	(revision 6336)
@@ -291,5 +291,5 @@
                 }
             }
-            final OsmDataLayer editLayer = Main.map.mapView.getEditLayer();
+            final OsmDataLayer editLayer = Main.main.getEditLayer();
             if (editLayer != null && osmData) {
                 final Set<OsmPrimitive> myPrimitives = getCompletePrimitives(editLayer.data);
Index: /trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java	(revision 6336)
@@ -283,5 +283,5 @@
     @Override
     public void eventDispatched(AWTEvent event) {
-        if(Main.map == null || Main.map.mapView == null || !Main.map.mapView.isActiveLayerDrawable())
+        if (!Main.isDisplayingMapView() || !Main.map.mapView.isActiveLayerDrawable())
             return;
         if (event instanceof KeyEvent) {
Index: /trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java	(revision 6336)
@@ -156,5 +156,5 @@
         @Override
         public void eventDispatched(AWTEvent e) {
-            if(Main.map == null || Main.map.mapView == null || !Main.map.mapView.isActiveLayerDrawable())
+            if (!Main.isDisplayingMapView() || !Main.map.mapView.isActiveLayerDrawable())
                 return;
             InputEvent ie = (InputEvent) e;
Index: /trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java	(revision 6336)
@@ -323,6 +323,5 @@
     @Override
     public void eventDispatched(AWTEvent event) {
-        if (Main.map == null || Main.map.mapView == null
-                || !Main.map.mapView.isActiveLayerDrawable()) {
+        if (!Main.isDisplayingMapView() || !Main.map.mapView.isActiveLayerDrawable()) {
             return;
         }
Index: /trunk/src/org/openstreetmap/josm/actions/relation/DeleteRelationsAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/relation/DeleteRelationsAction.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/relation/DeleteRelationsAction.java	(revision 6336)
@@ -39,5 +39,5 @@
     @Override
     public void actionPerformed(ActionEvent e) {
-        if (!isEnabled() || Main.main.getEditLayer() == null)
+        if (!isEnabled() || !Main.main.hasEditLayer())
             return;
         for (Relation r : relations) {
Index: /trunk/src/org/openstreetmap/josm/actions/relation/DownloadMembersAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/relation/DownloadMembersAction.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/relation/DownloadMembersAction.java	(revision 6336)
@@ -34,6 +34,6 @@
     @Override
     public void actionPerformed(ActionEvent e) {
-        if (!isEnabled() || relations.isEmpty() || Main.map==null || Main.map.mapView==null) return;
-        Main.worker.submit(new DownloadRelationTask(relations, Main.map.mapView.getEditLayer()));
+        if (!isEnabled() || relations.isEmpty() || !Main.isDisplayingMapView()) return;
+        Main.worker.submit(new DownloadRelationTask(relations, Main.main.getEditLayer()));
     }
 
Index: /trunk/src/org/openstreetmap/josm/actions/relation/DownloadSelectedIncompleteMembersAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/relation/DownloadSelectedIncompleteMembersAction.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/relation/DownloadSelectedIncompleteMembersAction.java	(revision 6336)
@@ -47,9 +47,9 @@
     @Override
     public void actionPerformed(ActionEvent e) {
-        if (!isEnabled() || relations.isEmpty() || Main.map==null || Main.map.mapView==null) return;
+        if (!isEnabled() || relations.isEmpty() || !Main.isDisplayingMapView()) return;
         Main.worker.submit(new DownloadRelationMemberTask(
                 relations,
                 buildSetOfIncompleteMembers(relations),
-                Main.map.mapView.getEditLayer()));
+                Main.main.getEditLayer()));
     }
 
Index: /trunk/src/org/openstreetmap/josm/actions/relation/EditRelationAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/relation/EditRelationAction.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/relation/EditRelationAction.java	(revision 6336)
@@ -40,5 +40,5 @@
         Set<RelationMember> members = new HashSet<RelationMember>();
         if (Main.isDisplayingMapView()) {
-            OsmDataLayer editLayer = Main.map.mapView.getEditLayer();
+            OsmDataLayer editLayer = Main.main.getEditLayer();
             if (editLayer != null && editLayer.data != null) {
                 Collection<OsmPrimitive> selection = editLayer.data.getSelected();
@@ -58,6 +58,6 @@
      */
     public static void launchEditor(Relation toEdit) {
-        if (toEdit == null || Main.map==null || Main.map.mapView==null) return;
-        RelationEditor.getEditor(Main.map.mapView.getEditLayer(), toEdit,
+        if (toEdit == null || !Main.isDisplayingMapView()) return;
+        RelationEditor.getEditor(Main.main.getEditLayer(), toEdit,
                 getMembersForCurrentSelection(toEdit)).setVisible(true);
     }
Index: /trunk/src/org/openstreetmap/josm/actions/relation/SelectMembersAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/relation/SelectMembersAction.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/relation/SelectMembersAction.java	(revision 6336)
@@ -34,5 +34,5 @@
     @Override
     public void actionPerformed(ActionEvent e) {
-        if (!isEnabled() || relations.isEmpty() || Main.map==null || Main.map.mapView==null) return;
+        if (!isEnabled() || relations.isEmpty() || !Main.isDisplayingMapView()) return;
         
         HashSet<OsmPrimitive> members = new HashSet<OsmPrimitive>();
@@ -41,7 +41,7 @@
         }
         if (add) {
-            Main.map.mapView.getEditLayer().data.addSelected(members);
+            Main.main.getEditLayer().data.addSelected(members);
         } else {
-            Main.map.mapView.getEditLayer().data.setSelected(members);
+            Main.main.getEditLayer().data.setSelected(members);
         }
     }
Index: /trunk/src/org/openstreetmap/josm/actions/relation/SelectRelationAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/relation/SelectRelationAction.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/relation/SelectRelationAction.java	(revision 6336)
@@ -31,6 +31,6 @@
     @Override
     public void actionPerformed(ActionEvent e) {
-        if (!isEnabled() || relations.isEmpty() || Main.map==null || Main.map.mapView==null) return;
-        OsmDataLayer editLayer = Main.map.mapView.getEditLayer();
+        if (!isEnabled() || relations.isEmpty()) return;
+        OsmDataLayer editLayer = Main.main.getEditLayer();
         if (editLayer==null || editLayer.data==null) return;
         if (add) {
Index: /trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java	(revision 6336)
@@ -1134,5 +1134,5 @@
         @Override
         protected Bounds getBounds() {
-            if (Main.map == null || Main.map.mapView == null) {
+            if (!Main.isDisplayingMapView()) {
                 return null;
             }
@@ -1150,6 +1150,5 @@
     }
 
-    public static Match compile(String searchStr, boolean caseSensitive, boolean regexSearch)
-            throws ParseError {
+    public static Match compile(String searchStr, boolean caseSensitive, boolean regexSearch) throws ParseError {
         return new SearchCompiler(caseSensitive, regexSearch,
                 new PushbackTokenizer(
Index: /trunk/src/org/openstreetmap/josm/command/Command.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/command/Command.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/command/Command.java	(revision 6336)
@@ -86,5 +86,5 @@
      */
     public Command() {
-        this.layer = Main.isDisplayingMapView() ? Main.map.mapView.getEditLayer() : null;
+        this.layer = Main.main.getEditLayer();
     }
 
Index: /trunk/src/org/openstreetmap/josm/command/RelationMemberConflictResolverCommand.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/command/RelationMemberConflictResolverCommand.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/command/RelationMemberConflictResolverCommand.java	(revision 6336)
@@ -68,5 +68,5 @@
 
         // remember the layer
-        layer = Main.map.mapView.getEditLayer();
+        layer = Main.main.getEditLayer();
         return true;
     }
@@ -89,5 +89,5 @@
 
         Main.map.mapView.setActiveLayer(layer);
-        OsmDataLayer editLayer = Main.map.mapView.getEditLayer();
+        OsmDataLayer editLayer = Main.main.getEditLayer();
 
         // restore the former state
Index: /trunk/src/org/openstreetmap/josm/data/osm/history/HistoryDataSet.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/history/HistoryDataSet.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/data/osm/history/HistoryDataSet.java	(revision 6336)
@@ -175,5 +175,5 @@
     @Override
     public void layerRemoved(Layer oldLayer) {
-        if (Main.map == null || Main.map.mapView == null) return;
+        if (!Main.isDisplayingMapView()) return;
         if (Main.map.mapView.getNumLayers() == 0) {
             data.clear();
Index: /trunk/src/org/openstreetmap/josm/data/validation/Test.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/validation/Test.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/data/validation/Test.java	(revision 6336)
@@ -240,5 +240,5 @@
         }
         if (!primitivesToDelete.isEmpty()) {
-            return DeleteCommand.delete(Main.map.mapView.getEditLayer(), primitivesToDelete);
+            return DeleteCommand.delete(Main.main.getEditLayer(), primitivesToDelete);
         } else {
             return null;
Index: /trunk/src/org/openstreetmap/josm/data/validation/tests/Coastlines.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/validation/tests/Coastlines.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/data/validation/tests/Coastlines.java	(revision 6336)
@@ -52,5 +52,5 @@
         super.startTest(monitor);
 
-        OsmDataLayer layer = Main.map.mapView.getEditLayer();
+        OsmDataLayer layer = Main.main.getEditLayer();
 
         if (layer != null) {
Index: /trunk/src/org/openstreetmap/josm/gui/ImageryMenu.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/ImageryMenu.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/gui/ImageryMenu.java	(revision 6336)
@@ -179,5 +179,5 @@
 
     private JMenuItem getNewOffsetMenu(){
-        if (Main.map == null || Main.map.mapView == null) {
+        if (!Main.isDisplayingMapView()) {
             offsetAction.setEnabled(false);
             return singleOffset;
Index: /trunk/src/org/openstreetmap/josm/gui/MainMenu.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/MainMenu.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/gui/MainMenu.java	(revision 6336)
@@ -752,10 +752,7 @@
         /**
          * Refreshes the enabled state
-         *
          */
         protected void refreshEnabled() {
-            presetsMenu.setEnabled(Main.isDisplayingMapView()
-                    && Main.map.mapView.getEditLayer() != null
-            );
+            presetsMenu.setEnabled(Main.main.hasEditLayer());
         }
 
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java	(revision 6336)
@@ -52,4 +52,5 @@
 import org.openstreetmap.josm.gui.help.HelpUtil;
 import org.openstreetmap.josm.gui.io.CloseChangesetTask;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.gui.widgets.ListPopupMenu;
 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher;
@@ -120,8 +121,9 @@
         ChangesetCache.getInstance().addChangesetCacheListener(inActiveDataLayerModel);
         MapView.addEditLayerChangeListener(inActiveDataLayerModel);
-        if (Main.main.getEditLayer() != null) {
-            Main.main.getEditLayer().data.addDataSetListener(inActiveDataLayerModel);
-            inActiveDataLayerModel.initFromDataSet(Main.main.getEditLayer().data);
-            inSelectionModel.initFromPrimitives(Main.main.getEditLayer().data.getAllSelected());
+        OsmDataLayer editLayer = Main.main.getEditLayer();
+        if (editLayer != null) {
+            editLayer.data.addDataSetListener(inActiveDataLayerModel);
+            inActiveDataLayerModel.initFromDataSet(editLayer.data);
+            inSelectionModel.initFromPrimitives(editLayer.data.getAllSelected());
         }
     }
@@ -132,6 +134,7 @@
         ChangesetCache.getInstance().removeChangesetCacheListener(inActiveDataLayerModel);
         MapView.removeEditLayerChangeListener(inActiveDataLayerModel);
-        if (Main.main.getEditLayer() != null) {
-            Main.main.getEditLayer().data.removeDataSetListener(inActiveDataLayerModel);
+        OsmDataLayer editLayer = Main.main.getEditLayer();
+        if (editLayer != null) {
+            editLayer.data.removeDataSetListener(inActiveDataLayerModel);
         }
 
@@ -233,7 +236,8 @@
 
     protected void initWithCurrentData() {
-        if (Main.main.getEditLayer() != null) {
-            inSelectionModel.initFromPrimitives(Main.main.getEditLayer().data.getAllSelected());
-            inActiveDataLayerModel.initFromDataSet(Main.main.getEditLayer().data);
+        OsmDataLayer editLayer = Main.main.getEditLayer();
+        if (editLayer != null) {
+            inSelectionModel.initFromPrimitives(editLayer.data.getAllSelected());
+            inActiveDataLayerModel.initFromDataSet(editLayer.data);
         }
     }
@@ -308,5 +312,5 @@
         @Override
         public void actionPerformed(ActionEvent e) {
-            if (Main.main.getEditLayer() == null)
+            if (!Main.main.hasEditLayer())
                 return;
             ChangesetListModel model = getCurrentChangesetListModel();
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java	(revision 6336)
@@ -243,5 +243,5 @@
     private void buildTrees() {
         setTitle(tr("Command Stack"));
-        if (Main.map == null || Main.map.mapView == null || Main.map.mapView.getEditLayer() == null)
+        if (!Main.main.hasEditLayer())
             return;
 
@@ -317,5 +317,5 @@
     protected static FilteredCollection<OsmPrimitive> getAffectedPrimitives(TreePath path) {
         PseudoCommand c = ((CommandListMutableTreeNode) path.getLastPathComponent()).getCommand();
-        final OsmDataLayer currentLayer = Main.map.mapView.getEditLayer();
+        final OsmDataLayer currentLayer = Main.main.getEditLayer();
         FilteredCollection<OsmPrimitive> prims = new FilteredCollection<OsmPrimitive>(
                 c.getParticipatingPrimitives(),
@@ -359,6 +359,7 @@
                 throw new IllegalStateException();
 
-            if (Main.map == null || Main.map.mapView == null || Main.map.mapView.getEditLayer() == null) return;
-            Main.map.mapView.getEditLayer().data.setSelected( getAffectedPrimitives(path));
+            OsmDataLayer editLayer = Main.main.getEditLayer();
+            if (editLayer == null) return;
+            editLayer.data.setSelected( getAffectedPrimitives(path));
         }
 
@@ -367,10 +368,11 @@
             setEnabled(!undoTree.isSelectionEmpty() || !redoTree.isSelectionEmpty());
         }
-
     }
 
     public class SelectAndZoomAction extends SelectAction {
+        /**
+         * Constructs a new {@code SelectAndZoomAction}.
+         */
         public SelectAndZoomAction() {
-            super();
             putValue(NAME,tr("Select and zoom"));
             putValue(SHORT_DESCRIPTION, tr("Selects the objects that take part in this command (unless currently deleted), then and zooms to it"));
@@ -381,5 +383,5 @@
         public void actionPerformed(ActionEvent e) {
             super.actionPerformed(e);
-            if (Main.map == null || Main.map.mapView == null || Main.map.mapView.getEditLayer() == null) return;
+            if (!Main.main.hasEditLayer()) return;
             AutoScaleAction.autoScale("selection");
         }
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java	(revision 6336)
@@ -680,6 +680,5 @@
 
         protected boolean isActiveLayer(Layer layer) {
-            if (Main.map == null) return false;
-            if (Main.map.mapView == null) return false;
+            if (!Main.isDisplayingMapView()) return false;
             return Main.map.mapView.getActiveLayer() == layer;
         }
@@ -776,6 +775,5 @@
 
         protected boolean isActiveLayer(Layer layer) {
-            if (Main.map == null) return false;
-            if (Main.map.mapView == null) return false;
+            if (!Main.isDisplayingMapView()) return false;
             return Main.map.mapView.getActiveLayer() == layer;
         }
@@ -832,5 +830,5 @@
 
         private void duplicate(Layer layer) {
-            if (Main.map == null || Main.map.mapView == null)
+            if (!Main.isDisplayingMapView())
                 return;
 
@@ -863,5 +861,5 @@
 
         protected boolean isActiveLayer(Layer layer) {
-            if (Main.map == null || Main.map.mapView == null)
+            if (!Main.isDisplayingMapView())
                 return false;
             return Main.map.mapView.getActiveLayer() == layer;
@@ -974,6 +972,5 @@
 
         protected boolean isActiveLayer(Layer layer) {
-            if (Main.map == null) return false;
-            if (Main.map.mapView == null) return false;
+            if (!Main.isDisplayingMapView()) return false;
             return Main.map.mapView.getActiveLayer() == layer;
         }
@@ -1404,5 +1401,5 @@
          */
         public List<Layer> getLayers() {
-            if (Main.map == null || Main.map.mapView == null)
+            if (!Main.isDisplayingMapView())
                 return Collections.<Layer>emptyList();
             return Main.map.mapView.getAllLayersAsList();
@@ -1437,5 +1434,5 @@
          */
         protected Layer getActiveLayer() {
-            if (Main.map == null || Main.map.mapView == null) return null;
+            if (!Main.isDisplayingMapView()) return null;
             return Main.map.mapView.getActiveLayer();
         }
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java	(revision 6336)
@@ -324,5 +324,5 @@
 
         @Override public void mouseClicked(MouseEvent e) {
-            if (Main.main.getEditLayer() == null) return;
+            if (!Main.main.hasEditLayer()) return;
             if (isDoubleClick(e)) {
                 if (e.isControlDown()) {
@@ -357,5 +357,5 @@
 
         protected void updateEnabledState() {
-            setEnabled(Main.main != null && Main.main.getEditLayer() != null);
+            setEnabled(Main.main != null && Main.main.hasEditLayer());
         }
 
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java	(revision 6336)
@@ -168,7 +168,8 @@
         MapView.addEditLayerChangeListener(actSearch);
         // editLayerChanged also gets the selection history of the level
-        model.editLayerChanged(null, Main.map.mapView.getEditLayer());
-        if (Main.map.mapView.getEditLayer() != null) {
-            model.setJOSMSelection(Main.map.mapView.getEditLayer().data.getAllSelected());
+        OsmDataLayer editLayer = Main.main.getEditLayer();
+        model.editLayerChanged(null, editLayer);
+        if (editLayer != null) {
+            model.setJOSMSelection(editLayer.data.getAllSelected());
         }
         actSearch.updateEnabledState();
@@ -285,5 +286,5 @@
 
         public void updateEnabledState() {
-            setEnabled(Main.main != null && Main.main.getEditLayer() != null);
+            setEnabled(Main.main != null && !Main.main.hasEditLayer());
         }
 
@@ -310,6 +311,7 @@
             Collection<OsmPrimitive> sel = model.getSelected();
             if (sel.isEmpty())return;
-            if (Main.map == null || Main.map.mapView == null || Main.map.mapView.getEditLayer() == null) return;
-            Main.map.mapView.getEditLayer().data.setSelected(sel);
+            OsmDataLayer editLayer = Main.main.getEditLayer();
+            if (editLayer == null) return;
+            editLayer.data.setSelected(sel);
         }
 
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanel.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanel.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanel.java	(revision 6336)
@@ -325,5 +325,5 @@
             if (!isEnabled())
                 return;
-            if (Main.main == null || Main.main.getEditLayer() == null) return;
+            if (Main.main == null || !Main.main.hasEditLayer()) return;
             OsmDataLayer layer = Main.main.getEditLayer();
             Set<HistoryOsmPrimitive> selected = model.getSelectedPrimitives();
@@ -343,5 +343,5 @@
 
         public void updateEnabledState() {
-            if (Main.main == null || Main.main.getEditLayer() == null){
+            if (Main.main == null || !Main.main.hasEditLayer()) {
                 setEnabled(false);
                 return;
@@ -390,5 +390,5 @@
             if (!isEnabled())
                 return;
-            if (Main.main == null || Main.main.getEditLayer() == null) return;
+            if (Main.main == null || !Main.main.hasEditLayer()) return;
             OsmDataLayer layer = Main.main.getEditLayer();
             Set<HistoryOsmPrimitive> selected = model.getSelectedPrimitives();
@@ -409,5 +409,5 @@
 
         public void updateEnabledState() {
-            if (Main.main == null || Main.main.getEditLayer() == null){
+            if (Main.main == null || !Main.main.hasEditLayer()) {
                 setEnabled(false);
                 return;
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetDetailPanel.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetDetailPanel.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetDetailPanel.java	(revision 6336)
@@ -386,5 +386,5 @@
             if (!isEnabled())
                 return;
-            if (Main.main == null || Main.main.getEditLayer() == null) return;
+            if (Main.main == null || !Main.main.hasEditLayer()) return;
             OsmDataLayer layer = Main.main.getEditLayer();
             Set<OsmPrimitive> target = new HashSet<OsmPrimitive>();
@@ -402,5 +402,5 @@
 
         public void updateEnabledState() {
-            if (Main.main == null || Main.main.getEditLayer() == null){
+            if (Main.main == null || !Main.main.hasEditLayer()) {
                 setEnabled(false);
                 return;
@@ -447,5 +447,5 @@
             if (!isEnabled())
                 return;
-            if (Main.main == null || Main.main.getEditLayer() == null) return;
+            if (Main.main == null || !Main.main.hasEditLayer()) return;
             OsmDataLayer layer = Main.main.getEditLayer();
             Set<OsmPrimitive> target = new HashSet<OsmPrimitive>();
@@ -464,5 +464,5 @@
 
         public void updateEnabledState() {
-            if (Main.main == null || Main.main.getEditLayer() == null){
+            if (Main.main == null || !Main.main.hasEditLayer()) {
                 setEnabled(false);
                 return;
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/BasicChangesetQueryPanel.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/BasicChangesetQueryPanel.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/BasicChangesetQueryPanel.java	(revision 6336)
@@ -158,5 +158,5 @@
         // map view
         lbl = lblQueries.get(BasicQuery.CHANGESETS_IN_MAP_VIEW);
-        if (Main.map == null || Main.map.mapView == null) {
+        if (!Main.isDisplayingMapView()) {
             rbQueries.get(BasicQuery.CHANGESETS_IN_MAP_VIEW).setEnabled(false);
             lbl.setText(tr("<html>Download changesets in the current map view.<br><em>Disabled. There is currently no map view active.</em></html>"));
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java	(revision 6336)
@@ -484,5 +484,5 @@
         Main.map.relationListDialog.selectRelation(relation);
         RelationEditor.getEditor(
-                Main.map.mapView.getEditLayer(),
+                Main.main.getEditLayer(),
                 relation,
                 ((MemberInfo) membershipData.getValueAt(row, 1)).role).setVisible(true);
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java	(revision 6336)
@@ -655,5 +655,5 @@
      */
     protected boolean isActiveLayer() {
-        if (Main.map == null || Main.map.mapView == null) return false;
+        if (!Main.isDisplayingMapView()) return false;
         return Main.map.mapView.getActiveLayer() == layer;
     }
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/relation/SelectionTableModel.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/relation/SelectionTableModel.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/relation/SelectionTableModel.java	(revision 6336)
@@ -52,5 +52,5 @@
     @Override
     public int getRowCount() {
-        if (Main.map.mapView.getEditLayer() != layer)
+        if (Main.main.getEditLayer() != layer)
             return 0;
         return cache.size();
@@ -89,5 +89,5 @@
     @Override
     public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
-        if (layer == Main.map.mapView.getEditLayer()) {
+        if (layer == Main.main.getEditLayer()) {
             cache.clear();
             cache.addAll(newSelection);
Index: /trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java	(revision 6336)
@@ -104,6 +104,7 @@
         referenceRelationMemberTableModel = new DiffTableModel();
 
-        if (getEditLayer() != null) {
-            getEditLayer().data.addDataSetListener(this);
+        OsmDataLayer editLayer = Main.main.getEditLayer();
+        if (editLayer != null) {
+            editLayer.data.addDataSetListener(this);
         }
         MapView.addLayerChangeListener(this);
@@ -120,18 +121,4 @@
         CheckParameterUtil.ensureParameterNotNull(history, "history");
         setHistory(history);
-    }
-
-    /**
-     * Replies the current edit layer; null, if there isn't a current edit layer
-     * of type {@link OsmDataLayer}.
-     *
-     * @return the current edit layer
-     */
-    protected OsmDataLayer getEditLayer() {
-        try {
-            return Main.map.mapView.getEditLayer();
-        } catch(NullPointerException e) {
-            return null;
-        }
     }
 
@@ -187,6 +174,7 @@
         if (history.getNumVersions() > 0) {
             HistoryOsmPrimitive newLatest = null;
-            if (getEditLayer() != null) {
-                OsmPrimitive p = getEditLayer().data.getPrimitiveById(history.getId(), history.getType());
+            OsmDataLayer editLayer = Main.main.getEditLayer();
+            if (editLayer != null) {
+                OsmPrimitive p = editLayer.data.getPrimitiveById(history.getId(), history.getType());
                 if (canShowAsLatest(p)) {
                     newLatest = new HistoryPrimitiveBuilder().build(p);
@@ -536,6 +524,7 @@
         public OsmPrimitive getLatest() {
             if (latest == null) return null;
-            if (getEditLayer() == null) return null;
-            OsmPrimitive p = getEditLayer().data.getPrimitiveById(latest.getId(), latest.getType());
+            OsmDataLayer editLayer = Main.main.getEditLayer();
+            if (editLayer == null) return null;
+            OsmPrimitive p = editLayer.data.getPrimitiveById(latest.getId(), latest.getType());
             return p;
         }
@@ -674,6 +663,7 @@
      */
     public void unlinkAsListener() {
-        if (getEditLayer() != null) {
-            getEditLayer().data.removeDataSetListener(this);
+        OsmDataLayer editLayer = Main.main.getEditLayer();
+        if (editLayer != null) {
+            editLayer.data.removeDataSetListener(this);
         }
         MapView.removeLayerChangeListener(this);
Index: /trunk/src/org/openstreetmap/josm/gui/history/NodeListViewer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/history/NodeListViewer.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/gui/history/NodeListViewer.java	(revision 6336)
@@ -207,7 +207,10 @@
             if (!isEnabled()) return;
             OsmPrimitive p = getPrimitiveToZoom();
-            if (p!= null) {
-                getEditLayer().data.setSelected(p.getPrimitiveId());
-                AutoScaleAction.autoScale("selection");
+            if (p != null) {
+                OsmDataLayer editLayer = Main.main.getEditLayer();
+                if (editLayer != null) {
+                    editLayer.data.setSelected(p.getPrimitiveId());
+                    AutoScaleAction.autoScale("selection");
+                }
             }
         }
@@ -218,20 +221,14 @@
         }
 
-        protected OsmDataLayer getEditLayer() {
-            try {
-                return Main.map.mapView.getEditLayer();
-            } catch(NullPointerException e) {
-                return null;
-            }
-        }
-
         protected OsmPrimitive getPrimitiveToZoom() {
             if (primitiveId == null) return null;
-            OsmPrimitive p = getEditLayer().data.getPrimitiveById(primitiveId);
+            OsmDataLayer editLayer = Main.main.getEditLayer();
+            if (editLayer == null) return null;
+            OsmPrimitive p = editLayer.data.getPrimitiveById(primitiveId);
             return p;
         }
 
         public void updateEnabledState() {
-            if (getEditLayer() == null) {
+            if (!Main.main.hasEditLayer()) {
                 setEnabled(false);
                 return;
Index: /trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java	(revision 6336)
@@ -73,12 +73,4 @@
     }
 
-    protected OsmDataLayer getEditLayer() {
-        try {
-            return Main.map.mapView.getEditLayer();
-        } catch(NullPointerException e) {
-            return null;
-        }
-    }
-
     protected String getInfoText() {
         HistoryOsmPrimitive primitive = getPrimitive();
@@ -87,7 +79,8 @@
         String text;
         if (model.isLatest(primitive)) {
+            OsmDataLayer editLayer = Main.main.getEditLayer();
             text = tr("<html>Version <strong>{0}</strong> currently edited in layer ''{1}''</html>",
                     Long.toString(primitive.getVersion()),
-                    getEditLayer() == null ? tr("unknown") : getEditLayer().getName()
+                    editLayer == null ? tr("unknown") : editLayer.getName()
                     );
         } else {
Index: /trunk/src/org/openstreetmap/josm/gui/io/AbstractUploadTask.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/io/AbstractUploadTask.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/gui/io/AbstractUploadTask.java	(revision 6336)
@@ -240,5 +240,5 @@
 );
         if (ret == 0) {
-            DownloadReferrersAction.downloadReferrers(Main.map.mapView.getEditLayer(), Arrays.asList(conflict.a));
+            DownloadReferrersAction.downloadReferrers(Main.main.getEditLayer(), Arrays.asList(conflict.a));
         }
     }
Index: /trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java	(revision 6336)
@@ -83,5 +83,5 @@
 
     public double getPPD(){
-        if (Main.map == null || Main.map.mapView == null) return Main.getProjection().getDefaultZoomInPPD();
+        if (!Main.isDisplayingMapView()) return Main.getProjection().getDefaultZoomInPPD();
         ProjectionBounds bounds = Main.map.mapView.getProjectionBounds();
         return Main.map.mapView.getWidth() / (bounds.maxEast - bounds.minEast);
Index: /trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java	(revision 6336)
@@ -439,5 +439,5 @@
      */
     private double getScaleFactor(int zoom) {
-        if (Main.map == null || Main.map.mapView == null) return 1;
+        if (!Main.isDisplayingMapView()) return 1;
         MapView mv = Main.map.mapView;
         LatLon topLeft = mv.getLatLon(0, 0);
Index: /trunk/src/org/openstreetmap/josm/gui/layer/ValidatorLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/ValidatorLayer.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/ValidatorLayer.java	(revision 6336)
@@ -156,5 +156,5 @@
     @Override
     public void layerRemoved(Layer oldLayer) {
-        if (oldLayer instanceof OsmDataLayer && Main.isDisplayingMapView() && Main.map.mapView.getEditLayer() == null) {
+        if (oldLayer instanceof OsmDataLayer && Main.isDisplayingMapView() && !Main.main.hasEditLayer()) {
             Main.main.removeLayer(this);
         } else if (oldLayer == this) {
Index: /trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java	(revision 6336)
@@ -432,5 +432,5 @@
     private static void playAdjacentMarker(Marker startMarker, boolean next) {
         Marker m = null;
-        if (Main.map == null || Main.map.mapView == null)
+        if (!Main.isDisplayingMapView())
             return;
         Layer l = Main.map.mapView.getActiveLayer();
Index: /trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintMenu.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintMenu.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintMenu.java	(revision 6336)
@@ -65,5 +65,5 @@
         @Override
         public void updateEnabledState() {
-            setEnabled(Main.isDisplayingMapView() && (Main.main.getEditLayer() != null || mapHasGpxorMarkerLayer()));
+            setEnabled(Main.isDisplayingMapView() && (Main.main.hasEditLayer() || mapHasGpxorMarkerLayer()));
         }
 
Index: /trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItem.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItem.java	(revision 6335)
+++ /trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItem.java	(revision 6336)
@@ -28,5 +28,5 @@
         }
         AutoCompletionList list = new AutoCompletionList();
-        Main.main.getEditLayer().data.getAutoCompletionManager().populateWithTagValues(list, key);
+        layer.data.getAutoCompletionManager().populateWithTagValues(list, key);
         field.setAutoCompletionList(list);
     }
