Index: /applications/editors/josm/plugins/CommandLine/build.xml
===================================================================
--- /applications/editors/josm/plugins/CommandLine/build.xml	(revision 25051)
+++ /applications/editors/josm/plugins/CommandLine/build.xml	(revision 25052)
@@ -3,5 +3,5 @@
 
     <!-- enter the SVN commit message -->
-    <property name="commit.message" value="Icons with menu and panel support" />
+    <property name="commit.message" value="New types imageryurl, imageryoffset and username" />
     <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
     <property name="plugin.main.version" value="3751" />
Index: /applications/editors/josm/plugins/CommandLine/src/CommandLine/AnyAction.java
===================================================================
--- /applications/editors/josm/plugins/CommandLine/src/CommandLine/AnyAction.java	(revision 25051)
+++ /applications/editors/josm/plugins/CommandLine/src/CommandLine/AnyAction.java	(revision 25052)
@@ -169,5 +169,5 @@
         Main.map.mapView.repaint();
         updateStatusLine();
-        parentPlugin.endInput();
+        parentPlugin.abortInput();
     }
 }
Index: /applications/editors/josm/plugins/CommandLine/src/CommandLine/Command.java
===================================================================
--- /applications/editors/josm/plugins/CommandLine/src/CommandLine/Command.java	(revision 25051)
+++ /applications/editors/josm/plugins/CommandLine/src/CommandLine/Command.java	(revision 25052)
@@ -164,4 +164,13 @@
 				}
 				break;
+			case USERNAME:
+				if (obj instanceof String) return true;
+				break;
+			case IMAGERYURL:
+				if (obj instanceof String) return true;
+				break;
+			case IMAGERYOFFSET:
+				if (obj instanceof String) return true;
+				break;
 		}
 		return false;
Index: /applications/editors/josm/plugins/CommandLine/src/CommandLine/CommandLine.java
===================================================================
--- /applications/editors/josm/plugins/CommandLine/src/CommandLine/CommandLine.java	(revision 25051)
+++ /applications/editors/josm/plugins/CommandLine/src/CommandLine/CommandLine.java	(revision 25052)
@@ -47,4 +47,5 @@
 import javax.swing.JMenu;
 import javax.swing.JMenuItem;
+import javax.swing.JToolBar;
 
 import org.openstreetmap.josm.Main;
@@ -52,4 +53,10 @@
 import org.openstreetmap.josm.command.MoveCommand;
 import org.openstreetmap.josm.command.SequenceCommand;
+import org.openstreetmap.josm.data.gpx.GpxData;
+import org.openstreetmap.josm.data.gpx.GpxTrack;
+import org.openstreetmap.josm.data.gpx.GpxTrackSegment;
+import org.openstreetmap.josm.data.gpx.WayPoint;
+import org.openstreetmap.josm.data.imagery.ImageryInfo;
+import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
 import org.openstreetmap.josm.data.osm.BBox;
 import org.openstreetmap.josm.data.osm.Node;
@@ -59,9 +66,6 @@
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.DataSetMerger;
-import org.openstreetmap.josm.data.gpx.GpxData;
-import org.openstreetmap.josm.data.gpx.GpxTrack;
-import org.openstreetmap.josm.data.gpx.GpxTrackSegment;
-import org.openstreetmap.josm.data.gpx.WayPoint;
 import org.openstreetmap.josm.gui.layer.GpxLayer;
+import org.openstreetmap.josm.gui.layer.ImageryLayer;
 import org.openstreetmap.josm.gui.layer.Layer;
 import org.openstreetmap.josm.gui.MainMenu;
