Index: trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java	(revision 10413)
@@ -76,5 +76,5 @@
         if (Main.main == null || !Main.main.hasEditLayer())
             return;
-        Collection<OsmPrimitive> sel = Main.main.getEditLayer().data.getSelected();
+        Collection<OsmPrimitive> sel = Main.getLayerManager().getEditLayer().data.getSelected();
         if (sel.isEmpty()) {
             JOptionPane.showMessageDialog(
@@ -220,5 +220,5 @@
      */
     protected Layer getFirstSelectedLayer() {
-        if (Main.main.getActiveLayer() == null) {
+        if (Main.getLayerManager().getActiveLayer() == null) {
             return null;
         }
Index: trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java	(revision 10413)
@@ -119,10 +119,10 @@
                             if (Main.pref.getBoolean("multipoly.show-relation-editor", false)) {
                                 //Open relation edit window, if set up in preferences
-                                RelationEditor editor = RelationEditor.getEditor(Main.main.getEditLayer(), relation, null);
+                                RelationEditor editor = RelationEditor.getEditor(Main.getLayerManager().getEditLayer(), relation, null);
 
                                 editor.setModal(true);
                                 editor.setVisible(true);
                             } else {
-                                Main.main.getEditLayer().setRecentRelation(relation);
+                                Main.getLayerManager().getEditLayer().setRecentRelation(relation);
                             }
                         }
@@ -165,9 +165,9 @@
         if (multipolygonRelation != null) {
             if (!multipolygonRelation.isNew() && multipolygonRelation.isIncomplete()) {
-                Main.worker.submit(new DownloadRelationTask(Collections.singleton(multipolygonRelation), Main.main.getEditLayer()));
+                Main.worker.submit(new DownloadRelationTask(Collections.singleton(multipolygonRelation), Main.getLayerManager().getEditLayer()));
             } else if (multipolygonRelation.hasIncompleteMembers()) {
                 Main.worker.submit(new DownloadRelationMemberTask(multipolygonRelation,
                         DownloadSelectedIncompleteMembersAction.buildSetOfIncompleteMembers(Collections.singleton(multipolygonRelation)),
-                        Main.main.getEditLayer()));
+                        Main.getLayerManager().getEditLayer()));
             }
         }
Index: trunk/src/org/openstreetmap/josm/actions/DeleteLayerAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/DeleteLayerAction.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/DeleteLayerAction.java	(revision 10413)
@@ -30,5 +30,5 @@
     @Override
     public void actionPerformed(ActionEvent e) {
-        Layer activeLayer = Main.main.getActiveLayer();
+        Layer activeLayer = Main.getLayerManager().getActiveLayer();
         if (activeLayer == null) {
             return;
Index: trunk/src/org/openstreetmap/josm/actions/DownloadReferrersAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/DownloadReferrersAction.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/DownloadReferrersAction.java	(revision 10413)
@@ -52,5 +52,5 @@
         if (!isEnabled())
             return;
-        OsmDataLayer layer = Main.main.getEditLayer();
+        OsmDataLayer layer = Main.getLayerManager().getEditLayer();
         if (layer == null)
             return;
Index: trunk/src/org/openstreetmap/josm/actions/FollowLineAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/FollowLineAction.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/FollowLineAction.java	(revision 10413)
@@ -60,5 +60,5 @@
     @Override
     public void actionPerformed(ActionEvent evt) {
-        OsmDataLayer osmLayer = Main.main.getEditLayer();
+        OsmDataLayer osmLayer = Main.getLayerManager().getEditLayer();
         if (osmLayer == null)
             return;
Index: trunk/src/org/openstreetmap/josm/actions/InfoAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/InfoAction.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/InfoAction.java	(revision 10413)
@@ -37,5 +37,5 @@
         DataSet set = getLayerManager().getEditDataSet();
         if (set != null) {
-            new InspectPrimitiveDialog(set.getAllSelected(), Main.main.getEditLayer()).showDialog();
+            new InspectPrimitiveDialog(set.getAllSelected(), Main.getLayerManager().getEditLayer()).showDialog();
         }
     }
Index: trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java	(revision 10413)
@@ -636,5 +636,5 @@
         // Delete the discarded inner ways
         if (!discardedWays.isEmpty()) {
-            Command deleteCmd = DeleteCommand.delete(Main.main.getEditLayer(), discardedWays, true);
+            Command deleteCmd = DeleteCommand.delete(Main.getLayerManager().getEditLayer(), discardedWays, true);
             if (deleteCmd != null) {
                 cmds.add(deleteCmd);
Index: trunk/src/org/openstreetmap/josm/actions/MergeLayerAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/MergeLayerAction.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/MergeLayerAction.java	(revision 10413)
@@ -115,5 +115,5 @@
 
     protected Layer getSourceLayer() {
-        return Main.map != null ? Main.main.getActiveLayer() : null;
+        return Main.map != null ? Main.getLayerManager().getActiveLayer() : null;
     }
 
Index: trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java	(revision 10413)
@@ -87,8 +87,8 @@
         Node targetNode = selectTargetNode(selectedNodes);
         Node targetLocationNode = selectTargetLocationNode(selectedNodes);
-        Command cmd = mergeNodes(Main.main.getEditLayer(), selectedNodes, targetNode, targetLocationNode);
+        Command cmd = mergeNodes(Main.getLayerManager().getEditLayer(), selectedNodes, targetNode, targetLocationNode);
         if (cmd != null) {
             Main.main.undoRedo.add(cmd);
-            Main.main.getEditLayer().data.setSelected(targetNode);
+            Main.getLayerManager().getEditLayer().data.setSelected(targetNode);
         }
     }
Index: trunk/src/org/openstreetmap/josm/actions/PasteAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/PasteAction.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/PasteAction.java	(revision 10413)
@@ -145,5 +145,5 @@
             if (data instanceof NodeData) {
                 NodeData nodeData = (NodeData) data;
-                if (Main.main.getEditLayer() == source) {
+                if (Main.getLayerManager().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 10409)
+++ trunk/src/org/openstreetmap/josm/actions/PurgeAction.java	(revision 10413)
@@ -96,5 +96,5 @@
 
         Collection<OsmPrimitive> sel = getLayerManager().getEditDataSet().getAllSelected();
-        layer = Main.main.getEditLayer();
+        layer = Main.getLayerManager().getEditLayer();
 
         toPurge = new HashSet<>(sel);
@@ -218,5 +218,5 @@
         }
 
-        Main.main.undoRedo.add(new PurgeCommand(Main.main.getEditLayer(), toPurgeChecked, makeIncomplete));
+        Main.main.undoRedo.add(new PurgeCommand(Main.getLayerManager().getEditLayer(), toPurgeChecked, makeIncomplete));
 
         if (clearUndoRedo) {
Index: trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java	(revision 10413)
@@ -44,5 +44,5 @@
         try {
             DataSet ds = reader.parseOsm(NullProgressMonitor.INSTANCE);
-            Main.main.getEditLayer().mergeFrom(ds);
+            Main.getLayerManager().getEditLayer().mergeFrom(ds);
         } catch (OsmTransferException e) {
             ExceptionDialogUtil.explainException(e);
@@ -58,5 +58,5 @@
      */
     public static void updatePrimitives(final Collection<OsmPrimitive> selection) {
-        UpdatePrimitivesTask task = new UpdatePrimitivesTask(Main.main.getEditLayer(), selection);
+        UpdatePrimitivesTask task = new UpdatePrimitivesTask(Main.getLayerManager().getEditLayer(), selection);
         Main.worker.submit(task);
     }
Index: trunk/src/org/openstreetmap/josm/actions/UploadAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/UploadAction.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/UploadAction.java	(revision 10413)
@@ -269,5 +269,5 @@
         }
         APIDataSet apiData = new APIDataSet(Main.main.getCurrentDataSet());
-        uploadData(Main.main.getEditLayer(), apiData);
+        uploadData(Main.getLayerManager().getEditLayer(), apiData);
     }
 }
Index: trunk/src/org/openstreetmap/josm/actions/ZoomToAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/ZoomToAction.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/ZoomToAction.java	(revision 10413)
@@ -82,5 +82,5 @@
 
     protected final void updateEnabledState() {
-        if (Main.main == null || Main.main.getEditLayer() != this.table.getLayer()) {
+        if (Main.main == null || Main.getLayerManager().getEditLayer() != this.table.getLayer()) {
             setEnabled(false);
             putValue(SHORT_DESCRIPTION, descriptionInactiveLayer);
Index: trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java	(revision 10413)
@@ -214,5 +214,5 @@
         protected OsmDataLayer getEditLayer() {
             if (!Main.isDisplayingMapView()) return null;
-            return Main.main.getEditLayer();
+            return Main.getLayerManager().getEditLayer();
         }
 
Index: trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java	(revision 10413)
@@ -297,5 +297,5 @@
                 }
             }
-            final OsmDataLayer editLayer = Main.main.getEditLayer();
+            final OsmDataLayer editLayer = Main.getLayerManager().getEditLayer();
             if (editLayer != null && osmData) {
                 final Set<OsmPrimitive> myPrimitives = getCompletePrimitives(editLayer.data);
Index: trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java	(revision 10413)
@@ -708,5 +708,5 @@
         Node targetNode = MergeNodesAction.selectTargetNode(changedNodes);
         Node locNode = MergeNodesAction.selectTargetLocationNode(changedNodes);
-        Command mergeCmd = MergeNodesAction.mergeNodes(Main.main.getEditLayer(), changedNodes, targetNode, locNode);
+        Command mergeCmd = MergeNodesAction.mergeNodes(Main.getLayerManager().getEditLayer(), changedNodes, targetNode, locNode);
         if (mergeCmd != null) {
             Main.main.undoRedo.add(mergeCmd);
Index: trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java	(revision 10413)
@@ -920,5 +920,5 @@
         Collection<Node> nodesToMerge = new LinkedList<>(selNodes);
         nodesToMerge.add(target);
-        mergeNodes(Main.main.getEditLayer(), nodesToMerge, target);
+        mergeNodes(Main.getLayerManager().getEditLayer(), nodesToMerge, target);
     }
 
Index: trunk/src/org/openstreetmap/josm/actions/relation/DeleteRelationsAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/relation/DeleteRelationsAction.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/relation/DeleteRelationsAction.java	(revision 10413)
@@ -30,5 +30,5 @@
         if (toDelete == null)
             return;
-        DeleteAction.deleteRelations(Main.main.getEditLayer(), toDelete);
+        DeleteAction.deleteRelations(Main.getLayerManager().getEditLayer(), toDelete);
         // clear selection after deletion
         if (Main.map.relationListDialog != null)
Index: trunk/src/org/openstreetmap/josm/actions/relation/DownloadMembersAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/relation/DownloadMembersAction.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/relation/DownloadMembersAction.java	(revision 10413)
@@ -36,5 +36,5 @@
     public void actionPerformed(ActionEvent e) {
         if (!isEnabled() || relations.isEmpty() || !Main.isDisplayingMapView()) return;
-        Main.worker.submit(new DownloadRelationTask(relations, Main.main.getEditLayer()));
+        Main.worker.submit(new DownloadRelationTask(relations, Main.getLayerManager().getEditLayer()));
     }
 
Index: trunk/src/org/openstreetmap/josm/actions/relation/DownloadSelectedIncompleteMembersAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/relation/DownloadSelectedIncompleteMembersAction.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/relation/DownloadSelectedIncompleteMembersAction.java	(revision 10413)
@@ -59,5 +59,5 @@
                 relations,
                 incompleteMembers,
-                Main.main.getEditLayer()));
+                Main.getLayerManager().getEditLayer()));
     }
 
Index: trunk/src/org/openstreetmap/josm/actions/relation/DuplicateRelationAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/relation/DuplicateRelationAction.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/relation/DuplicateRelationAction.java	(revision 10413)
@@ -34,5 +34,5 @@
         copy.setModified(true);
         RelationEditor editor = RelationEditor.getEditor(
-                Main.main.getEditLayer(),
+                Main.getLayerManager().getEditLayer(),
                 copy,
                 null /* no selected members */
Index: trunk/src/org/openstreetmap/josm/actions/relation/EditRelationAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/relation/EditRelationAction.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/relation/EditRelationAction.java	(revision 10413)
@@ -43,5 +43,5 @@
         Set<RelationMember> members = new HashSet<>();
         if (Main.isDisplayingMapView()) {
-            OsmDataLayer editLayer = Main.main.getEditLayer();
+            OsmDataLayer editLayer = Main.getLayerManager().getEditLayer();
             if (editLayer != null && editLayer.data != null) {
                 Collection<OsmPrimitive> selection = editLayer.data.getSelected();
@@ -62,5 +62,5 @@
     public static void launchEditor(Relation toEdit) {
         if (toEdit == null || toEdit.isDeleted() || !Main.isDisplayingMapView()) return;
-        RelationEditor.getEditor(Main.main.getEditLayer(), toEdit,
+        RelationEditor.getEditor(Main.getLayerManager().getEditLayer(), toEdit,
                 getMembersForCurrentSelection(toEdit)).setVisible(true);
     }
Index: trunk/src/org/openstreetmap/josm/actions/relation/RecentRelationsAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/relation/RecentRelationsAction.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/relation/RecentRelationsAction.java	(revision 10413)
@@ -140,5 +140,5 @@
         if (!Main.isDisplayingMapView())
             return Collections.emptyList();
-        Layer activeLayer = Main.main.getActiveLayer();
+        Layer activeLayer = Main.getLayerManager().getActiveLayer();
         if (!(activeLayer instanceof OsmDataLayer)) {
             return Collections.emptyList();
Index: trunk/src/org/openstreetmap/josm/actions/relation/SelectMembersAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/relation/SelectMembersAction.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/relation/SelectMembersAction.java	(revision 10413)
@@ -43,7 +43,7 @@
         }
         if (add) {
-            Main.main.getEditLayer().data.addSelected(members);
+            Main.getLayerManager().getEditLayer().data.addSelected(members);
         } else {
-            Main.main.getEditLayer().data.setSelected(members);
+            Main.getLayerManager().getEditLayer().data.setSelected(members);
         }
     }
Index: trunk/src/org/openstreetmap/josm/actions/relation/SelectRelationAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/relation/SelectRelationAction.java	(revision 10409)
+++ trunk/src/org/openstreetmap/josm/actions/relation/SelectRelationAction.java	(revision 10413)
@@ -34,5 +34,5 @@
     public void actionPerformed(ActionEvent e) {
         if (!isEnabled() || relations.isEmpty()) return;
-        OsmDataLayer editLayer = Main.main.getEditLayer();
+        OsmDataLayer editLayer = Main.getLayerManager().getEditLayer();
         if (editLayer == null || editLayer.data == null) return;
         if (add) {
