Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzymon Brandys2010-10-25 10:25:05 -0400
committerSzymon Brandys2010-10-25 10:25:05 -0400
commitfb29cdcdc1eae34127e975142557dbd85d3cb43a (patch)
tree43bd2b61f38b4aeedd533e153387fce5af7f0541 /bundles
parent6af742d3ca74e91f3d294625f89fa31bdda84ee3 (diff)
downloadeclipse.platform.team-fb29cdcdc1eae34127e975142557dbd85d3cb43a.tar.gz
eclipse.platform.team-fb29cdcdc1eae34127e975142557dbd85d3cb43a.tar.xz
eclipse.platform.team-fb29cdcdc1eae34127e975142557dbd85d3cb43a.zip
bug 327672 - [Net] Error: "Preference node "org.eclipse.core.net" has been removed."
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceManager.java33
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceModifyListener.java6
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java7
3 files changed, 24 insertions, 22 deletions
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceManager.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceManager.java
index 0d79ac7b0..31126053d 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceManager.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceManager.java
@@ -14,9 +14,9 @@ import org.eclipse.core.net.proxy.IProxyData;
import org.eclipse.core.runtime.preferences.ConfigurationScope;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
+import org.eclipse.core.runtime.preferences.InstanceScope;
import org.osgi.service.prefs.BackingStoreException;
import org.osgi.service.prefs.Preferences;
@@ -43,12 +43,10 @@ public class PreferenceManager {
private static boolean migrated = false;
private IEclipsePreferences defaultScope;
- private IEclipsePreferences instanceScope;
private IEclipsePreferences currentScope;
private PreferenceManager(String id) {
this.defaultScope = new DefaultScope().getNode(id);
- this.instanceScope = new InstanceScope().getNode(id);
}
/**
@@ -259,36 +257,36 @@ public class PreferenceManager {
return;
}
currentScope.putBoolean(PREF_HAS_MIGRATED, true);
- migrateInstanceScopePreferences(proxies, true);
+ migrateInstanceScopePreferences(new InstanceScope().getNode(Activator.ID), currentScope, proxies, true);
}
- void migrateInstanceScopePreferences(ProxyType[] proxies, boolean isInitialize) {
- migrateUpdateHttpProxy(proxies, isInitialize);
+ void migrateInstanceScopePreferences(Preferences instanceScope, Preferences configuration, ProxyType[] proxies, boolean isInitialize) {
+ migrateUpdateHttpProxy(instanceScope, proxies, isInitialize);
// migrate enabled status
- if (currentScope.get(ProxyManager.PREF_ENABLED, null) == null) {
+ if (configuration.get(ProxyManager.PREF_ENABLED, null) == null) {
String instanceEnabled = instanceScope.get(ProxyManager.PREF_ENABLED, null);
if (instanceEnabled != null)
- currentScope.put(ProxyManager.PREF_ENABLED, instanceEnabled);
+ configuration.put(ProxyManager.PREF_ENABLED, instanceEnabled);
}
// migrate enabled status
- if (currentScope.get(ProxyManager.PREF_OS, null) == null) {
+ if (configuration.get(ProxyManager.PREF_OS, null) == null) {
String instanceEnabled = instanceScope.get(ProxyManager.PREF_OS, null);
if (instanceEnabled != null)
- currentScope.put(ProxyManager.PREF_OS, instanceEnabled);
+ configuration.put(ProxyManager.PREF_OS, instanceEnabled);
}
// migrate non proxied hosts if not already set
- if (currentScope.get(ProxyManager.PREF_NON_PROXIED_HOSTS, null) == null) {
+ if (configuration.get(ProxyManager.PREF_NON_PROXIED_HOSTS, null) == null) {
String instanceNonProxiedHosts = instanceScope.get(ProxyManager.PREF_NON_PROXIED_HOSTS, null);
if (instanceNonProxiedHosts != null) {
- currentScope.put(ProxyManager.PREF_NON_PROXIED_HOSTS, instanceNonProxiedHosts);
+ configuration.put(ProxyManager.PREF_NON_PROXIED_HOSTS, instanceNonProxiedHosts);
}
}
// migrate proxy data
- PreferenceManager instanceManager = PreferenceManager.createInstanceManager(Activator.ID);
+ PreferenceManager instanceManager = PreferenceManager.createInstanceManager(instanceScope);
for (int i = 0; i < proxies.length; i++) {
ProxyType type = proxies[i];
IProxyData data = type.getProxyData(ProxyType.DO_NOT_VERIFY);
@@ -310,7 +308,7 @@ public class PreferenceManager {
}
}
- private void migrateUpdateHttpProxy(ProxyType[] proxies, boolean isInitialize) {
+ private void migrateUpdateHttpProxy(Preferences instanceScope, ProxyType[] proxies, boolean isInitialize) {
if (!instanceScope.getBoolean(PREF_HAS_MIGRATED, false)) {
// Only set the migration bit when initializing
if (isInitialize)
@@ -373,10 +371,9 @@ public class PreferenceManager {
return httpProxyEnable;
}
- private static PreferenceManager createInstanceManager(String id) {
- PreferenceManager manager = new PreferenceManager(id);
- manager.currentScope = manager.instanceScope;
+ private static PreferenceManager createInstanceManager(Preferences instance) {
+ PreferenceManager manager = new PreferenceManager(Activator.ID);
+ manager.currentScope = (IEclipsePreferences) instance;
return manager;
}
-
}
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceModifyListener.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceModifyListener.java
index dc8f86cbb..0f5198221 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceModifyListener.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceModifyListener.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.core.internal.net;
+import org.eclipse.core.runtime.preferences.ConfigurationScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.osgi.service.prefs.BackingStoreException;
@@ -24,12 +25,13 @@ public class PreferenceModifyListener extends
public IEclipsePreferences preApply(IEclipsePreferences node) {
try {
if (node.nodeExists(InstanceScope.SCOPE)) {
- ((ProxyManager)ProxyManager.getProxyManager()).migrateInstanceScopePreferences(false);
+ ((ProxyManager)ProxyManager.getProxyManager()).migrateInstanceScopePreferences(
+ node.node(InstanceScope.SCOPE).node(Activator.ID),
+ node.node(ConfigurationScope.SCOPE).node(Activator.ID), false);
}
} catch (BackingStoreException e) {
Activator.logError("Could not access instance preferences", e); //$NON-NLS-1$
}
return super.preApply(node);
}
-
}
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java
index 789bcd332..981b4906d 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java
@@ -35,6 +35,7 @@ import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChang
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
import org.eclipse.osgi.util.NLS;
import org.osgi.service.prefs.BackingStoreException;
+import org.osgi.service.prefs.Preferences;
public class ProxyManager implements IProxyService, IPreferenceChangeListener {
@@ -403,8 +404,10 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
preferenceManager.migrate(proxies);
}
- void migrateInstanceScopePreferences(boolean isInitialize) {
- preferenceManager.migrateInstanceScopePreferences(proxies, isInitialize);
+ void migrateInstanceScopePreferences(Preferences instance,
+ Preferences configuration, boolean isInitialize) {
+ preferenceManager.migrateInstanceScopePreferences(instance,
+ configuration, proxies, isInitialize);
}
public void preferenceChange(PreferenceChangeEvent event) {

Back to the top