Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectBoundaryAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectBoundaryAction.java	(revision 33296)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectBoundaryAction.java	(revision 33297)
@@ -17,4 +17,5 @@
 import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.actions.SelectByInternalPointAction;
+import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -39,50 +40,52 @@
     @Override
     public void actionPerformed(ActionEvent e) {
-        Set<Way> selectedWays = OsmPrimitive.getFilteredSet(getLayerManager().getEditDataSet().getSelected(), Way.class);
-        Set<Node> selectedNodes = OsmPrimitive.getFilteredSet(getLayerManager().getEditDataSet().getSelected(), Node.class);
+        DataSet ds = getLayerManager().getEditDataSet();
+        if (ds != null) {
+            Collection<Way> selectedWays = ds.getSelectedWays();
+            Collection<Node> selectedNodes = ds.getSelectedNodes();
 
-        Set<Way> newWays = new HashSet<>();
+            Set<Way> newWays = new HashSet<>();
 
-        Way w = null;
+            Way w = null;
 
-        if (selectedWays.isEmpty()) {
-            if (selectedNodes.size() == 1) {
-                for (OsmPrimitive p : selectedNodes.iterator().next().getReferrers()) {
-                    if (p instanceof Way && p.isSelectable()) {
-                        w = (Way) p;
-                        break;
+            if (selectedWays.isEmpty()) {
+                if (selectedNodes.size() == 1) {
+                    for (OsmPrimitive p : selectedNodes.iterator().next().getReferrers()) {
+                        if (p instanceof Way && p.isSelectable()) {
+                            w = (Way) p;
+                            break;
+                        }
                     }
+                } else {
+                    Point p = Main.map.mapView.getMousePosition();
+                    SelectByInternalPointAction.performSelection(Main.map.mapView.getEastNorth(p.x, p.y), false, false);
+                    return;
                 }
+            } else if (selectedWays.size() == 1) {
+                w = selectedWays.iterator().next();
+            } else if (selectedWays.contains(lastUsedStartingWay)) {
+                w = lastUsedStartingWay; //repeated call for selected way
+                lastUsedLeft = !lastUsedLeft;
+            }
+
+            if (w == null) return; //no starting way found
+            if (!w.isSelectable()) return;
+            if (w.isClosed()) return;
+            if (w.getNodesCount() < 2) return;
+
+            newWays.add(w);
+            lastUsedStartingWay = w;
+
+            // try going left at each turn
+            if (!NodeWayUtils.addAreaBoundary(w, newWays, lastUsedLeft)) {
+                NodeWayUtils.addAreaBoundary(w, newWays, !lastUsedLeft); // try going right at each turn
+            }
+
+            if (!newWays.isEmpty()) {
+                ds.setSelected(newWays);
             } else {
-                Point p = Main.map.mapView.getMousePosition();
-                SelectByInternalPointAction.performSelection(Main.map.mapView.getEastNorth(p.x, p.y), false, false);
-                return;
+                new Notification(tr("Nothing found. Please select way that is a part of some polygon formed by connected ways"))
+                .setIcon(JOptionPane.WARNING_MESSAGE).show();
             }
-        } else if (selectedWays.size() == 1) {
-            w = selectedWays.iterator().next();
-        } else if (selectedWays.contains(lastUsedStartingWay)) {
-            w = lastUsedStartingWay; //repeated call for selected way
-            lastUsedLeft = !lastUsedLeft;
-        }
-
-
-        if (w == null) return; //no starting way found
-        if (!w.isSelectable()) return;
-        if (w.isClosed()) return;
-        if (w.getNodesCount() < 2) return;
-
-        newWays.add(w);
-        lastUsedStartingWay = w;
-
-        // try going left at each turn
-        if (!NodeWayUtils.addAreaBoundary(w, newWays, lastUsedLeft)) {
-            NodeWayUtils.addAreaBoundary(w, newWays, !lastUsedLeft); // try going right at each turn
-        }
-
-        if (!newWays.isEmpty()) {
-            getLayerManager().getEditDataSet().setSelected(newWays);
-        } else {
-            new Notification(tr("Nothing found. Please select way that is a part of some polygon formed by connected ways"))
-            .setIcon(JOptionPane.WARNING_MESSAGE).show();
         }
     }
@@ -95,8 +98,5 @@
     @Override
     protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
-        if (selection == null) {
-            return;
-        }
-        setEnabled(true);
+        setEnabled(selection != null && !selection.isEmpty());
     }
 }
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModNodesAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModNodesAction.java	(revision 33296)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModNodesAction.java	(revision 33297)
@@ -37,49 +37,44 @@
     public void actionPerformed(ActionEvent e) {
         DataSet ds = getLayerManager().getEditDataSet();
-        Collection<OsmPrimitive> selection = ds.getSelected();
-        Set<Node> selectedNodes = OsmPrimitive.getFilteredSet(selection, Node.class);
-        ds.clearSelection(selectedNodes);
-        Command cmd = null;
+        if (ds != null) {
+            Collection<OsmPrimitive> selection = ds.getSelected();
+            ds.clearSelection(OsmPrimitive.getFilteredSet(selection, Node.class));
+            Command cmd = null;
 
-        if (Main.main.undoRedo.commands == null) return;
-        int num = Main.main.undoRedo.commands.size();
-        if (num == 0) return;
-        int k = 0, idx;
-        if (selection != null && !selection.isEmpty() && selection.hashCode() == lastHash) {
-            // we are selecting next command in history if nothing is selected
-            idx = Main.main.undoRedo.commands.indexOf(lastCmd);
-        } else {
-            idx = num;
+            if (Main.main.undoRedo.commands == null) return;
+            int num = Main.main.undoRedo.commands.size();
+            if (num == 0) return;
+            int k = 0, idx;
+            if (selection != null && !selection.isEmpty() && selection.hashCode() == lastHash) {
+                // we are selecting next command in history if nothing is selected
+                idx = Main.main.undoRedo.commands.indexOf(lastCmd);
+            } else {
+                idx = num;
+            }
+
+            Set<Node> nodes = new HashSet<>(10);
+            do {  //  select next history element
+                if (idx > 0) idx--; else idx = num-1;
+                cmd = Main.main.undoRedo.commands.get(idx);
+                Collection<? extends OsmPrimitive> pp = cmd.getParticipatingPrimitives();
+                nodes.clear();
+                for (OsmPrimitive p : pp) {  // find all affected ways
+                    if (p instanceof Node && !p.isDeleted()) nodes.add((Node) p);
+                }
+                if (!nodes.isEmpty()) {
+                    ds.setSelected(nodes);
+                    lastCmd = cmd; // remember last used command and last selection
+                    lastHash = ds.getSelected().hashCode();
+                    return;
+                }
+                k++;
+            } while (k < num); // try to find previous command if this affects nothing
+            lastCmd = null; lastHash = 0;
         }
-
-        Set<Node> nodes = new HashSet<>(10);
-        do {  //  select next history element
-            if (idx > 0) idx--; else idx = num-1;
-            cmd = Main.main.undoRedo.commands.get(idx);
-            Collection<? extends OsmPrimitive> pp = cmd.getParticipatingPrimitives();
-            nodes.clear();
-            for (OsmPrimitive p : pp) {  // find all affected ways
-                if (p instanceof Node && !p.isDeleted()) nodes.add((Node) p);
-            }
-            if (!nodes.isEmpty()) {
-                ds.setSelected(nodes);
-                lastCmd = cmd; // remember last used command and last selection
-                lastHash = ds.getSelected().hashCode();
-                return;
-            }
-            k++;
-            //System.out.println("no nodes found, previous...");
-        } while (k < num); // try to find previous command if this affects nothing
-        lastCmd = null; lastHash = 0;
     }
 
     @Override
     protected void updateEnabledState() {
-        updateEnabledStateOnCurrentSelection();
-    }
-
-    @Override
-    protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
-        setEnabled(true);
+        setEnabled(getLayerManager().getEditDataSet() != null);
     }
 }
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModWaysAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModWaysAction.java	(revision 33296)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModWaysAction.java	(revision 33297)
@@ -38,49 +38,45 @@
     public void actionPerformed(ActionEvent e) {
         DataSet ds = getLayerManager().getEditDataSet();
-        Collection<OsmPrimitive> selection = ds.getSelected();
-        Set<Node> selectedNodes = OsmPrimitive.getFilteredSet(selection, Node.class);
-        ds.clearSelection(selectedNodes);
-        Command cmd;
+        if (ds != null) {
+            Collection<OsmPrimitive> selection = ds.getSelected();
+            ds.clearSelection(OsmPrimitive.getFilteredSet(selection, Node.class));
+            Command cmd;
 
-        if (Main.main.undoRedo.commands == null) return;
-        int num = Main.main.undoRedo.commands.size();
-        if (num == 0) return;
-        int k = 0, idx;
-        if (selection != null && !selection.isEmpty() && selection.hashCode() == lastHash) {
-            // we are selecting next command in history if nothing is selected
-            idx = Main.main.undoRedo.commands.indexOf(lastCmd);
-        } else {
-            idx = num;
+            if (Main.main.undoRedo.commands == null) return;
+            int num = Main.main.undoRedo.commands.size();
+            if (num == 0) return;
+            int k = 0, idx;
+            if (selection != null && !selection.isEmpty() && selection.hashCode() == lastHash) {
+                // we are selecting next command in history if nothing is selected
+                idx = Main.main.undoRedo.commands.indexOf(lastCmd);
+            } else {
+                idx = num;
+            }
+
+            Set<Way> ways = new HashSet<>(10);
+            do {  //  select next history element
+                if (idx > 0) idx--; else idx = num-1;
+                cmd = Main.main.undoRedo.commands.get(idx);
+                Collection<? extends OsmPrimitive> pp = cmd.getParticipatingPrimitives();
+                ways.clear();
+                for (OsmPrimitive p : pp) {  // find all affected ways
+                    if (p instanceof Way && !p.isDeleted()) ways.add((Way) p);
+                }
+                if (!ways.isEmpty() && !ds.getSelected().containsAll(ways)) {
+                    ds.setSelected(ways);
+                    lastCmd = cmd; // remember last used command and last selection
+                    lastHash = ds.getSelected().hashCode();
+                    return;
+                }
+                k++;
+            } while (k < num); // try to find previous command if this affects nothing
+            lastCmd = null;
+            lastHash = 0;
         }
-
-        Set<Way> ways = new HashSet<>(10);
-        do {  //  select next history element
-            if (idx > 0) idx--; else idx = num-1;
-            cmd = Main.main.undoRedo.commands.get(idx);
-            Collection<? extends OsmPrimitive> pp = cmd.getParticipatingPrimitives();
-            ways.clear();
-            for (OsmPrimitive p : pp) {  // find all affected ways
-                if (p instanceof Way && !p.isDeleted()) ways.add((Way) p);
-            }
-            if (!ways.isEmpty() && !ds.getSelected().containsAll(ways)) {
-                ds.setSelected(ways);
-                lastCmd = cmd; // remember last used command and last selection
-                lastHash = ds.getSelected().hashCode();
-                return;
-            }
-            k++;
-        } while (k < num); // try to find previous command if this affects nothing
-        lastCmd = null;
-        lastHash = 0;
     }
 
     @Override
     protected void updateEnabledState() {
-        updateEnabledStateOnCurrentSelection();
-    }
-
-    @Override
-    protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
-        setEnabled(true);
+        setEnabled(getLayerManager().getEditDataSet() != null);
     }
 }
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/UndoSelectionAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/UndoSelectionAction.java	(revision 33296)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/UndoSelectionAction.java	(revision 33297)
@@ -36,42 +36,39 @@
     public void actionPerformed(ActionEvent e) {
         DataSet ds = getLayerManager().getEditDataSet();
-        LinkedList<Collection<? extends OsmPrimitive>> history = ds.getSelectionHistory();
-        if (history == null || history.isEmpty()) return; // empty history
-        int num = history.size();
+        if (ds != null) {
+            LinkedList<Collection<? extends OsmPrimitive>> history = ds.getSelectionHistory();
+            if (history == null || history.isEmpty()) return; // empty history
+            int num = history.size();
 
-        Collection<OsmPrimitive> selection = ds.getSelected();
+            Collection<OsmPrimitive> selection = ds.getSelected();
 
-        if (selection != null && selection.hashCode() != myAutomaticSelectionHash) {
-            // manual selection or another pluging selection noticed
-            index = history.indexOf(lastSel);
-            // first is selected, next list is previous selection
+            if (selection != null && selection.hashCode() != myAutomaticSelectionHash) {
+                // manual selection or another pluging selection noticed
+                index = history.indexOf(lastSel);
+                // first is selected, next list is previous selection
+            }
+            int k = 0;
+            Set<OsmPrimitive> newsel = new HashSet<>();
+            do {
+                if (index+1 < history.size()) index++; else index = 0;
+                Collection<? extends OsmPrimitive> histsel = history.get(index);
+                // remove deleted entities from selection
+                newsel.clear();
+                newsel.addAll(histsel);
+                newsel.retainAll(ds.allNonDeletedPrimitives());
+                if (!newsel.isEmpty()) break;
+                k++;
+            } while (k < num);
+
+            ds.setSelected(newsel);
+            lastSel = ds.getSelected();
+            myAutomaticSelectionHash = lastSel.hashCode();
+            // remember last automatic selection
         }
-        int k = 0;
-        Set<OsmPrimitive> newsel = new HashSet<>();
-        do {
-            if (index+1 < history.size()) index++; else index = 0;
-            Collection<? extends OsmPrimitive> histsel = history.get(index);
-            // remove deleted entities from selection
-            newsel.clear();
-            newsel.addAll(histsel);
-            newsel.retainAll(ds.allNonDeletedPrimitives());
-            if (newsel.size() > 0) break;
-            k++;
-        } while (k < num);
-
-        ds.setSelected(newsel);
-        lastSel = ds.getSelected();
-        myAutomaticSelectionHash = lastSel.hashCode();
-        // remeber last automatic selection
     }
 
     @Override
     protected void updateEnabledState() {
-        updateEnabledStateOnCurrentSelection();
-    }
-
-    @Override
-    protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
-        setEnabled(true);
+        setEnabled(getLayerManager().getEditDataSet() != null);
     }
 }
