Index: /applications/editors/josm/plugins/relcontext/src/relcontext/ChosenRelation.java
===================================================================
--- /applications/editors/josm/plugins/relcontext/src/relcontext/ChosenRelation.java	(revision 25668)
+++ /applications/editors/josm/plugins/relcontext/src/relcontext/ChosenRelation.java	(revision 25669)
@@ -1,25 +1,13 @@
 package relcontext;
 
-import java.awt.AlphaComposite;
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Graphics2D;
-import java.awt.Point;
+import java.awt.*;
 import java.awt.geom.GeneralPath;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.Bounds;
-import org.openstreetmap.josm.data.osm.Node;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
-import org.openstreetmap.josm.data.osm.Relation;
-import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.data.osm.*;
+import org.openstreetmap.josm.data.osm.event.*;
 import org.openstreetmap.josm.gui.MapView;
 import org.openstreetmap.josm.gui.MapView.EditLayerChangeListener;
-import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
-import org.openstreetmap.josm.gui.layer.Layer;
 import org.openstreetmap.josm.gui.layer.MapViewPaintable;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
@@ -30,7 +18,7 @@
  * @author Zverik
  */
-public class ChosenRelation implements EditLayerChangeListener, MapViewPaintable {
+public class ChosenRelation implements EditLayerChangeListener, MapViewPaintable, DataSetListener {
     private Relation chosenRelation = null;
-    private List<ChosenRelationListener> chosenRelationListeners = new ArrayList<ChosenRelationListener>();
+    private Set<ChosenRelationListener> chosenRelationListeners = new HashSet<ChosenRelationListener>();
 
     public void set( Relation rel ) {
@@ -42,8 +30,10 @@
         analyse();
         Main.map.mapView.repaint();
-        for( ChosenRelationListener listener : chosenRelationListeners ) {
+        fireRelationChanged(oldRel);
+    }
+
+    protected void fireRelationChanged( Relation oldRel ) {
+        for( ChosenRelationListener listener : chosenRelationListeners )
             listener.chosenRelationChanged(oldRel, chosenRelation);
-        }
-        return;
     }
 
@@ -91,4 +81,6 @@
         }
 
+        Stroke oldStroke = g.getStroke();
+        Composite oldComposite = g.getComposite();
         g.setColor(Color.yellow);
         g.setStroke(new BasicStroke(6, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
@@ -116,5 +108,27 @@
             // todo: closedway, multipolygon - ?
         }
-        g.setStroke(new BasicStroke(1)); // from building_tools; is it really needed?
+        g.setStroke(oldStroke);
+        g.setComposite(oldComposite);
     }
+
+    public void relationMembersChanged( RelationMembersChangedEvent event ) {
+        if( chosenRelation != null && event.getRelation().equals(chosenRelation) )
+            fireRelationChanged(chosenRelation);
+    }
+    
+    public void tagsChanged( TagsChangedEvent event ) {
+        if( chosenRelation != null && event.getPrimitive().equals(chosenRelation) )
+            fireRelationChanged(chosenRelation);
+    }
+
+    public void dataChanged( DataChangedEvent event ) {
+        if( chosenRelation != null )
+            fireRelationChanged(chosenRelation);
+    }
+
+    public void nodeMoved( NodeMovedEvent event ) {}
+    public void otherDatasetChange( AbstractDatasetChangedEvent event ) {}
+    public void primtivesAdded( PrimitivesAddedEvent event ) {}
+    public void primtivesRemoved( PrimitivesRemovedEvent event ) {}
+    public void wayNodesChanged( WayNodesChangedEvent event ) {}
 }
Index: /applications/editors/josm/plugins/relcontext/src/relcontext/ChosenRelationComponent.java
===================================================================
--- /applications/editors/josm/plugins/relcontext/src/relcontext/ChosenRelationComponent.java	(revision 25668)
+++ /applications/editors/josm/plugins/relcontext/src/relcontext/ChosenRelationComponent.java	(revision 25669)
@@ -32,5 +32,5 @@
             public void mouseClicked( MouseEvent e ) {
                 if( chRel.get() != null && Main.map.mapView.getEditLayer() != null )
-                    Main.map.mapView.getEditLayer().data.setSelected(chRel.get().getMemberPrimitives());
+                    Main.map.mapView.getEditLayer().data.setSelected(chRel.get());
             }
         });
@@ -38,6 +38,41 @@
 
     public void chosenRelationChanged( Relation oldRelation, Relation newRelation ) {
-        setText(newRelation == null ? "" : newRelation.getDisplayName(DefaultNameFormatter.getInstance()));
+        setText(prepareText(newRelation));
         repaint();
     }
