Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDJ Houghton2006-02-07 15:55:01 -0500
committerDJ Houghton2006-02-07 15:55:01 -0500
commitcb5901660376eaf741687b0ea60465e1859872ab (patch)
tree7e9bf28d449e143d36608edee9200b47bf17e328
parentccd988bbab917bffab77a86ac4e5ca05689b23e5 (diff)
downloadrt.equinox.bundles-cb5901660376eaf741687b0ea60465e1859872ab.tar.gz
rt.equinox.bundles-cb5901660376eaf741687b0ea60465e1859872ab.tar.xz
rt.equinox.bundles-cb5901660376eaf741687b0ea60465e1859872ab.zip
Bug 118471 - BundleContext no longer valid in preferences
-rw-r--r--bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/Activator.java12
-rw-r--r--bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesOSGiUtils.java8
2 files changed, 10 insertions, 10 deletions
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/Activator.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/Activator.java
index 17554e7a..e18dd154 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/Activator.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/Activator.java
@@ -12,6 +12,7 @@ package org.eclipse.core.internal.preferences;
import java.util.Hashtable;
+import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.preferences.IPreferencesService;
import org.eclipse.osgi.service.environment.EnvironmentInfo;
import org.osgi.framework.*;
@@ -30,7 +31,7 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer {
* available
*/
private ServiceTracker registryServiceTracker;
-
+
/**
* The bundle associated this plug-in
*/
@@ -45,14 +46,15 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer {
* This plugin provides the OSGi Preferences service.
*/
private ServiceRegistration osgiPreferencesService;
-
+
/**
* This method is called upon plug-in activation
*/
public void start(BundleContext context) throws Exception {
bundleContext = context;
processCommandLine();
- registryServiceTracker = new ServiceTracker(context,"org.eclipse.core.runtime.IExtensionRegistry",this);
+ PreferencesOSGiUtils.getDefault().openServices();
+ registryServiceTracker = new ServiceTracker(context, IExtensionRegistry.class.getName(), this);
registryServiceTracker.open();
}
@@ -79,7 +81,7 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer {
if (preferencesService == null) {
registerServices();
//return the registry service so we track it
- return bundleContext.getService(reference);
+ return bundleContext.getService(reference);
}
return null;
}
@@ -94,7 +96,7 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer {
}
if (osgiPreferencesService != null) {
osgiPreferencesService.unregister();
- osgiPreferencesService = null;
+ osgiPreferencesService = null;
}
}
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesOSGiUtils.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesOSGiUtils.java
index 37cc6a65..fcc8d526 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesOSGiUtils.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesOSGiUtils.java
@@ -46,10 +46,9 @@ public class PreferencesOSGiUtils {
*/
private PreferencesOSGiUtils() {
super();
- initServices();
}
- private void initServices() {
+ void openServices() {
BundleContext context = Activator.getContext();
if (context == null) {
PrefsMessages.message("PreferencesOSGiUtils called before plugin started"); //$NON-NLS-1$
@@ -70,10 +69,9 @@ public class PreferencesOSGiUtils {
// locations
- final String FILTER_PREFIX = "(&(objectClass=org.eclipse.osgi.service.datalocation.Location)(type="; //$NON-NLS-1$
Filter filter = null;
try {
- filter = context.createFilter(FILTER_PREFIX + PROP_CONFIG_AREA + "))"); //$NON-NLS-1$
+ filter = context.createFilter(Location.CONFIGURATION_FILTER);
} catch (InvalidSyntaxException e) {
// ignore this. It should never happen as we have tested the above format.
}
@@ -81,7 +79,7 @@ public class PreferencesOSGiUtils {
configurationLocationTracker.open();
try {
- filter = context.createFilter(FILTER_PREFIX + PROP_INSTANCE_AREA + "))"); //$NON-NLS-1$
+ filter = context.createFilter(Location.INSTANCE_FILTER);
} catch (InvalidSyntaxException e) {
// ignore this. It should never happen as we have tested the above format.
}

Back to the top