Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzymon Ptaszkiewicz2014-07-22 13:19:43 +0000
committerStefan Xenos2016-10-07 04:08:48 +0000
commit92ae5195ee7a7685524798f74948b8fcbfeb7ccd (patch)
treed8c49dd5219943b55c28db1889bc8c8f3d06d34d
parentc8794593f0dccba45ce320c080efca27c418a56c (diff)
downloadrt.equinox.bundles-92ae5195ee7a7685524798f74948b8fcbfeb7ccd.tar.gz
rt.equinox.bundles-92ae5195ee7a7685524798f74948b8fcbfeb7ccd.tar.xz
rt.equinox.bundles-92ae5195ee7a7685524798f74948b8fcbfeb7ccd.zip
Bug 387898 - Wrong preference node created when starting org.eclipse.jdt.debug.ui plugin
Change-Id: Ic8f9846006ce13a622ef3ffcfd57a5573aa61f1e Signed-off-by: Szymon Ptaszkiewicz <szymon.ptaszkiewicz@pl.ibm.com>
-rw-r--r--bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/DefaultPreferences.java18
-rw-r--r--bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesService.java14
2 files changed, 25 insertions, 7 deletions
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/DefaultPreferences.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/DefaultPreferences.java
index e707bfca5..e11722204 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/DefaultPreferences.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/DefaultPreferences.java
@@ -170,7 +170,23 @@ public class DefaultPreferences extends EclipsePreferences {
// if the node already exists, nothing more to do
if (super.nodeExists(path))
return true;
- // if the node does not exist, maybe it has not been loaded yet
+
+ // try to apply runtime defaults in case the node is created programmatically inside initializer
+ PreferencesService.getDefault().applyRuntimeDefaults(path, pluginReference);
+ // check if the node was created inside initializer's code
+ if (super.nodeExists(path))
+ return true;
+
+ // try to look for preferences.ini file inside bundle
+ Bundle bundle = PreferencesOSGiUtils.getDefault().getBundle(path);
+ if (bundle != null) {
+ URL url = FileLocator.find(bundle, new Path(IPreferencesConstants.PREFERENCES_DEFAULT_OVERRIDE_FILE_NAME), null);
+ // node exists only if file exists and if it contains some preferences
+ if (!loadProperties(url).isEmpty())
+ return true;
+ }
+
+ // check product and command line customizations
initializeCustomizations();
// scope based path is a path relative to the "/default" node; this is the path that appears in customizations
IPath scopeBasedPath = new Path(absolutePath() + PATH_SEPARATOR + path).removeFirstSegments(1);
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesService.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesService.java
index 6c441582c..05442fb31 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesService.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesService.java
@@ -604,19 +604,21 @@ public class PreferencesService implements IPreferencesService {
Preferences node = context.getNode(qualifier);
if (node != null) {
found = true;
- if (childPath != null)
+ if (childPath != null && node.nodeExists(childPath))
node = node.node(childPath);
result.add(node);
}
}
}
if (!found) {
- Preferences node = getRootNode().node(scopeString).node(qualifier);
- if (childPath != null)
- node = node.node(childPath);
- result.add(node);
+ Preferences node = getRootNode().node(scopeString);
+ if (node.nodeExists(qualifier)) {
+ node = node.node(qualifier);
+ if (childPath != null && node.nodeExists(childPath))
+ node = node.node(childPath);
+ result.add(node);
+ }
}
- found = false;
}
@Override

Back to the top