+    
+    private final static String[] typeKeys = new String[] {
+        "natural", "landuse", "place", "waterway", "leisure", "amenity"
+    };
+
+    protected String prepareText( Relation rel ) {
+        if( rel == null )
+            return "";
+
+        String type = rel.get("type");
+        if( type == null || type.length() == 0 )
+            type = "-";
+
+        String tag = null;
+        for( int i = 0; i < typeKeys.length && tag == null; i++ )
+            if( rel.hasKey(typeKeys[i]))
+                tag = typeKeys[i];
+        if( tag != null )
+            tag = tag.substring(0, 2) + "=" + rel.get(tag);
+
+        String name = rel.get("name");
+        if( name == null && rel.hasKey("place_name") )
+            name = rel.get("place_name");
+
+        StringBuilder sb = new StringBuilder();
+        sb.append(type.substring(0, 1));
+        if( type.equals("boundary") && rel.hasKey("admin_level") )
+            sb.append(rel.get("admin_level"));
+        if( name != null )
+            sb.append(" \"").append(name).append('"');
+        if( tag != null )
+            sb.append("; ").append(tag);
+
+        return sb.toString();
+    }
 }
Index: /applications/editors/josm/plugins/relcontext/src/relcontext/RelContextDialog.java
===================================================================
--- /applications/editors/josm/plugins/relcontext/src/relcontext/RelContextDialog.java	(revision 25668)
+++ /applications/editors/josm/plugins/relcontext/src/relcontext/RelContextDialog.java	(revision 25669)
@@ -1,8 +1,5 @@
 package relcontext;
 
-import java.awt.event.MouseEvent;
-import java.util.Collection;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import java.beans.PropertyChangeEvent;
 import static org.openstreetmap.josm.tools.I18n.tr;
 
@@ -10,15 +7,8 @@
 import java.awt.FlowLayout;
 import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
 import java.awt.event.MouseAdapter;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-import javax.swing.DefaultListModel;
-import javax.swing.JButton;
+import java.beans.PropertyChangeListener;
 
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.ListSelectionModel;
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.SelectionChangedListener;
@@ -26,17 +16,17 @@
 import org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode;
 import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
-
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.gui.MapView;
 import org.openstreetmap.josm.gui.MapView.EditLayerChangeListener;
-import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
 import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
 import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
-import org.openstreetmap.josm.gui.layer.Layer;
 import org.openstreetmap.josm.tools.Shortcut;
