Index: /applications/editors/josm/plugins/CommandLine/src/CommandLine/CommandLine.java
===================================================================
--- /applications/editors/josm/plugins/CommandLine/src/CommandLine/CommandLine.java	(revision 30669)
+++ /applications/editors/josm/plugins/CommandLine/src/CommandLine/CommandLine.java	(revision 30670)
@@ -101,6 +101,5 @@
                             if (commandText.isEmpty()) {
                                 commandText = history.getLastItem();
-                            }
-                            else {
+                            } else {
                                 history.addItem(commandText);
                             }
@@ -108,7 +107,7 @@
                             if (command != null) {
                                 startCommand(command);
+                            } else {
+                                setMode(Mode.IDLE);
                             }
-                            else
-                                setMode(Mode.IDLE);
                             break;
                         case SELECTION:
@@ -189,5 +188,5 @@
         };
 
-        if ( Main.main.menu != null ) {
+        if (Main.main.menu != null) {
             commandMenu = Main.main.menu.addMenu(marktr("Commands") , KeyEvent.VK_O, Main.main.menu.getDefaultMenuPos(), ht("/Plugin/CommandLine"));
             MainMenu.add(commandMenu, new CommandLineAction(this));
@@ -259,9 +258,6 @@
                     return commands.get(i);
                 }
-            }
-            else {
-                if ( commands.get(i).name.toLowerCase().startsWith( text.toLowerCase() ) && text.length() > 1 ) {
-                    return commands.get(i);
-                }
+            } else if ( commands.get(i).name.toLowerCase().startsWith( text.toLowerCase() ) && text.length() > 1 ) {
+                return commands.get(i);
             }
         }
@@ -340,7 +336,5 @@
                 Layer olayer = Main.map.mapView.getActiveLayer();
                 if (olayer != null) {
-                    if (olayer instanceof ImageryLayer) {
-                    }
-                    else {
+                    if (!(olayer instanceof ImageryLayer)) {
                         List<ImageryLayer> imageryLayers = Main.map.mapView.getLayersOfType(ImageryLayer.class);
                         if (imageryLayers.size() == 1) {
@@ -404,10 +398,8 @@
                     setMode(Mode.SELECTION);
                 }
-            }
-            else {
+            } else {
                 runTool();
             }
-        }
-        else {
+        } else {
             Main.info("Invalid argument");
             endInput();
@@ -424,6 +416,5 @@
         if (ok) {
             currentCommand.nextParameter();
-        }
-        else {
+        } else {
             currentCommand.resetLoading();
         }
@@ -463,5 +454,5 @@
             debugstr.append(s + " ");
         debugstr.append("\n");
-        System.out.print(debugstr.toString());
+        Main.info(debugstr.toString());
 
         final ToolProcess tp = new ToolProcess();
@@ -469,7 +460,6 @@
             tp.process = builder.start();
         } catch (final IOException e) {
-            e.printStackTrace();
             synchronized (debugstr) {
-                System.out.print(
+                Main.error(
                         tr("Error executing the script: ") +
                         debugstr.toString() + e.getMessage() + "\n" + e.getStackTrace());
@@ -577,5 +567,4 @@
                     final OsmToCmd osmToCmd = new OsmToCmd(that, currentDataSet);
                     String commandName = currentCommand.name;
-                    //HashMap<Long, Long> inexiDMap = new HashMap<Long, Long>();
                     final InputStream inputStream = tp.process.getInputStream();
                     osmToCmd.parseStream(inputStream);
@@ -590,6 +579,6 @@
                         });
                     }
-                }
-                catch (Exception e) {}
+                } catch (Exception e) {
+                }
                 finally {
                     synchronized (syncObj) {
