Index: /applications/editors/josm/plugins/utilsplugin2/README
===================================================================
--- /applications/editors/josm/plugins/utilsplugin2/README	(revision 28550)
+++ /applications/editors/josm/plugins/utilsplugin2/README	(revision 28551)
@@ -8,5 +8,5 @@
  * Add nodes on intersections action (by Upliner)
  
- * Split Object Action (anonymous)
+ * Split Object Action (anonymous, Larry0ua updated)
 
  * Selection actions (by akks)
Index: /applications/editors/josm/plugins/utilsplugin2/build.xml
===================================================================
--- /applications/editors/josm/plugins/utilsplugin2/build.xml	(revision 28550)
+++ /applications/editors/josm/plugins/utilsplugin2/build.xml	(revision 28551)
@@ -30,5 +30,5 @@
 <project name="utilsplugin2" default="dist" basedir=".">
     <!-- enter the SVN commit message -->
-    <property name="commit.message" value="Utilsplugin2: all inside multipolygon selection - fixed"/>
+    <property name="commit.message" value="Utilsplugin2: SplitObjects now can use line as a splitter"/>
     <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
     <property name="plugin.main.version" value="4980"/>
Index: /applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitObjectAction.java
===================================================================
--- /applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitObjectAction.java	(revision 28550)
+++ /applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitObjectAction.java	(revision 28551)
@@ -21,4 +21,5 @@
 import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.actions.SplitWayAction;
+import org.openstreetmap.josm.command.DeleteCommand;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -31,5 +32,5 @@
  * The closed ways are just split at the selected nodes (which must be exactly two).
  * The nodes remain in their original order.
- * 
+ *
  * This is similar to SplitWayAction with the addition that the split ways are closed
  * immediately.
@@ -54,4 +55,5 @@
      * of the split actions outlined above, and if yes, calls the splitObject method.
      */
+    @Override
     public void actionPerformed(ActionEvent e) {
         Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected();
@@ -72,6 +74,19 @@
 
         Way selectedWay = null;
-        if (!selectedWays.isEmpty()){
-            selectedWay = selectedWays.get(0);
+        Way splitWay = null;
+
+        if (selectedNodes.isEmpty()) {              // if no nodes are selected - try to find split way
+            for (Way selWay : selectedWays) {       // we assume not more 2 ways in the list
+                if (selWay != null &&               // If one of selected ways is not closed we have it to get split points
+                    selWay.isUsable() &&
+                    !selWay.isClosed() &&
+                    selWay.getKeys().isEmpty()) {
+                        selectedNodes.add(selWay.firstNode());
+                        selectedNodes.add(selWay.lastNode());
+                        splitWay = selWay;
+                } else {
+                    selectedWay = selWay;           // use another way as selected way
+                }
+            }
         }
 
@@ -189,10 +204,29 @@
         if (wayChunks != null) {
             // close the chunks
-            for (List<Node> wayChunk : wayChunks) {
-                wayChunk.add(wayChunk.get(0));
+            // update the logic - if we have splitWay not null, we have to add points from it to both chunks (in the correct direction)
+            if (splitWay == null) {
+                for (List<Node> wayChunk : wayChunks) {
+                    wayChunk.add(wayChunk.get(0));
+                }
+            } else {
+                for (List<Node> wayChunk : wayChunks) {
+                    // check direction of the chunk and add splitWay nodes in the correct order
+                    List<Node> way = splitWay.getNodes();
+                    if (wayChunk.get(0).equals(splitWay.firstNode())) {
+                        // add way to the end in the opposite direction.
+                        way.remove(way.size()-1); // remove the last node
+                        Collections.reverse(way);
+                    } else {
+                        // add way to the end in the given direction, remove the first node
+                        way.remove(0);
+                    }
+                    wayChunk.addAll(way);
+                }
             }
             SplitWayAction.SplitWayResult result = SplitWayAction.splitWay(getEditLayer(), selectedWay, wayChunks, Collections.<OsmPrimitive>emptyList());
             //            SplitObjectResult result = splitObject(getEditLayer(),selectedWay, wayChunks);
             Main.main.undoRedo.add(result.getCommand());
+            if (splitWay != null)
+                Main.main.undoRedo.add(new DeleteCommand(splitWay));
             getCurrentDataSet().setSelected(result.getNewSelection());
         }
@@ -207,9 +241,9 @@
      */
     private boolean checkSelection(Collection<? extends OsmPrimitive> selection) {
-        boolean way = false;
         int node = 0;
+        int ways = 0;
         for (OsmPrimitive p : selection) {
-            if (p instanceof Way && !way) {
-                way = true;
+            if (p instanceof Way) {
+                ways++;
             } else if (p instanceof Node) {
                 node++;
@@ -217,5 +251,5 @@
                 return false;
         }
-        return node == 2;
+        return node == 2 || ways == 1 || ways == 2; //only 2 nodes selected. one split-way selected. split-way + way to split.
     }
 