@@ -77,4 +81,5 @@
 public class CommandLine extends Plugin {
 	protected JTextField textField;
+	protected JTextField historyField;
 	private String prefix;
 	private Mode mode;
@@ -91,4 +96,5 @@
 		commandSymbol = ": ";
 		history = new History(100);
+		historyField = new JTextField();
 		textField = new JTextField() {
 			@Override
@@ -226,14 +232,23 @@
 	public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame)
 	{
-		if (oldFrame==null && newFrame!=null) {
+		if (oldFrame == null && newFrame != null) {
 			currentMapFrame = newFrame;
-			currentMapFrame.add(textField,BorderLayout.NORTH);
-		}
+			JToolBar tb = new JToolBar();
+			tb.setLayout(new BorderLayout());
+			tb.setFloatable(false);
+			tb.setOrientation(JToolBar.HORIZONTAL);
+			tb.add(historyField, BorderLayout.NORTH);
+			tb.add(textField, BorderLayout.SOUTH);
+			currentMapFrame.add(tb, BorderLayout.NORTH);
+			printHistory("Loaded CommandLine, version " + getPluginInformation().version);
+		}
+	}
+
+	protected void printHistory(String text) {
+		historyField.setText(text);
 	}
 
 	private void loadCommands() {
-		Loader loader = new Loader(getPluginDir());
-		commands = loader.load(); // lol
-
+		commands = (new Loader(getPluginDir())).load();
 		for (Command command : commands) {
 			commandMenu.add(new CommandAction(command, this));
@@ -272,5 +287,5 @@
 			mode = Mode.SELECTION;
 			Parameter currentParameter = currentCommand.parameters.get(currentCommand.currentParameterNum);
-			prefix = tr(currentParameter.description);
+			prefix = tr(currentParameter.description == null ? currentParameter.name : currentParameter.description);
 			if (currentParameter.getRawValue() instanceof Relay)
 				prefix = prefix + " (" + ((Relay)(currentParameter.getRawValue())).getOptionsString() + ")";
@@ -299,4 +314,49 @@
 					action = new LengthAction(currentMapFrame, this);
 					break;
+				case USERNAME:
+					loadParameter((Object)Main.pref.get("osm-server.username", null), true);
+					action = new DummyAction(currentMapFrame, this);
+					break;
+				case IMAGERYURL:
+					Layer layer = Main.map.mapView.getActiveLayer();
+					if (layer != null) {
+						if (layer instanceof ImageryLayer) {
+						}
+						else {
+							List<ImageryLayer> imageryLayers = Main.map.mapView.getLayersOfType(ImageryLayer.class);
+							if (imageryLayers.size() == 1) {
+								layer = imageryLayers.get(0);
+							}
+							else {
+								endInput();
+								return;
+							}
+						}
+					}
+					ImageryInfo info = ((ImageryLayer)layer).getInfo();
+					String url = info.getURL();
+					String itype = info.getImageryType().getUrlString();
+					loadParameter((Object)(url.equals("") ? itype : url), true);
+					action = new DummyAction(currentMapFrame, this);
+					break;
+				case IMAGERYOFFSET:
+					Layer olayer = Main.map.mapView.getActiveLayer();
+					if (olayer != null) {
+						if (olayer instanceof ImageryLayer) {
+						}
+						else {
+							List<ImageryLayer> imageryLayers = Main.map.mapView.getLayersOfType(ImageryLayer.class);
+							if (imageryLayers.size() == 1) {
+								olayer = imageryLayers.get(0);
+							}
+							else {
+								endInput();
+								return;
+							}
+						}
+					}
+					loadParameter((Object)(String.valueOf(((ImageryLayer)olayer).getDx()) + "," + String.valueOf(((ImageryLayer)olayer).getDy())), true);
+					action = new DummyAction(currentMapFrame, this);
+					break;
 				default:
 					action = new DummyAction(currentMapFrame, this);
@@ -311,4 +371,5 @@
 			prefix = tr("Processing...");
 			textField.setText(prefix);
+			Main.map.mapView.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
 		}
 	}
@@ -321,4 +382,9 @@
 	public void deactivate() {
 		Main.map.mapView.requestFocus();
+	}
+
+	public void abortInput() {
+		printHistory(tr("Aborted") + ".");
+		endInput();
 	}
 
@@ -333,4 +399,9 @@
 			if (currentCommand.hasNextParameter()) {
 				if (next) {
+					Parameter currentParameter = currentCommand.parameters.get(currentCommand.currentParameterNum);
+					String prefix = tr(currentParameter.description == null ? currentParameter.name : currentParameter.description);
+					prefix += commandSymbol;
+					String value = currentParameter.getValue();
+					printHistory(prefix + value);
 					currentCommand.nextParameter();
 					setMode(Mode.SELECTION);
@@ -360,5 +431,5 @@
 			currentCommand.resetLoading();
 		}
-		System.out.println("Selected before " + String.valueOf(currentCommand.currentParameterNum) + "\n");
+		//System.out.println("Selected before " + String.valueOf(currentCommand.currentParameterNum) + "\n");
 	}
 
@@ -371,5 +442,4 @@
 	public void runTool() {
 		setMode(Mode.PROCESSING);
-		Main.map.mapView.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
 		String commandToRun = currentCommand.run;
 
@@ -495,4 +565,5 @@
 
 		// Read stdout stream
+		final OsmToCmd osmToCmd = new OsmToCmd(this, Main.main.getCurrentDataSet());
 		Thread osmParseThread = new Thread(new Runnable() {
 			public void run() {
@@ -501,6 +572,6 @@
 					HashMap<Long, Long> inexiDMap = new HashMap<Long, Long>();
 					final InputStream inputStream = tp.process.getInputStream();
-					final List<org.openstreetmap.josm.command.Command> cmdlist = new OsmToCmd(Main.main.getCurrentDataSet(), inputStream).getCommandList();
-					//OsmReaderMod.deleteInexiDMap();
+					osmToCmd.parseStream(inputStream);
+					final List<org.openstreetmap.josm.command.Command> cmdlist = osmToCmd.getCommandList();
 					if (!cmdlist.isEmpty()) {
 						SequenceCommand cmd = new SequenceCommand(commandName, cmdlist);
Index: /applications/editors/josm/plugins/CommandLine/src/CommandLine/DummyAction.java
===================================================================
--- /applications/editors/josm/plugins/CommandLine/src/CommandLine/DummyAction.java	(revision 25051)
+++ /applications/editors/josm/plugins/CommandLine/src/CommandLine/DummyAction.java	(revision 25052)
@@ -56,5 +56,5 @@
         Main.map.mapView.repaint();
         updateStatusLine();
-        parentPlugin.endInput();
+        parentPlugin.abortInput();
     }
 }
Index: /applications/editors/josm/plugins/CommandLine/src/CommandLine/LengthAction.java
===================================================================
--- /applications/editors/josm/plugins/CommandLine/src/CommandLine/LengthAction.java	(revision 25051)
+++ /applications/editors/josm/plugins/CommandLine/src/CommandLine/LengthAction.java	(revision 25052)
@@ -101,5 +101,5 @@
 		Main.map.statusLine.setAngle(-1);
 		updateStatusLine();
-		parentPlugin.endInput();
+		parentPlugin.abortInput();
 	}
 
Index: /applications/editors/josm/plugins/CommandLine/src/CommandLine/Loader.java
===================================================================
--- /applications/editors/josm/plugins/CommandLine/src/CommandLine/Loader.java	(revision 25051)
+++ /applications/editors/josm/plugins/CommandLine/src/CommandLine/Loader.java	(revision 25052)
@@ -106,4 +106,7 @@
 					else if (Value.equals("string")) currentParameter.type = Type.STRING;
 					else if (Value.equals("relay")) currentParameter.type = Type.RELAY;
+					else if (Value.equals("username")) currentParameter.type = Type.USERNAME;
+					else if (Value.equals("imageryurl")) currentParameter.type = Type.IMAGERYURL;
+					else if (Value.equals("imageryoffset")) currentParameter.type = Type.IMAGERYOFFSET;
 				}
 				else if (Name.equals("maxinstances")) {
Index: /applications/editors/josm/plugins/CommandLine/src/CommandLine/NodeAction.java
===================================================================
--- /applications/editors/josm/plugins/CommandLine/src/CommandLine/NodeAction.java	(revision 25051)
+++ /applications/editors/josm/plugins/CommandLine/src/CommandLine/NodeAction.java	(revision 25052)
@@ -2,5 +2,5 @@
  *      NodeAction.java
  *      
- *      Copyright 2010 Hind <foxhind@gmail.com>
+ *      Copyright 2011 Hind <foxhind@gmail.com>
  *      
  */
@@ -109,5 +109,5 @@
 					}
 					else
-						System.out.println("Maximum instances!");
+						parentPlugin.printHistory("Maximum instances is " + String.valueOf(maxInstances));
 				}
 			}
