Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2019-02-02 15:59:09 +0000
committerMykola Nikishov2019-04-08 20:08:55 +0000
commit27bbfde63c239995d72025d915aaaebc3e705eaa (patch)
tree1711ec866bf3e405ab7ab5e60116d1cd36243095
parent2425ef6af6f6ccf77147a1006dc1c7b643a257c8 (diff)
downloadrt.equinox.p2-27bbfde63c239995d72025d915aaaebc3e705eaa.tar.gz
rt.equinox.p2-27bbfde63c239995d72025d915aaaebc3e705eaa.tar.xz
rt.equinox.p2-27bbfde63c239995d72025d915aaaebc3e705eaa.zip
Bug 544066 - Remove activator from org.eclipse.equinox.p2.operations
Change-Id: I33c67a1bd78a77def56fb7e0efd889e5d352b386 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com> Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/Constants.java (renamed from bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/Activator.java)24
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/PlanAnalyzer.java32
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/PlannerResolutionJob.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/ResolutionResult.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/OperationFactory.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProfileChangeOperation.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProvisioningJob.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProvisioningSession.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemediationOperation.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RepositoryTracker.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SynchronizeOperationTest.java4
13 files changed, 46 insertions, 62 deletions
diff --git a/bundles/org.eclipse.equinox.p2.operations/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.operations/META-INF/MANIFEST.MF
index 75b000a19..529a27408 100644
--- a/bundles/org.eclipse.equinox.p2.operations/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.operations/META-INF/MANIFEST.MF
@@ -2,8 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.p2.operations;singleton:=true
-Bundle-Version: 2.5.300.qualifier
-Bundle-Activator: org.eclipse.equinox.internal.p2.operations.Activator
+Bundle-Version: 2.5.400.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.equinox.internal.p2.operations;x-friends:="org.eclipse.pde.ui",
diff --git a/bundles/org.eclipse.equinox.p2.operations/pom.xml b/bundles/org.eclipse.equinox.p2.operations/pom.xml
index 9b657d90d..755f18b9a 100644
--- a/bundles/org.eclipse.equinox.p2.operations/pom.xml
+++ b/bundles/org.eclipse.equinox.p2.operations/pom.xml
@@ -19,6 +19,6 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.p2.operations</artifactId>
- <version>2.5.300-SNAPSHOT</version>
+ <version>2.5.400-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/Activator.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/Constants.java
index d18c9360f..067af2476 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/Constants.java
@@ -13,27 +13,9 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.operations;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
/**
- * Activator class that registers the update checker service.
+ * Constant interface which holds the ID of the bundle.
*/
-public class Activator implements BundleActivator {
- public static final String ID = "org.eclipse.equinox.p2.operations"; //$NON-NLS-1$
- private static BundleContext context;
-
- public static BundleContext getContext() {
- return context;
- }
-
- @Override
- public void start(BundleContext bundleContext) throws Exception {
- Activator.context = bundleContext;
- }
-
- @Override
- public void stop(BundleContext bundleContext) throws Exception {
- Activator.context = null;
- }
+public interface Constants {
+ public static final String BUNDLE_ID = "org.eclipse.equinox.p2.operations"; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/PlanAnalyzer.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/PlanAnalyzer.java
index 62368234e..f61bb48b6 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/PlanAnalyzer.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/PlanAnalyzer.java
@@ -35,27 +35,27 @@ public class PlanAnalyzer {
public static IStatus getStatus(int statusCode, IInstallableUnit affectedIU) {
switch (statusCode) {
case IStatusCodes.NOTHING_TO_UPDATE :
- return new Status(IStatus.INFO, Activator.ID, statusCode, Messages.PlanAnalyzer_NoUpdates, null);
+ return new Status(IStatus.INFO, Constants.BUNDLE_ID, statusCode, Messages.PlanAnalyzer_NoUpdates, null);
case IStatusCodes.PROFILE_CHANGE_ALTERED :
- return new MultiStatus(Activator.ID, statusCode, Messages.PlanAnalyzer_RequestAltered, null);
+ return new MultiStatus(Constants.BUNDLE_ID, statusCode, Messages.PlanAnalyzer_RequestAltered, null);
case IStatusCodes.ALTERED_IMPLIED_UPDATE :
- return new Status(IStatus.INFO, Activator.ID, statusCode, NLS.bind(Messages.PlanAnalyzer_ImpliedUpdate, getIUString(affectedIU)), null);
+ return new Status(IStatus.INFO, Constants.BUNDLE_ID, statusCode, NLS.bind(Messages.PlanAnalyzer_ImpliedUpdate, getIUString(affectedIU)), null);
case IStatusCodes.ALTERED_IGNORED_IMPLIED_UPDATE :
- return new Status(IStatus.WARNING, Activator.ID, statusCode, NLS.bind(Messages.PlanAnalyzer_LockedImpliedUpdate0, getIUString(affectedIU)), null);
+ return new Status(IStatus.WARNING, Constants.BUNDLE_ID, statusCode, NLS.bind(Messages.PlanAnalyzer_LockedImpliedUpdate0, getIUString(affectedIU)), null);
case IStatusCodes.ALTERED_IGNORED_IMPLIED_DOWNGRADE :
- return new Status(IStatus.WARNING, Activator.ID, statusCode, NLS.bind(Messages.PlanAnalyzer_IgnoringImpliedDowngrade, getIUString(affectedIU)), null);
+ return new Status(IStatus.WARNING, Constants.BUNDLE_ID, statusCode, NLS.bind(Messages.PlanAnalyzer_IgnoringImpliedDowngrade, getIUString(affectedIU)), null);
case IStatusCodes.ALTERED_IGNORED_ALREADY_INSTALLED :
- return new Status(IStatus.WARNING, Activator.ID, statusCode, NLS.bind(Messages.PlanAnalyzer_AlreadyInstalled, getIUString(affectedIU)), null);
+ return new Status(IStatus.WARNING, Constants.BUNDLE_ID, statusCode, NLS.bind(Messages.PlanAnalyzer_AlreadyInstalled, getIUString(affectedIU)), null);
case IStatusCodes.ALTERED_PARTIAL_INSTALL :
- return new Status(IStatus.INFO, Activator.ID, statusCode, NLS.bind(Messages.PlanAnalyzer_PartialInstall, getIUString(affectedIU)), null);
+ return new Status(IStatus.INFO, Constants.BUNDLE_ID, statusCode, NLS.bind(Messages.PlanAnalyzer_PartialInstall, getIUString(affectedIU)), null);
case IStatusCodes.ALTERED_PARTIAL_UNINSTALL :
- return new Status(IStatus.INFO, Activator.ID, statusCode, NLS.bind(Messages.PlanAnalyzer_PartialUninstall, getIUString(affectedIU)), null);
+ return new Status(IStatus.INFO, Constants.BUNDLE_ID, statusCode, NLS.bind(Messages.PlanAnalyzer_PartialUninstall, getIUString(affectedIU)), null);
case IStatusCodes.UNEXPECTED_NOTHING_TO_DO :
- return new Status(IStatus.ERROR, Activator.ID, statusCode, NLS.bind(Messages.PlanAnalyzer_NothingToDo, getIUString(affectedIU)), null);
+ return new Status(IStatus.ERROR, Constants.BUNDLE_ID, statusCode, NLS.bind(Messages.PlanAnalyzer_NothingToDo, getIUString(affectedIU)), null);
case IStatusCodes.OPERATION_ALREADY_IN_PROGRESS :
- return new Status(IStatus.ERROR, Activator.ID, statusCode, Messages.PlanAnalyzer_AnotherOperationInProgress, null);
+ return new Status(IStatus.ERROR, Constants.BUNDLE_ID, statusCode, Messages.PlanAnalyzer_AnotherOperationInProgress, null);
default :
- return new Status(IStatus.ERROR, Activator.ID, statusCode, NLS.bind(Messages.PlanAnalyzer_UnexpectedError, Integer.valueOf(statusCode), getIUString(affectedIU)), null);
+ return new Status(IStatus.ERROR, Constants.BUNDLE_ID, statusCode, NLS.bind(Messages.PlanAnalyzer_UnexpectedError, Integer.valueOf(statusCode), getIUString(affectedIU)), null);
}
}
@@ -113,7 +113,7 @@ public class PlanAnalyzer {
RequestStatus rs = plannerStatus.getRequestChanges().get(added);
if (rs.getSeverity() == IStatus.ERROR) {
// This is a serious error so it must also appear in the overall status
- IStatus fail = new Status(IStatus.ERROR, Activator.ID, IStatusCodes.ALTERED_IGNORED_INSTALL_REQUEST, NLS.bind(Messages.PlanAnalyzer_IgnoringInstall, getIUString(added)), null);
+ IStatus fail = new Status(IStatus.ERROR, Constants.BUNDLE_ID, IStatusCodes.ALTERED_IGNORED_INSTALL_REQUEST, NLS.bind(Messages.PlanAnalyzer_IgnoringInstall, getIUString(added)), null);
report.addStatus(added, fail);
report.addSummaryStatus(fail);
}
@@ -127,7 +127,7 @@ public class PlanAnalyzer {
// Assume it could not be uninstalled because of some other dependency, yet the planner did not view
// this as an error. So we inform the user that we can only uninstall parts of it. The root property will be
// removed per the original change request.
- IStatus fail = new Status(IStatus.INFO, Activator.ID, IStatusCodes.ALTERED_PARTIAL_UNINSTALL, NLS.bind(Messages.PlanAnalyzer_PartialUninstall, getIUString(removed)), null);
+ IStatus fail = new Status(IStatus.INFO, Constants.BUNDLE_ID, IStatusCodes.ALTERED_PARTIAL_UNINSTALL, NLS.bind(Messages.PlanAnalyzer_PartialUninstall, getIUString(removed)), null);
report.addStatus(removed, fail);
report.addSummaryStatus(fail);
}
@@ -135,7 +135,7 @@ public class PlanAnalyzer {
} else {
if (plannerStatus.getCode() == IStatusCodes.MISSING_REQUIREMENTS) {
IStatus existingSummaryStatus = report.getSummaryStatus();
- MultiStatus newSummaryStatus = new MultiStatus(Activator.ID, IStatusCodes.MISSING_REQUIREMENTS, Messages.ResolutionResult_SummaryStatus, null);
+ MultiStatus newSummaryStatus = new MultiStatus(Constants.BUNDLE_ID, IStatusCodes.MISSING_REQUIREMENTS, Messages.ResolutionResult_SummaryStatus, null);
if (!existingSummaryStatus.isOK()) {
newSummaryStatus.addAll(existingSummaryStatus);
report.setSummaryStatus(newSummaryStatus);
@@ -149,9 +149,9 @@ public class PlanAnalyzer {
IInstallableUnit iu = entry.getKey();
RequestStatus rs = entry.getValue();
if (rs.getInitialRequestType() == RequestStatus.ADDED) {
- report.addStatus(iu, new Status(rs.getSeverity(), Activator.ID, IStatusCodes.ALTERED_SIDE_EFFECT_INSTALL, NLS.bind(Messages.PlanAnalyzer_SideEffectInstall, getIUString(iu)), null));
+ report.addStatus(iu, new Status(rs.getSeverity(), Constants.BUNDLE_ID, IStatusCodes.ALTERED_SIDE_EFFECT_INSTALL, NLS.bind(Messages.PlanAnalyzer_SideEffectInstall, getIUString(iu)), null));
} else {
- report.addStatus(iu, new Status(rs.getSeverity(), Activator.ID, IStatusCodes.ALTERED_SIDE_EFFECT_REMOVE, NLS.bind(Messages.PlanAnalyzer_SideEffectUninstall, getIUString(iu)), null));
+ report.addStatus(iu, new Status(rs.getSeverity(), Constants.BUNDLE_ID, IStatusCodes.ALTERED_SIDE_EFFECT_REMOVE, NLS.bind(Messages.PlanAnalyzer_SideEffectUninstall, getIUString(iu)), null));
}
}
}
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/PlannerResolutionJob.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/PlannerResolutionJob.java
index 31fcf98a2..9eae9fadb 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/PlannerResolutionJob.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/PlannerResolutionJob.java
@@ -80,7 +80,7 @@ public class PlannerResolutionJob extends ProvisioningJob implements IProfileCha
plan = ((IPlanner) getSession().getProvisioningAgent().getService(IPlanner.SERVICE_NAME)).getProvisioningPlan(request, firstPass, sub.newChild(500));
IStatus status;
if (plan == null) {
- status = new Status(IStatus.ERROR, Activator.ID, Messages.PlannerResolutionJob_NullProvisioningPlan);
+ status = new Status(IStatus.ERROR, Constants.BUNDLE_ID, Messages.PlannerResolutionJob_NullProvisioningPlan);
additionalStatus.add(status);
} else {
status = plan.getStatus();
@@ -99,7 +99,7 @@ public class PlannerResolutionJob extends ProvisioningJob implements IProfileCha
successful = secondPass;
plan = ((IPlanner) getSession().getProvisioningAgent().getService(IPlanner.SERVICE_NAME)).getProvisioningPlan(request, secondPass, sub.newChild(500));
if (plan == null) {
- status = new Status(IStatus.ERROR, Activator.ID, Messages.PlannerResolutionJob_NullProvisioningPlan);
+ status = new Status(IStatus.ERROR, Constants.BUNDLE_ID, Messages.PlannerResolutionJob_NullProvisioningPlan);
additionalStatus.add(status);
return status;
}
@@ -110,7 +110,7 @@ public class PlannerResolutionJob extends ProvisioningJob implements IProfileCha
if (report == null) {
if (plan == null) {
if (additionalStatus.getSeverity() != IStatus.ERROR) {
- additionalStatus.add(new Status(IStatus.ERROR, Activator.ID, Messages.PlannerResolutionJob_NullProvisioningPlan));
+ additionalStatus.add(new Status(IStatus.ERROR, Constants.BUNDLE_ID, Messages.PlannerResolutionJob_NullProvisioningPlan));
}
report = new ResolutionResult();
report.addSummaryStatus(additionalStatus);
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/ResolutionResult.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/ResolutionResult.java
index 9c2c395ef..7c9926c01 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/ResolutionResult.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/ResolutionResult.java
@@ -42,7 +42,7 @@ public class ResolutionResult {
public void addSummaryStatus(IStatus status) {
if (summaryStatus == null) {
- summaryStatus = new MultiStatus(Activator.ID, 0, Messages.ResolutionResult_SummaryStatus, null);
+ summaryStatus = new MultiStatus(Constants.BUNDLE_ID, 0, Messages.ResolutionResult_SummaryStatus, null);
}
summaryStatus.add(status);
}
@@ -54,7 +54,7 @@ public class ResolutionResult {
public void addStatus(IInstallableUnit iu, IStatus status) {
MultiStatus iuSummaryStatus = iuToStatusMap.get(iu);
if (iuSummaryStatus == null) {
- iuSummaryStatus = new MultiStatus(Activator.ID, IStatusCodes.IU_REQUEST_ALTERED, new IStatus[] {status}, getIUString(iu), null);
+ iuSummaryStatus = new MultiStatus(Constants.BUNDLE_ID, IStatusCodes.IU_REQUEST_ALTERED, new IStatus[] {status}, getIUString(iu), null);
} else
iuSummaryStatus.add(status);
}
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/OperationFactory.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/OperationFactory.java
index 5002f82e0..1b7457a25 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/OperationFactory.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/OperationFactory.java
@@ -17,7 +17,7 @@ package org.eclipse.equinox.p2.operations;
import java.net.URI;
import java.util.*;
import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.operations.Activator;
+import org.eclipse.equinox.internal.p2.operations.Constants;
import org.eclipse.equinox.internal.p2.operations.Messages;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.ProvisionException;
@@ -27,8 +27,7 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IVersionedId;
import org.eclipse.equinox.p2.query.*;
import org.eclipse.osgi.util.NLS;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
+import org.osgi.framework.*;
/**
* OperationFactory provides a set of helpers to simplify dealing with the running installation.
@@ -40,15 +39,16 @@ public class OperationFactory {
private IProvisioningAgent getAgent() {
Collection<ServiceReference<IProvisioningAgent>> ref = null;
+ BundleContext bundleContext = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
try {
- ref = Activator.getContext().getServiceReferences(IProvisioningAgent.class, '(' + IProvisioningAgent.SERVICE_CURRENT + '=' + Boolean.TRUE.toString() + ')');
+ ref = bundleContext.getServiceReferences(IProvisioningAgent.class, '(' + IProvisioningAgent.SERVICE_CURRENT + '=' + Boolean.TRUE.toString() + ')');
} catch (InvalidSyntaxException e) {
//ignore can't happen since we write the filter ourselves
}
if (ref == null || ref.size() == 0)
throw new IllegalStateException(Messages.OperationFactory_noAgent);
- IProvisioningAgent agent = Activator.getContext().getService(ref.iterator().next());
- Activator.getContext().ungetService(ref.iterator().next());
+ IProvisioningAgent agent = bundleContext.getService(ref.iterator().next());
+ bundleContext.ungetService(ref.iterator().next());
return agent;
}
@@ -65,7 +65,7 @@ public class OperationFactory {
IQuery<IInstallableUnit> installableUnits = QueryUtil.createIUQuery(versionedId.getId(), versionedId.getVersion());
IQueryResult<IInstallableUnit> matches = searchContext.query(installableUnits, monitor);
if (matches.isEmpty())
- throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.OperationFactory_noIUFound, versionedId)));
+ throw new ProvisionException(new Status(IStatus.ERROR, Constants.BUNDLE_ID, NLS.bind(Messages.OperationFactory_noIUFound, versionedId)));
//Add the first IU
Iterator<IInstallableUnit> iuIt = matches.iterator();
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProfileChangeOperation.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProfileChangeOperation.java
index b2c6a0f54..989a3f8a0 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProfileChangeOperation.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProfileChangeOperation.java
@@ -170,7 +170,7 @@ public abstract class ProfileChangeOperation implements IProfileChangeJob {
if (request == null) {
if (noChangeRequest.getChildren().length == 0)
// No explanation for failure was provided. It shouldn't happen, but...
- noChangeRequest = new MultiStatus(Activator.ID, IStatusCodes.UNEXPECTED_NOTHING_TO_DO, new IStatus[] {PlanAnalyzer.getStatus(IStatusCodes.UNEXPECTED_NOTHING_TO_DO, null)}, Messages.ProfileChangeOperation_NoProfileChangeRequest, null);
+ noChangeRequest = new MultiStatus(Constants.BUNDLE_ID, IStatusCodes.UNEXPECTED_NOTHING_TO_DO, new IStatus[] {PlanAnalyzer.getStatus(IStatusCodes.UNEXPECTED_NOTHING_TO_DO, null)}, Messages.ProfileChangeOperation_NoProfileChangeRequest, null);
return;
}
createPlannerResolutionJob();
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProvisioningJob.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProvisioningJob.java
index aaae094b8..438bd3c44 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProvisioningJob.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProvisioningJob.java
@@ -15,7 +15,7 @@ package org.eclipse.equinox.p2.operations;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.equinox.internal.p2.operations.Activator;
+import org.eclipse.equinox.internal.p2.operations.Constants;
import org.eclipse.equinox.internal.p2.operations.Messages;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.osgi.util.NLS;
@@ -234,7 +234,7 @@ public abstract class ProvisioningJob extends Job {
message = NLS.bind(Messages.ProvisioningJob_GenericErrorStatusMessage, getName());
else
message = e.getLocalizedMessage();
- return new Status(IStatus.ERROR, Activator.ID, message, e);
+ return new Status(IStatus.ERROR, Constants.BUNDLE_ID, message, e);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProvisioningSession.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProvisioningSession.java
index e1bec942e..f6cd7d3d6 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProvisioningSession.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProvisioningSession.java
@@ -21,7 +21,7 @@ import java.util.*;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.*;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
-import org.eclipse.equinox.internal.p2.operations.Activator;
+import org.eclipse.equinox.internal.p2.operations.Constants;
import org.eclipse.equinox.internal.p2.operations.Messages;
import org.eclipse.equinox.internal.provisional.configurator.Configurator;
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
@@ -33,6 +33,8 @@ import org.eclipse.equinox.p2.planner.IPlanner;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
/**
* ProvisioningSession provides the context for a provisioning session, including
@@ -167,12 +169,13 @@ public class ProvisioningSession {
}
ticksUsed += 100;
// Apply the configuration
- Configurator configChanger = ServiceHelper.getService(Activator.getContext(), Configurator.class);
+ BundleContext bundleContext = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
+ Configurator configChanger = ServiceHelper.getService(bundleContext, Configurator.class);
try {
configChanger.applyConfiguration();
} catch (IOException e) {
mon.done();
- return new Status(IStatus.ERROR, Activator.ID, Messages.ProvisioningSession_InstallPlanConfigurationError, e);
+ return new Status(IStatus.ERROR, Constants.BUNDLE_ID, Messages.ProvisioningSession_InstallPlanConfigurationError, e);
}
}
return getEngine().perform(plan, set, mon.newChild(500 - ticksUsed));
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemediationOperation.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemediationOperation.java
index 714bae12b..0d7916a68 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemediationOperation.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemediationOperation.java
@@ -230,7 +230,7 @@ public class RemediationOperation extends ProfileChangeOperation {
public IStatus getResolutionResult() {
if (currentRemedy != null)
return super.getResolutionResult();
- return remedies.size() > 0 ? Status.OK_STATUS : new Status(IStatus.ERROR, Activator.ID, Messages.RemediationOperation_NoRemedyFound);
+ return remedies.size() > 0 ? Status.OK_STATUS : new Status(IStatus.ERROR, Constants.BUNDLE_ID, Messages.RemediationOperation_NoRemedyFound);
}
private void computeRemedyDetails(Remedy remedy) {
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RepositoryTracker.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RepositoryTracker.java
index 1e9d73d04..aefdfdb04 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RepositoryTracker.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RepositoryTracker.java
@@ -60,7 +60,7 @@ public abstract class RepositoryTracker {
* @return a status that describes an invalid location
*/
public IStatus getInvalidLocationStatus(String locationText) {
- return new Status(IStatus.ERROR, Activator.ID, IStatusCodes.INVALID_REPOSITORY_LOCATION, NLS.bind(Messages.RepositoryTracker_InvalidLocation, locationText), null);
+ return new Status(IStatus.ERROR, Constants.BUNDLE_ID, IStatusCodes.INVALID_REPOSITORY_LOCATION, NLS.bind(Messages.RepositoryTracker_InvalidLocation, locationText), null);
}
/**
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SynchronizeOperationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SynchronizeOperationTest.java
index dcf3c8346..f5ddba21c 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SynchronizeOperationTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SynchronizeOperationTest.java
@@ -25,7 +25,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
-import org.eclipse.equinox.internal.p2.operations.Activator;
+import org.eclipse.equinox.internal.p2.operations.Constants;
import org.eclipse.equinox.internal.p2.operations.Messages;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.IProvisioningAgentProvider;
@@ -132,7 +132,7 @@ public class SynchronizeOperationTest extends AbstractProvisioningTest {
IQuery<IInstallableUnit> installableUnits = QueryUtil.createIUQuery(versionedId.getId(), versionedId.getVersion());
IQueryResult<IInstallableUnit> matches = searchContext.query(installableUnits, monitor);
if (matches.isEmpty())
- throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.OperationFactory_noIUFound, versionedId)));
+ throw new ProvisionException(new Status(IStatus.ERROR, Constants.BUNDLE_ID, NLS.bind(Messages.OperationFactory_noIUFound, versionedId)));
//Add the first IU
Iterator<IInstallableUnit> iuIt = matches.iterator();

Back to the top