Index: trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java	(revision 6021)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java	(revision 6022)
@@ -3,4 +3,5 @@
 
 import static org.openstreetmap.josm.tools.I18n.tr;
+import static org.openstreetmap.josm.tools.I18n.marktr;
 
 import java.awt.Dimension;
@@ -12,4 +13,5 @@
 import java.util.Collections;
 import java.util.Comparator;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -21,4 +23,5 @@
 import javax.swing.JFileChooser;
 import javax.swing.JLabel;
+import javax.swing.JMenu;
 import javax.swing.JOptionPane;
 import javax.swing.JPanel;
@@ -27,4 +30,6 @@
 import javax.swing.event.DocumentEvent;
 import javax.swing.event.DocumentListener;
+import javax.swing.event.MenuEvent;
+import javax.swing.event.MenuListener;
 import javax.swing.filechooser.FileFilter;
 
@@ -42,5 +47,4 @@
 import org.openstreetmap.josm.gui.widgets.JosmTextField;
 import org.openstreetmap.josm.tools.GBC;
-import static org.openstreetmap.josm.tools.I18n.tr;
 
 public class AdvancedPreference extends DefaultTabPreferenceSetting {
@@ -255,16 +259,18 @@
         readPreferences(tmpPrefs);
         // sorting after modification - first modified, then non-default, then default entries
-        Collections.sort(allData, new Comparator<PrefEntry>() {
-            @Override
-            public int compare(PrefEntry o1, PrefEntry o2) {
-                if (o1.isChanged() && !o2.isChanged()) return -1;
-                if (o2.isChanged() && !o1.isChanged()) return 1;
-                if (!(o1.isDefault()) && o2.isDefault()) return -1;
-                if (!(o2.isDefault()) && o1.isDefault()) return 1;
-                return o1.compareTo(o2);
-            }
-        });
+        Collections.sort(allData, customComparator);
         applyFilter();
     }
+    
+    private Comparator<PrefEntry> customComparator = new Comparator<PrefEntry>() {
+        @Override
+        public int compare(PrefEntry o1, PrefEntry o2) {
+            if (o1.isChanged() && !o2.isChanged()) return -1;
+            if (o2.isChanged() && !o1.isChanged()) return 1;
+            if (!(o1.isDefault()) && o2.isDefault()) return -1;
+            if (!(o2.isDefault()) && o1.isDefault()) return 1;
+            return o1.compareTo(o2);
+        }
+    };
                 
     private List<PrefEntry> prepareData(Map<String, Setting> loaded, Map<String, Setting> orig, Map<String, Setting> defaults) {
@@ -301,6 +307,20 @@
     }
     
+    Map<String,String> profileTypes = new LinkedHashMap<String, String>();
+    
     private JPopupMenu buildPopupMenu() {
         JPopupMenu menu = new JPopupMenu();
+        profileTypes.put(marktr("shortcut"), "shortcut\\..*");
+        profileTypes.put(marktr("color"), "color\\..*");
+        profileTypes.put(marktr("toolbar"), "toolbar.*");
+        profileTypes.put(marktr("imagery"), "imagery.*");
+        
+        for (Entry<String,String> e: profileTypes.entrySet()) {
+            menu.add(new ExportProfileAction(Main.pref, e.getKey(), e.getValue()));
+        }
+        
+        menu.addSeparator();
+        menu.add(getProfileMenu());
+        menu.addSeparator();
         menu.add(new AbstractAction(tr("Reset preferences")) {
             @Override public void actionPerformed(ActionEvent ae) {
@@ -320,4 +340,64 @@
         return menu;
     }
+    
+    private JMenu getProfileMenu() {
+        final JMenu p =new JMenu(tr("Load profile"));
+        p.addMenuListener(new MenuListener() {
+            @Override
+            public void menuSelected(MenuEvent me) {
+                p.removeAll();
+                for (File f: new File(".").listFiles()) {
+                   String s = f.getName();
+                   int idx = s.indexOf("_");
+                   if (idx>=0) {
+                        String t=s.substring(0,idx);
+                        System.out.println(t);
+                        if (profileTypes.containsKey(t))
+                            p.add(new ImportProfileAction(s, f, t));
+                   }
+                }
+                for (File f: Main.pref.getPreferencesDirFile().listFiles()) {
+                   String s = f.getName();
+                   int idx = s.indexOf("_");
+                   if (idx>=0) {
+                        String t=s.substring(0,idx);
+                        if (profileTypes.containsKey(t))
+                            p.add(new ImportProfileAction(s, f, t));
+                   }
+                }
+            }
+            @Override public void menuDeselected(MenuEvent me) { }
+            @Override public void menuCanceled(MenuEvent me) { }
+        });
+        return p;
+    }
+    
+    private class ImportProfileAction extends AbstractAction {
+        private final File file;
+        private final String type;
+        
+        public ImportProfileAction(String name, File file, String type) {
+            super(name);
+            this.file = file;
+            this.type = type;
+        }
+
+        @Override
+        public void actionPerformed(ActionEvent ae) {
+            Preferences tmpPrefs = CustomConfigurator.clonePreferences(Main.pref);
+            CustomConfigurator.readXML(file, tmpPrefs);
+            readPreferences(tmpPrefs);
+            String prefRegex = profileTypes.get(type);
+            // clean all the preferences from the chosen group
+            for (PrefEntry p : allData) {
+               if (p.getKey().matches(prefRegex) && !p.isDefault()) {
+                    p.reset();
+               }
+            }
+            // allow user to review the changes in table
+            Collections.sort(allData, customComparator);
+            applyFilter();
+        }
+    }
 
     private void applyFilter() {
@@ -345,5 +425,4 @@
             }
         }
-        System.out.println(displayData.size())  ;
         if (table!=null) table.fireDataChanged();
     }
Index: trunk/src/org/openstreetmap/josm/gui/preferences/advanced/PrefEntry.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/advanced/PrefEntry.java	(revision 6021)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/advanced/PrefEntry.java	(revision 6022)
@@ -1,2 +1,3 @@
+// License: GPL. See LICENSE file for details.
 package org.openstreetmap.josm.gui.preferences.advanced;
 
Index: trunk/src/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTable.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTable.java	(revision 6021)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTable.java	(revision 6022)
@@ -1,2 +1,3 @@
+// License: GPL. See LICENSE file for details.
 package org.openstreetmap.josm.gui.preferences.advanced;
 
