Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLazar Kirchev2012-11-21 13:19:20 +0000
committerPascal Rapicault2013-01-22 15:04:35 +0000
commita59b27e1aa02a8bceb29d72a418760e770f0c023 (patch)
tree0b180a64894b104df77bedec31406412442fbc90
parentf7b6b8c5f45097bff4a88f57b4fddb7904dfc699 (diff)
downloadrt.equinox.p2-a59b27e1aa02a8bceb29d72a418760e770f0c023.tar.gz
rt.equinox.p2-a59b27e1aa02a8bceb29d72a418760e770f0c023.tar.xz
rt.equinox.p2-a59b27e1aa02a8bceb29d72a418760e770f0c023.zip
Bug 394159 - p2.console registers CommandProvider multiple timesv20130122-150435
-rw-r--r--bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/Activator.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/Activator.java b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/Activator.java
index 54bc79f44..78e53591f 100644
--- a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/Activator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others. All rights reserved. This
+ * Copyright (c) 2007, 2012 IBM Corporation and others. All rights reserved. This
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Composent, Inc. - additions
+ * SAP AG - additions
*******************************************************************************/
package org.eclipse.equinox.internal.p2.console;
@@ -23,6 +24,7 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer<IPro
private static BundleContext context;
private ServiceTracker<IProvisioningAgent, IProvisioningAgent> agentTracker;
+ private IProvisioningAgent provAgent;
private ProvCommandProvider provider;
private ServiceRegistration<?> providerRegistration = null;
@@ -54,14 +56,24 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer<IPro
if (providerRegistration != null)
providerRegistration.unregister();
providerRegistration = null;
+ provAgent = null;
Activator.context = null;
}
public IProvisioningAgent addingService(ServiceReference<IProvisioningAgent> reference) {
+ if (providerRegistration != null) {
+ return null;
+ }
+
+ if (!Boolean.TRUE.toString().equals(reference.getProperty(IProvisioningAgent.SERVICE_CURRENT))) {
+ return null;
+ }
+
BundleContext ctxt = Activator.getContext();
IProvisioningAgent agent = ctxt.getService(reference);
provider = new ProvCommandProvider(ctxt.getProperty("eclipse.p2.profile"), agent); //$NON-NLS-1$
providerRegistration = ctxt.registerService(PROVIDER_NAME, provider, null);
+ this.provAgent = agent;
return agent;
}
@@ -70,9 +82,15 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer<IPro
}
public void removedService(ServiceReference<IProvisioningAgent> reference, IProvisioningAgent service) {
+ if (provAgent != service) {
+ return;
+ }
+
if (providerRegistration != null)
providerRegistration.unregister();
providerRegistration = null;
+ provider = null;
+ provAgent = null;
}
}

Back to the top