@@ -170,5 +170,5 @@
         Main.map.mapView.repaint();
         updateStatusLine();
-        parentPlugin.endInput();
+        parentPlugin.abortInput();
     }
 }
Index: /applications/editors/josm/plugins/CommandLine/src/CommandLine/OsmToCmd.java
===================================================================
--- /applications/editors/josm/plugins/CommandLine/src/CommandLine/OsmToCmd.java	(revision 25051)
+++ /applications/editors/josm/plugins/CommandLine/src/CommandLine/OsmToCmd.java	(revision 25052)
@@ -1,2 +1,9 @@
+/*
+ *	  OsmToCmd.java
+ *	  
+ *	  Copyright 2011 Hind <foxhind@gmail.com>
+ *	  
+ */
+
 package CommandLine;
 
@@ -12,4 +19,5 @@
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParserFactory;
+import javax.xml.parsers.SAXParser;
 
 import org.openstreetmap.josm.Main;
@@ -32,20 +40,25 @@
 import org.xml.sax.SAXParseException;
 import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.ext.LexicalHandler;
 
 final class OsmToCmd {
+	private CommandLine parentPlugin;
 	private final DataSet targetDataSet;
 	private final LinkedList<Command> cmds = new LinkedList<Command>();
 	private HashMap<PrimitiveId, OsmPrimitive> externalIdMap; // Maps external ids to internal primitives
-	
-	public OsmToCmd(DataSet targetDataSet, InputStream stream) throws IllegalDataException {
+
+	public OsmToCmd(CommandLine parentPlugin, DataSet targetDataSet) {
+		this.parentPlugin = parentPlugin;
 		this.targetDataSet = targetDataSet;
 		externalIdMap = new HashMap<PrimitiveId, OsmPrimitive>();
-		parseStream(stream);
 	}
 
-	private void parseStream(InputStream stream) throws IllegalDataException {
+	public void parseStream(InputStream stream) throws IllegalDataException {
 		try {
 			InputSource inputSource = new InputSource(UTFInputStreamReader.create(stream, "UTF-8"));
-			SAXParserFactory.newInstance().newSAXParser().parse(inputSource, new Parser());
+			SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
+			Parser handler = new Parser();
+			parser.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
+			parser.parse(inputSource, handler);
 		} catch(ParserConfigurationException e) {
 			throw new IllegalDataException(e.getMessage(), e);
@@ -63,5 +76,5 @@
 	}
 	
-	private class Parser extends DefaultHandler {
+	private class Parser extends DefaultHandler implements LexicalHandler {
 		private Locator locator;
 		
@@ -259,4 +272,27 @@
 		}
 
+		@Override
+		public void comment(char[] ch, int start, int length) {
+			parentPlugin.printHistory(String.valueOf(ch));
+		}
+		
+		public void startCDATA() {
+		}
+		
+		public void endCDATA() {
+		}
+		
+		public void startEntity(String name) {
+		}
+		
+		public void endEntity(String name) {
+		}
+		
+		public void startDTD(String name, String publicId, String systemId) {
+		}
+		
+		public void endDTD() {
+		}
+		
 		private double getDouble(Attributes atts, String value) {
 			return Double.parseDouble(atts.getValue(value));
Index: /applications/editors/josm/plugins/CommandLine/src/CommandLine/Parameter.java
===================================================================
--- /applications/editors/josm/plugins/CommandLine/src/CommandLine/Parameter.java	(revision 25051)
+++ /applications/editors/josm/plugins/CommandLine/src/CommandLine/Parameter.java	(revision 25052)
@@ -2,9 +2,11 @@
  *      Parameter.java
  *      
- *      Copyright 2010 Hind <foxhind@gmail.com>
+ *      Copyright 2011 Hind <foxhind@gmail.com>
  *      
  */
  
 package CommandLine;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
 
 import java.util.ArrayList;
@@ -15,4 +17,5 @@
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.data.osm.Relation;
 
 public class Parameter {
@@ -41,8 +44,29 @@
 				break;
 			case STRING:
-				out = "\"" + String.valueOf(value) + "\"";
+				out = String.valueOf(value);
 				break;
 			case RELAY:
 				out = String.valueOf(((Relay)value).getValue());
+				break;
+			case NODE:
+				out = String.valueOf(valueList.size()) + " " + tr("nodes");
+				break;
+			case WAY:
+				out = String.valueOf(valueList.size()) + " " + tr("ways");
+				break;
+			case RELATION:
+				out = String.valueOf(valueList.size()) + " " + tr("relations");
+				break;
+			case ANY:
+				out = String.valueOf(valueList.size()) + " " + tr("OSM objects");
+				break;
+			case USERNAME:
+				out = String.valueOf(value);
+				break;
+			case IMAGERYURL:
+				out = String.valueOf(value);
+				break;
+			case IMAGERYOFFSET:
+				out = String.valueOf(value);
 				break;
 		}
Index: /applications/editors/josm/plugins/CommandLine/src/CommandLine/PointAction.java
===================================================================
--- /applications/editors/josm/plugins/CommandLine/src/CommandLine/PointAction.java	(revision 25051)
+++ /applications/editors/josm/plugins/CommandLine/src/CommandLine/PointAction.java	(revision 25052)
@@ -2,5 +2,5 @@
  *	  PointAction.java
  *	  
- *	  Copyright 2010 Hind <foxhind@gmail.com>
+ *	  Copyright 2011 Hind <foxhind@gmail.com>
  *	  
  */
@@ -178,5 +178,5 @@
 		Main.map.mapView.repaint();
 		updateStatusLine();
-		parentPlugin.endInput();
+		parentPlugin.abortInput();
 	}
 
Index: /applications/editors/josm/plugins/CommandLine/src/CommandLine/RelationAction.java
===================================================================
--- /applications/editors/josm/plugins/CommandLine/src/CommandLine/RelationAction.java	(revision 25051)
+++ /applications/editors/josm/plugins/CommandLine/src/CommandLine/RelationAction.java	(revision 25052)
@@ -2,5 +2,5 @@
  *      RelationAction.java
  *      
- *      Copyright 2010 Hind <foxhind@gmail.com>
+ *      Copyright 2011 Hind <foxhind@gmail.com>
  *      
  */
@@ -56,5 +56,5 @@
         Main.map.mapView.repaint();
         updateStatusLine();
-        parentPlugin.endInput();
+        parentPlugin.abortInput();
     }
 }
Index: /applications/editors/josm/plugins/CommandLine/src/CommandLine/Type.java
===================================================================
--- /applications/editors/josm/plugins/CommandLine/src/CommandLine/Type.java	(revision 25051)
+++ /applications/editors/josm/plugins/CommandLine/src/CommandLine/Type.java	(revision 25052)
@@ -19,3 +19,3 @@
 package CommandLine;
 
-public enum Type { NODE, WAY, RELATION, ANY, POINT, LENGTH, NATURAL, STRING, TRIGGER, RELAY }
+public enum Type { NODE, WAY, RELATION, ANY, POINT, LENGTH, NATURAL, STRING, TRIGGER, RELAY, USERNAME, IMAGERYURL, IMAGERYOFFSET }
Index: /applications/editors/josm/plugins/CommandLine/src/CommandLine/WayAction.java
===================================================================
--- /applications/editors/josm/plugins/CommandLine/src/CommandLine/WayAction.java	(revision 25051)
+++ /applications/editors/josm/plugins/CommandLine/src/CommandLine/WayAction.java	(revision 25052)
@@ -2,5 +2,5 @@
  *      WayAction.java
  *      
- *      Copyright 2010 Hind <foxhind@gmail.com>
+ *      Copyright 2011 Hind <foxhind@gmail.com>
  *      
  */
@@ -191,5 +191,5 @@
         Main.map.mapView.repaint();
         updateStatusLine();
-        parentPlugin.endInput();
+        parentPlugin.abortInput();
     }
 }