-import relcontext.actions.AddRemoveMemberAction;
-import relcontext.actions.ClearChosenRelationAction;
-import relcontext.actions.CreateRelationAction;
-import relcontext.actions.DownloadChosenRelationAction;
-import relcontext.actions.EditChosenRelationAction;
+
+import java.util.*;
+import javax.swing.*;
+import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.data.osm.event.DatasetEventManager;
+import relcontext.actions.*;
 
 /**
@@ -49,4 +39,5 @@
     private final DefaultListModel relationsData;
     private ChosenRelation chosenRelation;
+    private JPanel topLine;
 
     public RelContextDialog() {
@@ -84,5 +75,5 @@
 
         // [±][X] relation U [AZ][Down][Edit]
-        JPanel topLine = new JPanel(new BorderLayout());
+        topLine = new JPanel(new BorderLayout());
         JPanel topLeftButtons = new JPanel(new FlowLayout(FlowLayout.LEFT));
         topLeftButtons.add(new JButton(new AddRemoveMemberAction(chosenRelation)));
@@ -91,12 +82,23 @@
         topLine.add(new ChosenRelationComponent(chosenRelation), BorderLayout.CENTER);
         JPanel topRightButtons = new JPanel(new FlowLayout(FlowLayout.RIGHT));
-        topRightButtons.add(new JButton(new DownloadChosenRelationAction(chosenRelation)));
+        final Action downloadChosenRelationAction = new DownloadChosenRelationAction(chosenRelation);
+        final JButton downloadButton = new JButton(downloadChosenRelationAction);
+        topRightButtons.add(downloadButton);
         topRightButtons.add(new JButton(new EditChosenRelationAction(chosenRelation)));
         topLine.add(topRightButtons, BorderLayout.EAST);
         rcPanel.add(topLine, BorderLayout.NORTH);
 
+        downloadChosenRelationAction.addPropertyChangeListener(new PropertyChangeListener() {
+            public void propertyChange( PropertyChangeEvent evt ) {
+                downloadButton.setVisible(downloadChosenRelationAction.isEnabled());
+            }
+        });
+        downloadButton.setVisible(false);
+        topLine.setVisible(false);
+
         // [+][Multi] [X]Adm [X]Tags [X]1
         JPanel bottomLine = new JPanel(new FlowLayout(FlowLayout.LEFT));
         bottomLine.add(new JButton(new CreateRelationAction(chosenRelation)));
+        bottomLine.add(new JButton(new CreateMultipolygonAction(chosenRelation)));
         rcPanel.add(bottomLine, BorderLayout.SOUTH);
 
@@ -108,4 +110,5 @@
         SelectionEventManager.getInstance().removeSelectionListener(this);
         MapView.removeEditLayerChangeListener(this);
+        DatasetEventManager.getInstance().removeDatasetListener(chosenRelation);
     }
 
@@ -114,7 +117,6 @@
         SelectionEventManager.getInstance().addSelectionListener(this, FireMode.IN_EDT_CONSOLIDATED);
         MapView.addEditLayerChangeListener(this);
+        DatasetEventManager.getInstance().addDatasetListener(chosenRelation, FireMode.IN_EDT);
     }
-
-
 
     public ChosenRelation getChosenRelation() {
@@ -123,4 +125,6 @@
 
     public void chosenRelationChanged( Relation oldRelation, Relation newRelation ) {
+        if( topLine != null )
+            topLine.setVisible(newRelation != null);
         // ?
     }
Index: /applications/editors/josm/plugins/relcontext/src/relcontext/actions/AddRemoveMemberAction.java
===================================================================
--- /applications/editors/josm/plugins/relcontext/src/relcontext/actions/AddRemoveMemberAction.java	(revision 25668)
+++ /applications/editors/josm/plugins/relcontext/src/relcontext/actions/AddRemoveMemberAction.java	(revision 25669)
@@ -1,10 +1,14 @@
 package relcontext.actions;
 
-import java.util.Collection;
+import java.util.*;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import static org.openstreetmap.josm.tools.I18n.tr;
 import java.awt.event.ActionEvent;
+import javax.swing.Action;
+import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.JosmAction;
+import org.openstreetmap.josm.command.ChangeCommand;
 import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.data.osm.RelationMember;
 import relcontext.ChosenRelation;
 import relcontext.ChosenRelationListener;
@@ -29,28 +33,71 @@
 
     public void actionPerformed( ActionEvent e ) {
-        // todo
+        if( rel.get() == null )
+            return;
+
+        Relation r = new Relation(rel.get());
+
+        Collection<OsmPrimitive> toAdd = new ArrayList<OsmPrimitive>(getCurrentDataSet().getSelected());
+        toAdd.remove(rel.get());
+        toAdd.removeAll(r.getMemberPrimitives());
+
+        // 1. remove all present members
+        r.removeMembersFor(getCurrentDataSet().getSelected());
+
+        // 2. add all new members
+        for( OsmPrimitive p : toAdd ) {
+            r.addMember(new RelationMember("", p));
+        }
+
+        if( !r.getMemberPrimitives().equals(rel.get().getMemberPrimitives()) )
+            Main.main.undoRedo.add(new ChangeCommand(rel.get(), r));
     }
 
     public void chosenRelationChanged( Relation oldRelation, Relation newRelation ) {
-        setEnabled(newRelation != null && getCurrentDataSet() != null);
+        updateEnabledState();
     }
 
     @Override
     protected void updateEnabledState() {
-        if( getCurrentDataSet() == null ) {
-            setEnabled(false);
-        } else {
-            updateEnabledState(getCurrentDataSet().getSelected());
-        }
+        updateEnabledState(getCurrentDataSet() == null ? null : getCurrentDataSet().getSelected());
     }
 
     @Override
     protected void updateEnabledState( Collection<? extends OsmPrimitive> selection ) {
-        if( rel.get() == null || selection == null || selection.isEmpty() ) {
+        updateIcon();
+        if( rel == null || rel.get() == null || selection == null || selection.isEmpty() ) {
+            setEnabled(false);
+            return;
+        }
+        if( selection.size() == 1 && selection.contains(rel.get()) ) {
             setEnabled(false);
             return;
         }
         setEnabled(true);
+    }
+
+    protected void updateIcon() {
         // todo: change icon based on selection
+        String name = "";
+        if( getCurrentDataSet() == null || getCurrentDataSet().getSelected() == null
+                || getCurrentDataSet().getSelected().size() == 0 || rel == null || rel.get() == null )
+            name = "?";
+        else {
+            Collection<OsmPrimitive> toAdd = new ArrayList<OsmPrimitive>(getCurrentDataSet().getSelected());
+            toAdd.remove(rel.get());
+            int selectedSize = toAdd.size();
+            if( selectedSize == 0 )
+                name = "?";
+            else {
+                toAdd.removeAll(rel.get().getMemberPrimitives());
+                if( toAdd.isEmpty() )
+                    name = "-";
+                else if( toAdd.size() < selectedSize )
+                    name = "±";
+                else
+                    name = "+";
+            }
+        }
+        putValue(Action.NAME, name);
     }
 }
Index: /applications/editors/josm/plugins/relcontext/src/relcontext/actions/CreateMultipolygonAction.java
===================================================================
--- /applications/editors/josm/plugins/relcontext/src/relcontext/actions/CreateMultipolygonAction.java	(revision 25669)
+++ /applications/editors/josm/plugins/relcontext/src/relcontext/actions/CreateMultipolygonAction.java	(revision 25669)
@@ -0,0 +1,77 @@
+package relcontext.actions;
+
+import java.util.Collection;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import static org.openstreetmap.josm.tools.I18n.tr;
+import java.awt.event.ActionEvent;
+import java.util.LinkedList;
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.actions.JosmAction;
+import org.openstreetmap.josm.command.AddCommand;
+import org.openstreetmap.josm.command.Command;
+import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.data.osm.RelationMember;
+import org.openstreetmap.josm.data.osm.Way;
+import relcontext.ChosenRelation;
+
+/**
+ * Creates new multipolygon from selected ways.
+ * Choose relation afterwards.
+ *
+ * @author Zverik
+ */
+public class CreateMultipolygonAction extends JosmAction {
+    private static final String ACTION_NAME = "Create relation";
+    protected ChosenRelation chRel;
+
+    public CreateMultipolygonAction( ChosenRelation chRel ) {
+        super("Multi", null, "Create a multipolygon from selected objects", null, false);
+        this.chRel = chRel;
+        updateEnabledState();
+    }
+
+    public CreateMultipolygonAction() {
+        this(null);
+    }
+
+    public void actionPerformed( ActionEvent e ) {
+        // todo!
+        
+        Relation rel = new Relation();
+        rel.put("type", "multipolygon");
+        for( OsmPrimitive selected : getCurrentDataSet().getSelected() ) {
+            rel.addMember(new RelationMember("", selected));
+        }
+
+        Collection<Command> cmds = new LinkedList<Command>();
+        Main.main.undoRedo.add(new AddCommand(rel));
+
+        if( chRel != null ) {
+            chRel.set(rel);
+        }
+    }
+
+    @Override
+    protected void updateEnabledState() {
+        if( getCurrentDataSet() == null ) {
+            setEnabled(false);
+        } else {
+            updateEnabledState(getCurrentDataSet().getSelected());
+        }
+    }
+
+    @Override
+    protected void updateEnabledState( Collection<? extends OsmPrimitive> selection ) {
+        boolean enabled = true;
+        if( selection == null || selection.isEmpty() )
+            enabled = false;
+        else {
+            for( OsmPrimitive p : selection )
+                if( !(p instanceof Way) ) {
+                    enabled = false;
+                    break;
+                }
+        }
+        setEnabled(enabled);
+    }
+}
Index: /applications/editors/josm/plugins/relcontext/src/relcontext/actions/CreateRelationAction.java
===================================================================
--- /applications/editors/josm/plugins/relcontext/src/relcontext/actions/CreateRelationAction.java	(revision 25668)
+++ /applications/editors/josm/plugins/relcontext/src/relcontext/actions/CreateRelationAction.java	(revision 25669)
@@ -46,5 +46,4 @@
         }
 
