Index: /applications/editors/josm/plugins/ext_tools/build.xml
===================================================================
--- /applications/editors/josm/plugins/ext_tools/build.xml	(revision 33697)
+++ /applications/editors/josm/plugins/ext_tools/build.xml	(revision 33698)
@@ -5,5 +5,5 @@
     <property name="commit.message" value="ExtTools: help shortcut paser, rebuild"/>
     <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
-    <property name="plugin.main.version" value="10580"/>
+    <property name="plugin.main.version" value="12726"/>
 
     <!-- Configure these properties (replace "..." accordingly).
Index: /applications/editors/josm/plugins/ext_tools/src/ext_tools/DataSetToCmd.java
===================================================================
--- /applications/editors/josm/plugins/ext_tools/src/ext_tools/DataSetToCmd.java	(revision 33697)
+++ /applications/editors/josm/plugins/ext_tools/src/ext_tools/DataSetToCmd.java	(revision 33698)
@@ -14,4 +14,5 @@
 import org.openstreetmap.josm.command.Command;
 import org.openstreetmap.josm.data.osm.*;
+import org.openstreetmap.josm.gui.MainApplication;
 
 final class DataSetToCmd {
@@ -65,5 +66,5 @@
         target.mergeFrom(source);
         mergedMap.put(source.getPrimitiveId(), target);
-        cmds.add(new AddCommand(target));
+        cmds.add(new AddCommand(MainApplication.getLayerManager().getEditDataSet(), target));
     }
 
@@ -123,5 +124,5 @@
             newNodes.add(targetNode);
         }
-        cmds.add(new ChangeNodesCommand(target, newNodes));
+        cmds.add(new ChangeNodesCommand(MainApplication.getLayerManager().getEditDataSet(), target, newNodes));
     }
 
@@ -163,5 +164,5 @@
         Relation newRelation = new Relation(target);
         newRelation.setMembers(newMembers);
-        cmds.add(new ChangeCommand(target, newRelation));
+        cmds.add(new ChangeCommand(MainApplication.getLayerManager().getEditDataSet(), target, newRelation));
     }
 
Index: /applications/editors/josm/plugins/ext_tools/src/ext_tools/ExtTool.java
===================================================================
--- /applications/editors/josm/plugins/ext_tools/src/ext_tools/ExtTool.java	(revision 33697)
+++ /applications/editors/josm/plugins/ext_tools/src/ext_tools/ExtTool.java	(revision 33698)
@@ -27,4 +27,5 @@
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.MainMenu;
 import org.openstreetmap.josm.gui.MapView;
@@ -35,4 +36,5 @@
 import org.openstreetmap.josm.io.OsmReader;
 import org.openstreetmap.josm.tools.GBC;
+import org.openstreetmap.josm.tools.Logging;
 
 public class ExtTool {
@@ -57,7 +59,7 @@
             if (action == null)
                 action = new ExtToolAction(this);
-            menuItem = MainMenu.add(Main.main.menu.toolsMenu, action);
+            menuItem = MainMenu.add(MainApplication.getMenu().toolsMenu, action);
         } else {
-            Main.main.menu.toolsMenu.remove(menuItem);
+            MainApplication.getMenu().toolsMenu.remove(menuItem);
         }
     }
@@ -107,5 +109,5 @@
     }
 
