Index: /applications/editors/josm/plugins/relcontext/TODO
===================================================================
--- /applications/editors/josm/plugins/relcontext/TODO	(revision 25701)
+++ /applications/editors/josm/plugins/relcontext/TODO	(revision 25702)
@@ -11,4 +11,5 @@
 - Solve multipolygon settings button width problem
 - Solve width problem for narrows buttons when "fix" and "download" appear simultaneously
+- Sort relation members button (now it's just role fixer)
 
 == RELEASE ==
Index: /applications/editors/josm/plugins/relcontext/src/relcontext/actions/CreateMultipolygonAction.java
===================================================================
--- /applications/editors/josm/plugins/relcontext/src/relcontext/actions/CreateMultipolygonAction.java	(revision 25701)
+++ /applications/editors/josm/plugins/relcontext/src/relcontext/actions/CreateMultipolygonAction.java	(revision 25702)
@@ -61,5 +61,4 @@
             rel.put("type", "boundary");
             rel.put("boundary", "administrative");
-            askForAdminLevelAndName(rel);
         } else
             rel.put("type", "multipolygon");
@@ -73,4 +72,6 @@
             addBoundaryMembers(rel);
         List<Command> list = removeTagsFromInnerWays(rel);
+        if( !askForAdminLevelAndName(rel) )
+            return;
         if( isBoundary && getPref("boundaryways") )
             list.addAll(fixWayTagsForBoundary(rel));
@@ -180,4 +181,8 @@
     static public final String[] DEFAULT_LINEAR_TAGS = {"barrier", "source"};
 
+    private static final Set<String> REMOVE_FROM_BOUNDARY_TAGS = new TreeSet<String>(Arrays.asList(new String[] {
+        "boundary", "boundary_type", "type", "admin_level"
+    }));
+
     /**
      * This method removes tags/value pairs from inner ways that are present in relation or outer ways.
@@ -196,4 +201,5 @@
         List<Way> innerWays = new ArrayList<Way>();
         List<Way> outerWays = new ArrayList<Way>();
+
         Set<String> conflictingKeys = new TreeSet<String>();
 
@@ -233,4 +239,14 @@
             values.remove("natural");
 
+        boolean isBoundary = getPref("boundary");
+        String name = values.get("name");
+        String adminLevel = values.get("admin_level");
+        if( isBoundary ) {
+            Set<String> keySet = new TreeSet<String>(values.keySet());
+            for( String key : keySet )
+                if( !REMOVE_FROM_BOUNDARY_TAGS.contains(key) )
+                    values.remove(key);
+        }
+
         values.put("area", "yes");
 
@@ -243,5 +259,5 @@
 
             for (Way way: innerWays) {
-                if (value.equals(way.get(key))) {
+                if( way.hasKey(key) && (isBoundary || value.equals(way.get(key))) ) {
                     affectedWays.add(way);
                 }
@@ -264,13 +280,19 @@
         if( moveTags ) {
             // add those tag values to the relation
+            if( isBoundary )
+                values.put("name", name);
             boolean fixed = false;
             Relation r2 = new Relation(relation);
             for( String key : values.keySet() ) {
-                if( !r2.hasKey(key) && !key.equals("area") ) {
-                    r2.put(key, values.get(key));
+                if( !r2.hasKey(key) && !key.equals("area")
+                        && (!isBoundary || key.equals("admin_level") || key.equals("name"))) {
+                    if( relation.isNew() )
+                        relation.put(key, values.get(key));
+                    else
+                        r2.put(key, values.get(key));
                     fixed = true;
                 }
             }
-            if( fixed )
+            if( fixed && !relation.isNew() )
                 commands.add(new ChangeCommand(relation, r2));
         }
@@ -279,10 +301,20 @@
     }
 
-    private void askForAdminLevelAndName( Relation rel ) {
+    /**
+     *
+     * @param rel
+     * @return false if user pressed "cancel".
+     */
+    private boolean askForAdminLevelAndName( Relation rel ) {
+        String relAL = rel.get("admin_level");
+        String relName = rel.get("name");
+        if( relAL != null && relName != null )
+            return true;
+
         JPanel panel = new JPanel(new GridBagLayout());
         panel.add(new JLabel(tr("Enter admin level and name for the border relation:")), GBC.eol().insets(0, 0, 0, 5));
 
         final JTextField admin = new JTextField();
-        admin.setText(Main.pref.get(PREF_MULTIPOLY + "lastadmin", ""));
+        admin.setText(relAL != null ? relAL : Main.pref.get(PREF_MULTIPOLY + "lastadmin", ""));
         panel.add(new JLabel(tr("Admin level")), GBC.std());
         panel.add(Box.createHorizontalStrut(10), GBC.std());
@@ -290,4 +322,6 @@
 
         final JTextField name = new JTextField();
+        if( relName != null )
+            name.setText(relName);
         panel.add(new JLabel(tr("Name")), GBC.std());
         panel.add(Box.createHorizontalStrut(10), GBC.std());
@@ -316,5 +350,5 @@
         if( answer == null || answer == JOptionPane.UNINITIALIZED_VALUE
                 || (answer instanceof Integer && (Integer)answer != JOptionPane.OK_OPTION) ) {
-            return;
+            return false;
         }
 
@@ -327,4 +361,5 @@
         if( new_name.length() > 0 )
             rel.put("name", new_name);
+        return true;
     }
 }
