Fix for Bug 56020 [runtime] prefs: converted preferences not restored on second session
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/EclipsePreferences.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
index 7dcab7c..234f07b 100644
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
+++ b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
@@ -615,7 +615,7 @@
 
 	protected void makeDirty() {
 		EclipsePreferences node = this;
-		while (node != null && !node.removed) {
+		while (node != null && !node.dirty && !node.removed) {
 			node.dirty = true;
 			node = (EclipsePreferences) node.parent();
 		}
@@ -938,6 +938,7 @@
 			result.loadLegacy();
 			result.load(result.getLocation());
 			result.loaded();
+			result.flush();
 		} catch (BackingStoreException e) {
 			String message = "Exception loading preferences";
 			IStatus status = new Status(IStatus.ERROR, Platform.PI_RUNTIME, IStatus.ERROR, message, e);
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/InstancePreferences.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/InstancePreferences.java
index 6834bb1..04f86e8 100644
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/InstancePreferences.java
+++ b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/preferences/InstancePreferences.java
@@ -140,7 +140,9 @@
 			if (value != null) {
 				if (InternalPlatform.DEBUG_PREFERENCES)
 					System.out.println("Loaded legacy preference: " + key + " -> " + value); //$NON-NLS-1$ //$NON-NLS-2$
+				// call these 2 methods rather than #put() so we don't send out unnecessary notification
 				properties.put(key, value);
+				makeDirty();
 			}
 		}
 
@@ -176,11 +178,7 @@
 		if (qualifier == null)
 			return;
 		// get the base location from the platform
-		InternalPlatform platform = InternalPlatform.getDefault();
-		Bundle bundle = platform.getBundle(qualifier);
-		if (bundle == null)
-			return;
-		location = platform.getStateLocation(bundle).append(DEFAULT_PREFERENCES_FILENAME);
+		location = InternalPlatform.getDefault().getMetaArea().getStateLocation(qualifier).append(DEFAULT_PREFERENCES_FILENAME);
 	}
 
 	/*