Index: /trunk/src/org/openstreetmap/josm/actions/relation/AbstractRelationAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/relation/AbstractRelationAction.java	(revision 5793)
+++ /trunk/src/org/openstreetmap/josm/actions/relation/AbstractRelationAction.java	(revision 5794)
@@ -1,8 +1,10 @@
+// License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.actions.relation;
-
 
 import java.util.Collection;
 import java.util.Collections;
+
 import javax.swing.AbstractAction;
+
 import org.openstreetmap.josm.data.osm.Relation;
 
@@ -10,4 +12,5 @@
  * Ancestor for all actions that want to work with relation collection and 
  * to be disabled is the collection is empty
+ * @since 5793
  */
 public abstract class AbstractRelationAction extends AbstractAction {
@@ -15,5 +18,6 @@
     
     /**
-     * This fuction should be called to specify working set of relations
+     * Specifies the working set of relations.
+     * @param relations The new working set of relations. Can be null or empty
      */
     public void setRelations(Collection<Relation> relations) {
Index: /trunk/src/org/openstreetmap/josm/actions/relation/DownloadMembersAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/relation/DownloadMembersAction.java	(revision 5793)
+++ /trunk/src/org/openstreetmap/josm/actions/relation/DownloadMembersAction.java	(revision 5794)
@@ -1,8 +1,9 @@
+// License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.actions.relation;
 
+import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
+import static org.openstreetmap.josm.tools.I18n.tr;
+
 import java.awt.event.ActionEvent;
-import static javax.swing.Action.NAME;
-import static javax.swing.Action.SHORT_DESCRIPTION;
-import static javax.swing.Action.SMALL_ICON;
 
 import org.openstreetmap.josm.Main;
@@ -10,12 +11,13 @@
 import org.openstreetmap.josm.tools.ImageProvider;
 
-import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
-import static org.openstreetmap.josm.tools.I18n.tr;
-
 /**
  * The action for downloading members of relations
+ * @since 5793
  */
 public class DownloadMembersAction extends AbstractRelationAction {
 
+    /**
+     * Constructs a new <code>DownloadMembersAction</code>.
+     */
     public DownloadMembersAction() {
         putValue(SHORT_DESCRIPTION, tr("Download all members of the selected relations"));
@@ -26,5 +28,5 @@
     
     public void actionPerformed(ActionEvent e) {
-        if (!isEnabled() || relations.isEmpty()) return;
+        if (!isEnabled() || relations.isEmpty() || Main.map==null || Main.map.mapView==null) return;
         Main.worker.submit(new DownloadRelationTask(relations, Main.map.mapView.getEditLayer()));
     }
Index: /trunk/src/org/openstreetmap/josm/actions/relation/DownloadSelectedIncompleteMembersAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/relation/DownloadSelectedIncompleteMembersAction.java	(revision 5793)
+++ /trunk/src/org/openstreetmap/josm/actions/relation/DownloadSelectedIncompleteMembersAction.java	(revision 5794)
@@ -1,3 +1,6 @@
+// License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.actions.relation;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
 
 import java.awt.event.ActionEvent;
@@ -5,8 +8,4 @@
 import java.util.HashSet;
 import java.util.Set;
-import static javax.swing.Action.NAME;
-import static javax.swing.Action.SHORT_DESCRIPTION;
-import static javax.swing.Action.SMALL_ICON;
-
 
 import org.openstreetmap.josm.Main;
@@ -16,11 +15,13 @@
 import org.openstreetmap.josm.tools.ImageProvider;
 
-import static org.openstreetmap.josm.tools.I18n.tr;
-
 /**
  * Action for downloading incomplete members of selected relations
+ * @since 5793
  */
 public class DownloadSelectedIncompleteMembersAction extends AbstractRelationAction {
 
+    /**
+     * Constructs a new <code>DownloadSelectedIncompleteMembersAction</code>.
+     */
     public DownloadSelectedIncompleteMembersAction() {
         putValue(SHORT_DESCRIPTION, tr("Download incomplete members of selected relations"));
@@ -29,4 +30,9 @@
     }
 
+    /**
+     * Returns the set of incomplete members of the given relations.
+     * @param rels The relations to inspect.
+     * @return The set of incomplete members of the given relations.
+     */
     public Set<OsmPrimitive> buildSetOfIncompleteMembers(Collection<Relation> rels) {
         Set<OsmPrimitive> ret = new HashSet<OsmPrimitive>();
@@ -38,5 +44,5 @@
 
     public void actionPerformed(ActionEvent e) {
-        if (!isEnabled() || relations.isEmpty()) return;
+        if (!isEnabled() || relations.isEmpty() || Main.map==null || Main.map.mapView==null) return;
         Main.worker.submit(new DownloadRelationMemberTask(
                 relations,
@@ -44,4 +50,3 @@
                 Main.map.mapView.getEditLayer()));
     }
-
 }
Index: /trunk/src/org/openstreetmap/josm/actions/relation/EditRelationAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/relation/EditRelationAction.java	(revision 5793)
+++ /trunk/src/org/openstreetmap/josm/actions/relation/EditRelationAction.java	(revision 5794)
@@ -1,13 +1,12 @@
+// License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.actions.relation;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
 
 import java.awt.event.ActionEvent;
 import java.util.Collection;
 import java.util.HashSet;
-import javax.swing.AbstractAction;
-import static javax.swing.Action.NAME;
-import static javax.swing.Action.SHORT_DESCRIPTION;
-import static javax.swing.Action.SMALL_ICON;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
+import java.util.Set;
+
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -15,11 +14,16 @@
 import org.openstreetmap.josm.data.osm.RelationMember;
 import org.openstreetmap.josm.gui.dialogs.relation.RelationEditor;
-import static org.openstreetmap.josm.tools.I18n.tr;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.tools.ImageProvider;
 
 /**
  * The action for editing a relation 
+ * @since 5793
  */
 public class EditRelationAction extends AbstractRelationAction  {
+
+    /**
+     * Constructs a new <code>EditRelationAction</code>.
+     */
     public EditRelationAction() {
         putValue(NAME, tr("Edit"));
@@ -28,10 +32,20 @@
     }
 
-    public static Collection<RelationMember> getMembersForCurrentSelection(Relation r) {
-        Collection<RelationMember> members = new HashSet<RelationMember>();
-        Collection<OsmPrimitive> selection = Main.map.mapView.getEditLayer().data.getSelected();
-        for (RelationMember member: r.getMembers()) {
-            if (selection.contains(member.getMember())) {
-                members.add(member);
+    /**
+     * Returns the set of currently selected relation members for the given relation. 
+     * @param r The relation to inspect
+     * @return The set of currently selected relation members for the given relation.
+     */
+    public static Set<RelationMember> getMembersForCurrentSelection(Relation r) {
+        Set<RelationMember> members = new HashSet<RelationMember>();
+        if (Main.map != null && Main.map.mapView != null) {
+            OsmDataLayer editLayer = Main.map.mapView.getEditLayer();
+            if (editLayer != null && editLayer.data != null) {
+                Collection<OsmPrimitive> selection = editLayer.data.getSelected();
+                for (RelationMember member: r.getMembers()) {
+                    if (selection.contains(member.getMember())) {
+                        members.add(member);
+                    }
+                }
             }
         }
@@ -39,6 +53,10 @@
     }
 
+    /**
+     * Launches relation editor for the given relation.
+     * @param toEdit The relation to edit
+     */
     public static void launchEditor(Relation toEdit) {
-        if (toEdit == null) return;
+        if (toEdit == null || Main.map==null || Main.map.mapView==null) return;
         RelationEditor.getEditor(Main.map.mapView.getEditLayer(), toEdit,
                 getMembersForCurrentSelection(toEdit)).setVisible(true);
@@ -55,5 +73,3 @@
         setEnabled( relations.size()==1 );
     }
-    
-    
 }
Index: /trunk/src/org/openstreetmap/josm/actions/relation/SelectInRelationListAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/relation/SelectInRelationListAction.java	(revision 5793)
+++ /trunk/src/org/openstreetmap/josm/actions/relation/SelectInRelationListAction.java	(revision 5794)
@@ -1,19 +1,21 @@
+// License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.actions.relation;
 
+import static org.openstreetmap.josm.tools.I18n.tr;
+
 import java.awt.event.ActionEvent;
-import static javax.swing.Action.NAME;
-import static javax.swing.Action.SHORT_DESCRIPTION;
-import static javax.swing.Action.SMALL_ICON;
-
 
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.tools.ImageProvider;
 
-import static org.openstreetmap.josm.tools.I18n.tr;
-
 /**
  * The action for activating a relation in relation list dialog
+ * @since 5793
  */
 public class SelectInRelationListAction extends AbstractRelationAction {
+
+    /**
+     * Constructs a new <code>SelectInRelationListAction</code>.
+     */
     public SelectInRelationListAction() {
         putValue(NAME, tr("Select in relation list"));
@@ -23,7 +25,6 @@
 
     public void actionPerformed(ActionEvent e) {
-        if (!isEnabled() || relations.isEmpty()) return;
-        if (Main.map.relationListDialog!=null)
-            Main.map.relationListDialog.selectRelations(relations);
+        if (!isEnabled() || relations.isEmpty() || Main.map==null || Main.map.relationListDialog==null) return;
+        Main.map.relationListDialog.selectRelations(relations);
     }
 }
Index: /trunk/src/org/openstreetmap/josm/actions/relation/SelectMembersAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/relation/SelectMembersAction.java	(revision 5793)
+++ /trunk/src/org/openstreetmap/josm/actions/relation/SelectMembersAction.java	(revision 5794)
@@ -1,9 +1,9 @@
+// License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.actions.relation;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
 
 import java.awt.event.ActionEvent;
 import java.util.HashSet;
-import static javax.swing.Action.NAME;
-import static javax.swing.Action.SHORT_DESCRIPTION;
-import static javax.swing.Action.SMALL_ICON;
 
 import org.openstreetmap.josm.Main;
@@ -12,11 +12,16 @@
 import org.openstreetmap.josm.tools.ImageProvider;
 
-import static org.openstreetmap.josm.tools.I18n.tr;
+/**
+ * Sets the current selection to the list of relations selected in this dialog
+ * @since 5793
+ */
+public class SelectMembersAction extends AbstractRelationAction {
+    
+    private final boolean add;
 
-/**
-* Sets the current selection to the list of relations selected in this dialog
-*/
-public class SelectMembersAction extends AbstractRelationAction {
-    boolean add;
+    /**
+     * Constructs a new <code>SelectMembersAction</code>.
+     * @param add if <code>true</code>, the members will be added to current selection. If <code>false</code>, the members will replace the current selection.
+     */
     public SelectMembersAction(boolean add) {
         putValue(SHORT_DESCRIPTION,add ? tr("Add the members of all selected relations to current selection")
@@ -29,11 +34,11 @@
     @Override
     public void actionPerformed(ActionEvent e) {
-        if (!isEnabled() || relations.isEmpty()) return;
+        if (!isEnabled() || relations.isEmpty() || Main.map==null || Main.map.mapView==null) return;
         
         HashSet<OsmPrimitive> members = new HashSet<OsmPrimitive>();
-        for(Relation r: relations) {
+        for (Relation r: relations) {
             members.addAll(r.getMemberPrimitives());
         }
-        if(add) {
+        if (add) {
             Main.map.mapView.getEditLayer().data.addSelected(members);
         } else {
Index: /trunk/src/org/openstreetmap/josm/actions/relation/SelectRelationAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/relation/SelectRelationAction.java	(revision 5793)
+++ /trunk/src/org/openstreetmap/josm/actions/relation/SelectRelationAction.java	(revision 5794)
@@ -1,20 +1,25 @@
+// License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.actions.relation;
 
+import static org.openstreetmap.josm.tools.I18n.tr;
+
 import java.awt.event.ActionEvent;
-import static javax.swing.Action.NAME;
-import static javax.swing.Action.SHORT_DESCRIPTION;
-import static javax.swing.Action.SMALL_ICON;
+
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.tools.ImageProvider;
 
-import static org.openstreetmap.josm.tools.I18n.tr;
-
 /**
  * Sets the current selection to specified list of relations 
+ * @since 5793
  */
 public class SelectRelationAction extends AbstractRelationAction {
-    boolean add;
+    
+    private final boolean add;
 
+    /**
+     * Constructs a new <code>SelectRelationAction</code>.
+     * @param add if <code>true</code>, the relation will be added to current selection. If <code>false</code>, the relation will replace the current selection.
+     */
     public SelectRelationAction(boolean add) {
         putValue(SHORT_DESCRIPTION, add ? tr("Add the selected relations to the current selection") : tr("Set the current selection to the list of selected relations"));
@@ -25,5 +30,5 @@
 
     public void actionPerformed(ActionEvent e) {
-        if (!isEnabled() || relations.isEmpty()) return;
+        if (!isEnabled() || relations.isEmpty() || Main.map==null || Main.map.mapView==null) return;
         OsmDataLayer editLayer = Main.map.mapView.getEditLayer();
         if (editLayer==null || editLayer.data==null) return;