-    private class ToolProcess {
+    private static class ToolProcess {
         public Process process;
         public volatile boolean running;
@@ -113,6 +115,6 @@
 
     static double getPPD() {
-        ProjectionBounds bounds = Main.map.mapView.getProjectionBounds();
-        return Main.map.mapView.getWidth() /
+        ProjectionBounds bounds = MainApplication.getMap().mapView.getProjectionBounds();
+        return MainApplication.getMap().mapView.getWidth() /
                 (bounds.maxEast - bounds.minEast);
     }
@@ -129,6 +131,6 @@
 
     private double getTMSZoom() {
-        if (Main.map == null || Main.map.mapView == null) return 1;
-        MapView mv = Main.map.mapView;
+        if (!MainApplication.isDisplayingMapView()) return 1;
+        MapView mv = MainApplication.getMap().mapView;
         LatLon topLeft = mv.getLatLon(0, 0);
         LatLon botRight = mv.getLatLon(mv.getWidth(), mv.getHeight());
@@ -145,21 +147,19 @@
 
     protected void showErrorMessage(final String message, final String details) {
-        SwingUtilities.invokeLater(new Runnable() {
-            public void run() {
-                final JPanel p = new JPanel(new GridBagLayout());
-                p.add(new JMultilineLabel(message),GBC.eol());
-                if (details != null) {
-                    JTextArea info = new JTextArea(details, 20, 60);
-                    info.setCaretPosition(0);
-                    info.setEditable(false);
-                    p.add(new JScrollPane(info), GBC.eop());
-                }
-                JOptionPane.showMessageDialog(Main.parent, p, tr("External tool error"), JOptionPane.ERROR_MESSAGE);
-            }
+        SwingUtilities.invokeLater(() -> {
+            final JPanel p = new JPanel(new GridBagLayout());
+            p.add(new JMultilineLabel(message),GBC.eol());
+            if (details != null) {
+                JTextArea info = new JTextArea(details, 20, 60);
+                info.setCaretPosition(0);
+                info.setEditable(false);
+                p.add(new JScrollPane(info), GBC.eop());
+            }
+            JOptionPane.showMessageDialog(Main.parent, p, tr("External tool error"), JOptionPane.ERROR_MESSAGE);
         });
     }
 
     public void runTool(LatLon pos) {
-        Main.map.mapView.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+        MainApplication.getMap().mapView.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
         // parse cmdline and build cmdParams array
         HashMap<String, String> replace = new HashMap<>();
@@ -201,5 +201,5 @@
             tp.process = builder.start();
         } catch (final IOException e) {
-            e.printStackTrace();
+            Logging.error(e);
             synchronized (debugstr) {
                 showErrorMessage(
@@ -212,52 +212,46 @@
 
         // redirect child process's stderr to JOSM stderr
-        new Thread(new Runnable() {
-            public void run() {
-                try {
-                    byte[] buffer = new byte[1024];
-                    InputStream errStream = tp.process.getErrorStream();
-                    int len;
-                    while ((len = errStream.read(buffer)) > 0) {
-                        synchronized (debugstr) {
-                            debugstr.append(new String(buffer, 0, len));
-                        }
-                        System.err.write(buffer, 0, len);
-                    }
-                } catch (IOException e) {
-                }
+        new Thread(() -> {
+            try {
+                byte[] buffer = new byte[1024];
+                InputStream errStream = tp.process.getErrorStream();
+                int len;
+                while ((len = errStream.read(buffer)) > 0) {
+                    synchronized (debugstr) {
+                        debugstr.append(new String(buffer, 0, len));
+                    }
+                    System.err.write(buffer, 0, len);
+                }
+            } catch (IOException e) {
+                Logging.error(e);
             }
         }).start();
 
         // read stdout stream
-        Thread osmParseThread = new Thread(new Runnable() {
-            public void run() {
-                try {
-                    final InputStream inputStream = tp.process.getInputStream();
-                    final DataSet ds = OsmReader.parseDataSet(inputStream,
-                            NullProgressMonitor.INSTANCE);
-                    final List<Command> cmdlist = new DataSetToCmd(ds).getCommandList();
-                    if (!cmdlist.isEmpty()) {
-                        SequenceCommand cmd =
-                                new SequenceCommand(getName(), cmdlist);
-                        Main.main.undoRedo.add(cmd);
-                    }
-                } catch (IllegalDataException e) {
-                    e.printStackTrace();
-                    if (tp.running) {
-                        tp.process.destroy();
-                        synchronized (debugstr) {
-                            showErrorMessage(
-                                    tr("Child script have returned invalid data.\n\nstderr contents:"),
-                                    debugstr.toString());
-                        }
-                    }
-                } finally {
-                    synchronized (syncObj) {
-                        tp.running = false;
-                        syncObj.notifyAll();
-                    }
-                }
-            }
-
+        Thread osmParseThread = new Thread(() -> {
+            try {
+                final InputStream inputStream = tp.process.getInputStream();
+                final DataSet ds = OsmReader.parseDataSet(inputStream,
+                        NullProgressMonitor.INSTANCE);
+                final List<Command> cmdlist = new DataSetToCmd(ds).getCommandList();
+                if (!cmdlist.isEmpty()) {
+                    Main.main.undoRedo.add(new SequenceCommand(getName(), cmdlist));
+                }
+            } catch (IllegalDataException e) {
+                Logging.error(e);
+                if (tp.running) {
+                    tp.process.destroy();
+                    synchronized (debugstr) {
+                        showErrorMessage(
+                                tr("Child script have returned invalid data.\n\nstderr contents:"),
+                                debugstr.toString());
+                    }
+                }
+            } finally {
+                synchronized (syncObj) {
+                    tp.running = false;
+                    syncObj.notifyAll();
+                }
+            }
         });
         osmParseThread.start();
@@ -267,4 +261,5 @@
                 syncObj.wait(10000);
             } catch (InterruptedException e) {
+                Logging.trace(e);
             }
         }
Index: /applications/editors/josm/plugins/ext_tools/src/ext_tools/ExtToolAction.java
===================================================================
--- /applications/editors/josm/plugins/ext_tools/src/ext_tools/ExtToolAction.java	(revision 33697)
+++ /applications/editors/josm/plugins/ext_tools/src/ext_tools/ExtToolAction.java	(revision 33698)
@@ -7,6 +7,6 @@
 import java.awt.event.MouseEvent;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.mapmode.MapMode;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.layer.Layer;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
@@ -24,5 +24,5 @@
             Shortcut.registerShortcut(tr("exttool:{0}", tool.name), tr("External Tool: {0}", tool.name), 
                 KeyEvent.CHAR_UNDEFINED, Shortcut.NONE),
-            null, ImageProvider.getCursor("crosshair", null));
+            ImageProvider.getCursor("crosshair", null));
         this.tool = tool;
         setEnabled(true);
@@ -31,7 +31,7 @@
     @Override
     public void actionPerformed(ActionEvent e) {
-        if (Main.map == null || Main.map.mapView == null)
+        if (!MainApplication.isDisplayingMapView())
             return;
-        oldMapMode = Main.map.mapMode;
+        oldMapMode = MainApplication.getMap().mapMode;
         super.actionPerformed(e);
     }
@@ -40,5 +40,5 @@
     public void enterMode() {
         super.enterMode();
-        Main.map.mapView.addMouseListener(this);
+        MainApplication.getMap().mapView.addMouseListener(this);
     }
 
@@ -46,15 +46,15 @@
     public void exitMode() {
         super.exitMode();
-        Main.map.mapView.removeMouseListener(this);
+        MainApplication.getMap().mapView.removeMouseListener(this);
     }
 
     @Override
     public void mouseClicked(MouseEvent e) {
-        if (Main.map == null || Main.map.mapView == null) {
+        if (!MainApplication.isDisplayingMapView()) {
             return;
         }
 
-        tool.runTool(Main.map.mapView.getLatLon(e.getX(), e.getY()));
-        Main.map.selectMapMode(oldMapMode);
+        tool.runTool(MainApplication.getMap().mapView.getLatLon(e.getX(), e.getY()));
+        MainApplication.getMap().selectMapMode(oldMapMode);
     }
 
Index: /applications/editors/josm/plugins/ext_tools/src/ext_tools/ToolsInformation.java
===================================================================
--- /applications/editors/josm/plugins/ext_tools/src/ext_tools/ToolsInformation.java	(revision 33697)
+++ /applications/editors/josm/plugins/ext_tools/src/ext_tools/ToolsInformation.java	(revision 33698)
@@ -9,5 +9,5 @@
 import java.util.List;
 
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.tools.Logging;
 
 public class ToolsInformation {
@@ -34,5 +34,5 @@
             }
         } catch (Exception e) {
-            Main.warn("Ext_Tools warning: can not load file "+filename);
+            Logging.warn("Ext_Tools warning: can not load file "+filename);
         }
     }
@@ -43,5 +43,5 @@
                 w.write(tool.serialize());
         } catch (Exception e) {
-            Main.warn("Ext_Tools warning: can not save file "+filename);
+            Logging.warn("Ext_Tools warning: can not save file "+filename);
         }
     }
Index: /applications/editors/josm/plugins/ext_tools/src/ext_tools/preferences/MyToolsPanel.java
===================================================================
--- /applications/editors/josm/plugins/ext_tools/src/ext_tools/preferences/MyToolsPanel.java	(revision 33697)
+++ /applications/editors/josm/plugins/ext_tools/src/ext_tools/preferences/MyToolsPanel.java	(revision 33698)
@@ -42,9 +42,5 @@
             final JCheckBox cbTool = new JCheckBox(tool.getName());
             cbTool.setSelected(tool.isEnabled());
-            cbTool.addActionListener(new ActionListener() {
-                public void actionPerformed(ActionEvent e) {
-                    tool.setEnabled(cbTool.isSelected());
-                }
-            });
+            cbTool.addActionListener(e -> tool.setEnabled(cbTool.isSelected()));
             add(cbTool, gbc);
 
Index: /applications/editors/josm/plugins/ext_tools/src/ext_tools/preferences/ToolsRepositoryPanel.java
===================================================================
--- /applications/editors/josm/plugins/ext_tools/src/ext_tools/preferences/ToolsRepositoryPanel.java	(revision 33697)
+++ /applications/editors/josm/plugins/ext_tools/src/ext_tools/preferences/ToolsRepositoryPanel.java	(revision 33698)
@@ -41,9 +41,5 @@
             final JCheckBox cbTool = new JCheckBox(tool.getName());
             cbTool.setSelected(tool.isEnabled());
-            cbTool.addActionListener(new ActionListener() {
-                public void actionPerformed(ActionEvent e) {
-                    tool.setEnabled(cbTool.isSelected());
-                }
-            });
+            cbTool.addActionListener(e -> tool.setEnabled(cbTool.isSelected()));
             add(cbTool, gbc);
 
