[josm-dev] [PATCH 12/26] DeleteCommand

Dave Hansen dave at sr71.net
Tue Apr 29 03:02:54 BST 2008


Reorganize some of the imports, and let DeleteCommand take a single
object into its constructor.

---

 core-dave/src/org/openstreetmap/josm/command/DeleteCommand.java |   24 ++++++----
 1 file changed, 15 insertions(+), 9 deletions(-)

diff -puN src/org/openstreetmap/josm/command/DeleteCommand.java~delete-command src/org/openstreetmap/josm/command/DeleteCommand.java
--- core/src/org/openstreetmap/josm/command/DeleteCommand.java~delete-command	2008-04-28 18:59:27.000000000 -0700
+++ core-dave/src/org/openstreetmap/josm/command/DeleteCommand.java	2008-04-28 18:59:27.000000000 -0700
@@ -1,19 +1,20 @@
-// License: GPL. Copyright 2007 by Immanuel Scholz and others
-package org.openstreetmap.josm.command;
-
+package org.openstreetmap.josm.command;
+
 import static org.openstreetmap.josm.tools.I18n.tr;
 import static org.openstreetmap.josm.tools.I18n.trn;
 
-import java.util.Collection;
-
-import javax.swing.JLabel;
-import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.MutableTreeNode;
 
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.visitor.NameVisitor;
 import org.openstreetmap.josm.tools.ImageProvider;
 
+import java.util.Collection;
+import java.util.Collections;
+
+import javax.swing.JLabel;
+import javax.swing.tree.DefaultMutableTreeNode;
+
 /**
  * A command to delete a number of primitives from the dataset.
  * @author imi
@@ -28,10 +29,15 @@ public class DeleteCommand extends Comma
 	public DeleteCommand(Collection<? extends OsmPrimitive> data) {
 		this.data = data;
 	}
-
-	@Override public boolean executeCommand() {
+	public DeleteCommand(OsmPrimitive data) {
+		this.data = Collections.singleton(data);
+	}
+	@Override public boolean executeCommand() {
 		super.executeCommand();
+		//Main.debug("DeleteCommand() executeCommand");
 		for (OsmPrimitive osm : data) {
+			//Main.debug("DeleteCommand() delete '" +
+			// 		osm.getClass().getName()  + "' " + osm.id);
 			osm.delete(true);
 		}
 		return true;
_




More information about the josm-dev mailing list