Index: applications/editors/josm/plugins/CommandLine/src/CommandLine/CommandLine.java
===================================================================
--- applications/editors/josm/plugins/CommandLine/src/CommandLine/CommandLine.java	(revision 34342)
+++ applications/editors/josm/plugins/CommandLine/src/CommandLine/CommandLine.java	(revision 34498)
@@ -33,7 +33,8 @@
 import javax.swing.SwingUtilities;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.mapmode.MapMode;
 import org.openstreetmap.josm.command.SequenceCommand;
+import org.openstreetmap.josm.data.Preferences;
+import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.imagery.ImageryInfo;
 import org.openstreetmap.josm.data.osm.BBox;
@@ -57,4 +58,5 @@
 import org.openstreetmap.josm.plugins.Plugin;
 import org.openstreetmap.josm.plugins.PluginInformation;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.tools.HttpClient;
 import org.openstreetmap.josm.tools.Logging;
@@ -75,5 +77,5 @@
     protected MapMode previousMode;
 
-    static final String pluginDir = Main.pref.getPluginsDirectory().getAbsolutePath() + "/CommandLine/";
+    static final String pluginDir = Preferences.main().getPluginsDirectory().getAbsolutePath() + "/CommandLine/";
 
     public CommandLine(PluginInformation info) {
@@ -148,5 +150,5 @@
         commands = (new Loader(getPluginDirs().getUserDataDirectory(false))).load();
         if (commands.isEmpty()) {
-            if (!GraphicsEnvironment.isHeadless() && JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(Main.parent,
+            if (!GraphicsEnvironment.isHeadless() && JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(MainApplication.getMainFrame(),
                     tr("No command has been found. Would you like to download and install default commands now?"),
                     tr("No command found"), JOptionPane.YES_NO_CANCEL_OPTION)) {
@@ -154,9 +156,9 @@
                     downloadAndInstallDefaultCommands();
                     commands = (new Loader(getPluginDirs().getUserDataDirectory(false))).load();
-                    JOptionPane.showMessageDialog(Main.parent, tr("Default commands have been successfully installed"),
+                    JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Default commands have been successfully installed"),
                             tr("Success"), JOptionPane.INFORMATION_MESSAGE);
                 } catch (IOException e) {
                     Logging.warn(e);
-                    JOptionPane.showMessageDialog(Main.parent,
+                    JOptionPane.showMessageDialog(MainApplication.getMainFrame(),
                             tr("Failed to download and install default commands.\n\nError: {0}", e.getMessage()),
                             tr("Warning"), JOptionPane.WARNING_MESSAGE);
@@ -170,5 +172,5 @@
 
     private void downloadAndInstallDefaultCommands() throws IOException {
-        String url = Main.pref.get("commandline.default.commands.url",
+        String url = Config.getPref().get("commandline.default.commands.url",
                 "https://github.com/Foxhind/JOSM-CommandLine-commands/archive/master.zip");
         try (ZipInputStream zis = new ZipInputStream(HttpClient.create(new URL(url)).connect().getContent(), StandardCharsets.UTF_8)) {
@@ -256,5 +258,5 @@
                 break;
             case USERNAME:
-                loadParameter(Main.pref.get("osm-server.username", null), true);
+                loadParameter(Config.getPref().get("osm-server.username", null), true);
                 action = new DummyAction(this);
                 break;
@@ -613,5 +615,5 @@
                 if (!cmdlist.isEmpty()) {
                     final SequenceCommand cmd = new SequenceCommand(commandName, cmdlist);
-                    SwingUtilities.invokeLater(() -> Main.main.undoRedo.add(cmd));
+                    SwingUtilities.invokeLater(() -> UndoRedoHandler.getInstance().add(cmd));
                 }
             } catch (Exception e) {
@@ -630,5 +632,5 @@
         synchronized (syncObj) {
             try {
-                syncObj.wait(Main.pref.getInt("commandline.timeout", 20000));
+                syncObj.wait(Config.getPref().getInt("commandline.timeout", 20000));
             } catch (InterruptedException e) {
                 Logging.warn(e);
Index: applications/editors/josm/plugins/CommandLine/src/CommandLine/PointAction.java
===================================================================
--- applications/editors/josm/plugins/CommandLine/src/CommandLine/PointAction.java	(revision 34342)
+++ applications/editors/josm/plugins/CommandLine/src/CommandLine/PointAction.java	(revision 34498)
@@ -16,5 +16,4 @@
 import javax.swing.JOptionPane;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.mapmode.MapMode;
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -87,5 +86,5 @@
                     coor = nearestNode.getCoor();
                 if (coor.isOutSideWorld()) {
-                    JOptionPane.showMessageDialog(Main.parent, tr("Can not draw outside of the world."));
+                    JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Can not draw outside of the world."));
                     return;
                 }