-        Collection<Command> cmds = new LinkedList<Command>();
         Main.main.undoRedo.add(new AddCommand(rel));
 
Index: /applications/editors/josm/plugins/relcontext/src/relcontext/actions/DownloadChosenRelationAction.java
===================================================================
--- /applications/editors/josm/plugins/relcontext/src/relcontext/actions/DownloadChosenRelationAction.java	(revision 25668)
+++ /applications/editors/josm/plugins/relcontext/src/relcontext/actions/DownloadChosenRelationAction.java	(revision 25669)
@@ -9,4 +9,5 @@
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.data.osm.RelationMember;
 import org.openstreetmap.josm.gui.dialogs.relation.DownloadRelationMemberTask;
 import org.openstreetmap.josm.gui.dialogs.relation.DownloadRelationTask;
@@ -31,8 +32,8 @@
     public void actionPerformed( ActionEvent e ) {
         Relation relation = rel.get();
-        if( relation == null || relation.isNew() || !relation.isIncomplete() ) return;
+        if( relation == null || relation.isNew() ) return;
         int total = relation.getMembersCount();
         int incomplete = relation.getIncompleteMembers().size();
-        if( incomplete <= 5 && incomplete * 2 < total )
+        if( incomplete <= 5 || (incomplete <= 10 && incomplete * 3 < total) )
             downloadIncomplete(relation);
         else
@@ -41,5 +42,14 @@
 
     public void chosenRelationChanged( Relation oldRelation, Relation newRelation ) {
-        setEnabled(newRelation != null && newRelation.isIncomplete());
+        boolean incomplete = false;
+        if( newRelation != null ) {
+            for( RelationMember m : newRelation.getMembers()) {
+                if( m.getMember().isIncomplete() ) {
+                    incomplete = true;
+                    break;
+                }
+            }
+        }
+        setEnabled(newRelation != null && incomplete);
     }
 
