Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.operations/src/org/eclipse')
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/Activator.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/PlannerResolutionJob.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/RemediationResolutionJob.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/RequestFlexer.java32
-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/internal/p2/operations/SearchForUpdatesResolutionJob.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/InstallOperation.java29
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/OperationFactory.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProfileChangeOperation.java17
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProfileModificationJob.java17
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProvisioningJob.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProvisioningSession.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemediationOperation.java31
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/Remedy.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemedyConfig.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/SynchronizeOperation.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UninstallOperation.java23
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/Update.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UpdateOperation.java60
19 files changed, 121 insertions, 161 deletions
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/Activator.java
index 8d5a2fc02..ff230a21f 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/Activator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* 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
@@ -24,10 +24,12 @@ public class Activator implements BundleActivator {
return context;
}
+ @Override
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
}
+ @Override
public void stop(BundleContext bundleContext) throws Exception {
Activator.context = 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 78264ab90..f8931b17e 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* 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
@@ -65,6 +65,7 @@ public class PlannerResolutionJob extends ProvisioningJob implements IProfileCha
this.firstPass = firstPass;
}
+ @Override
public IStatus runModal(IProgressMonitor monitor) {
SubMonitor sub;
if (evaluator != null) {
@@ -117,6 +118,7 @@ public class PlannerResolutionJob extends ProvisioningJob implements IProfileCha
return report;
}
+ @Override
public String getProfileId() {
return profileId;
}
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/RemediationResolutionJob.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/RemediationResolutionJob.java
index 1c10d322f..528591415 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/RemediationResolutionJob.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/RemediationResolutionJob.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2017 IBM Corporation and others.
* 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
@@ -31,6 +31,7 @@ public class RemediationResolutionJob extends PlannerResolutionJob {
this.requestHolder = requestFromOperation;
}
+ @Override
public IStatus runModal(IProgressMonitor monitor) {
SubMonitor sub = SubMonitor.convert(monitor, 2);
try {
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/RequestFlexer.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/RequestFlexer.java
index cb1a3ca70..e071acc21 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/RequestFlexer.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/RequestFlexer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 Red Hat, Inc. and others
+ * Copyright (c) 2013, 2017 Red Hat, Inc. and others
* 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
@@ -41,10 +41,10 @@ public class RequestFlexer {
private ProvisioningContext provisioningContext;
- Set<IRequirement> requirementsForElementsBeingInstalled = new HashSet<IRequirement>();
- Set<IRequirement> requirementsForElementsAlreadyInstalled = new HashSet<IRequirement>();
- Map<IRequirement, Map<String, String>> propertiesPerRequirement = new HashMap<IRequirement, Map<String, String>>();
- Map<IRequirement, List<String>> removedPropertiesPerRequirement = new HashMap<IRequirement, List<String>>();
+ Set<IRequirement> requirementsForElementsBeingInstalled = new HashSet<>();
+ Set<IRequirement> requirementsForElementsAlreadyInstalled = new HashSet<>();
+ Map<IRequirement, Map<String, String>> propertiesPerRequirement = new HashMap<>();
+ Map<IRequirement, List<String>> removedPropertiesPerRequirement = new HashMap<>();
IProfile profile;
@@ -137,8 +137,8 @@ public class RequestFlexer {
private IProfileChangeRequest computeEffectiveChangeRequest(IProvisioningPlan intermediaryPlan, IProfileChangeRequest loosenedRequest, IProfileChangeRequest originalRequest) {
IProfileChangeRequest finalChangeRequest = planner.createChangeRequest(profile);
// We have the following two variables because a IPCRequest can not be muted
- Set<IInstallableUnit> iusToAdd = new HashSet<IInstallableUnit>();
- Set<IInstallableUnit> iusToRemove = new HashSet<IInstallableUnit>();
+ Set<IInstallableUnit> iusToAdd = new HashSet<>();
+ Set<IInstallableUnit> iusToRemove = new HashSet<>();
for (IRequirement beingInstalled : requirementsForElementsBeingInstalled) {
IQuery<IInstallableUnit> query = QueryUtil.createMatchQuery(beingInstalled.getMatches());
@@ -176,7 +176,7 @@ public class RequestFlexer {
iusToRemove.addAll(originalRequest.getRemovals());
//Remove entries that are both in the additions and removals (since this is a no-op)
- HashSet<IInstallableUnit> commons = new HashSet<IInstallableUnit>(iusToAdd);
+ HashSet<IInstallableUnit> commons = new HashSet<>(iusToAdd);
if (commons.retainAll(iusToRemove)) {
iusToAdd.removeAll(commons);
iusToRemove.removeAll(commons);
@@ -248,11 +248,11 @@ public class RequestFlexer {
SubMonitor subMonitor = SubMonitor.convert(monitor, requestedAdditions.size());
for (IInstallableUnit addedIU : requestedAdditions) {
SubMonitor iterationMonitor = subMonitor.split(1);
- Collection<IInstallableUnit> potentialUpdates = allowDifferentVersion ? findAllVersionsAvailable(addedIU, iterationMonitor) : new ArrayList<IInstallableUnit>();
+ Collection<IInstallableUnit> potentialUpdates = allowDifferentVersion ? findAllVersionsAvailable(addedIU, iterationMonitor) : new ArrayList<>();
foundDifferentVersionsForElementsToInstall = (foundDifferentVersionsForElementsToInstall || (potentialUpdates.size() == 0 ? false : true));
potentialUpdates.add(addedIU); //Make sure that we include the IU that we were initially trying to install
- Collection<IRequirement> newRequirement = new ArrayList<IRequirement>(1);
+ Collection<IRequirement> newRequirement = new ArrayList<>(1);
IRequirement req = createORRequirement(potentialUpdates, allowPartialInstall || isRequestedInstallationOptional(addedIU, originalRequest));
newRequirement.add(req);
newRequest.addExtraRequirements(newRequirement);
@@ -271,9 +271,9 @@ public class RequestFlexer {
//This keeps track for each requirement created (those created to loosen the constraint), of the original IU and the properties associated with it in the profile
//This is used for more easily construct the final profile change request
private void rememberIUProfileProperties(IInstallableUnit iu, IRequirement req, IProfileChangeRequest originalRequest, boolean includeProfile) {
- Map<String, String> allProperties = new HashMap<String, String>();
+ Map<String, String> allProperties = new HashMap<>();
if (includeProfile) {
- Map<String, String> tmp = new HashMap<String, String>(profile.getInstallableUnitProperties(iu));
+ Map<String, String> tmp = new HashMap<>(profile.getInstallableUnitProperties(iu));
List<String> propertiesToRemove = ((ProfileChangeRequest) originalRequest).getInstallableUnitProfilePropertiesToRemove().get(iu);
if (propertiesToRemove != null) {
for (String toRemove : propertiesToRemove) {
@@ -302,7 +302,7 @@ public class RequestFlexer {
}
private Collection<IInstallableUnit> findAllVersionsAvailable(IInstallableUnit iu, IProgressMonitor monitor) {
- Collection<IInstallableUnit> allVersions = new HashSet<IInstallableUnit>();
+ Collection<IInstallableUnit> allVersions = new HashSet<>();
SubMonitor sub = SubMonitor.convert(monitor, 2);
allVersions.addAll(findIUsWithSameId(iu, sub.newChild(1)));
allVersions.addAll(findUpdates(iu, sub.newChild(1)));
@@ -317,7 +317,7 @@ public class RequestFlexer {
private Collection<IInstallableUnit> findUpdates(IInstallableUnit iu, IProgressMonitor monitor) {
SubMonitor subMonitor = SubMonitor.convert(monitor, 1);
- Collection<IInstallableUnit> availableUpdates = new HashSet<IInstallableUnit>();
+ Collection<IInstallableUnit> availableUpdates = new HashSet<>();
IQueryResult<IInstallableUnit> updatesAvailable = planner.updatesFor(iu, provisioningContext, subMonitor.split(1));
for (Iterator<IInstallableUnit> iterator = updatesAvailable.iterator(); iterator.hasNext();) {
availableUpdates.add(iterator.next());
@@ -350,10 +350,10 @@ public class RequestFlexer {
Set<IInstallableUnit> allRoots = getRoots();
for (IInstallableUnit existingIU : allRoots) {
- Collection<IInstallableUnit> potentialUpdates = allowInstalledUpdate ? findUpdates(existingIU, monitor) : new HashSet<IInstallableUnit>();
+ Collection<IInstallableUnit> potentialUpdates = allowInstalledUpdate ? findUpdates(existingIU, monitor) : new HashSet<>();
foundDifferentVersionsForElementsInstalled = (foundDifferentVersionsForElementsInstalled || (potentialUpdates.size() == 0 ? false : true));
potentialUpdates.add(existingIU);
- Collection<IRequirement> newRequirement = new ArrayList<IRequirement>(1);
+ Collection<IRequirement> newRequirement = new ArrayList<>(1);
//when the element is requested for removal or is installed optionally we make sure to mark it optional, otherwise the removal woudl fail
IRequirement req = createORRequirement(potentialUpdates, allowInstalledRemoval || removalRequested(existingIU, originalRequest) || isOptionallyInstalled(existingIU, originalRequest));
newRequirement.add(req);
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 16d360cf2..5254edc6c 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
* 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
@@ -24,7 +24,7 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
public class ResolutionResult {
private static final String NESTING_INDENT = " "; //$NON-NLS-1$
- private final HashMap<IInstallableUnit, MultiStatus> iuToStatusMap = new HashMap<IInstallableUnit, MultiStatus>();
+ private final HashMap<IInstallableUnit, MultiStatus> iuToStatusMap = new HashMap<>();
private MultiStatus summaryStatus;
public IStatus getSummaryStatus() {
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/SearchForUpdatesResolutionJob.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/SearchForUpdatesResolutionJob.java
index 5fcd8f152..fe359bd20 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/SearchForUpdatesResolutionJob.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/SearchForUpdatesResolutionJob.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2017 IBM Corporation and others.
* 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
@@ -31,6 +31,7 @@ public class SearchForUpdatesResolutionJob extends PlannerResolutionJob {
this.operation = operation;
}
+ @Override
public IStatus runModal(IProgressMonitor monitor) {
SubMonitor sub = SubMonitor.convert(monitor);
try {
@@ -48,6 +49,7 @@ public class SearchForUpdatesResolutionJob extends PlannerResolutionJob {
}
// This is made public for the automated tests
+ @Override
public ProfileChangeRequest getProfileChangeRequest() {
return request;
}
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/InstallOperation.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/InstallOperation.java
index 79b613ce7..e5a59bfc6 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/InstallOperation.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/InstallOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2012 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
* 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
@@ -66,10 +66,7 @@ public class InstallOperation extends ProfileChangeOperation {
this.toInstall = toInstall;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.equinox.p2.operations.ProfileChangeOperation#computeProfileChangeRequest(org.eclipse.core.runtime.MultiStatus, org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
protected void computeProfileChangeRequest(MultiStatus status, IProgressMonitor monitor) {
request = ProfileChangeRequest.createByProfileId(session.getProvisioningAgent(), profileId);
IProfile profile = session.getProfileRegistry().getProfile(profileId);
@@ -146,16 +143,12 @@ public class InstallOperation extends ProfileChangeOperation {
request.setInstallableUnitProfileProperty(entryToInstall, IProfile.PROP_PROFILE_ROOT_IU, Boolean.toString(true));
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.p2.operations.ProfileChangeOperation#getResolveJobName()
- */
+ @Override
protected String getResolveJobName() {
return Messages.InstallOperation_ResolveJobName;
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.p2.operations.ProfileChangeOperation#getProvisioningJobName()
- */
+ @Override
protected String getProvisioningJobName() {
return Messages.InstallOperation_InstallJobName;
@@ -170,14 +163,12 @@ public class InstallOperation extends ProfileChangeOperation {
@Override
IFailedStatusEvaluator getSecondPassEvaluator() {
- return new IFailedStatusEvaluator() {
- public ProvisioningContext getSecondPassProvisioningContext(IProvisioningPlan failedPlan) {
- // Follow metadata repository references if the first try fails
- // There should be real API for this!
- if (missingRequirement(failedPlan))
- context.setProperty(ProvisioningContext.FOLLOW_REPOSITORY_REFERENCES, Boolean.toString(true));
- return context;
- }
+ return failedPlan -> {
+ // Follow metadata repository references if the first try fails
+ // There should be real API for this!
+ if (missingRequirement(failedPlan))
+ context.setProperty(ProvisioningContext.FOLLOW_REPOSITORY_REFERENCES, Boolean.toString(true));
+ return context;
};
}
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 c016de25b..77f341dd3 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Sonatype, Inc. and others.
+ * Copyright (c) 2011, 2017 Sonatype, Inc. and others.
* 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
@@ -51,7 +51,7 @@ public class OperationFactory {
//Return a list of IUs from the list of versionedIDs originally provided
private Collection<IInstallableUnit> gatherIUs(IQueryable<IInstallableUnit> searchContext, Collection<? extends IVersionedId> ius, boolean checkIUs, IProgressMonitor monitor) throws ProvisionException {
- Collection<IInstallableUnit> gatheredIUs = new ArrayList<IInstallableUnit>(ius.size());
+ Collection<IInstallableUnit> gatheredIUs = new ArrayList<>(ius.size());
for (IVersionedId versionedId : ius) {
if (!checkIUs && versionedId instanceof IInstallableUnit) {
@@ -134,7 +134,7 @@ public class OperationFactory {
IProfileRegistry registry = (IProfileRegistry) getAgent().getService(IProfileRegistry.SERVICE_NAME);
IProfile profile = registry.getProfile(IProfileRegistry.SELF);
if (profile == null)
- return new CollectionResult<IInstallableUnit>(null);
+ return new CollectionResult<>(null);
if (rootsOnly)
return profile.query(new UserVisibleRootQuery(), monitor);
return profile.query(QueryUtil.ALL_UNITS, monitor);
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 ec1923553..7fce4a549 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2013 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
* 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
@@ -353,10 +353,7 @@ public abstract class ProfileChangeOperation implements IProfileChangeJob {
return context;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.equinox.p2.operations.IProfileChangeJob#getProfileId()
- */
+ @Override
public String getProfileId() {
return profileId;
}
@@ -380,15 +377,11 @@ public abstract class ProfileChangeOperation implements IProfileChangeJob {
}
IFailedStatusEvaluator getSecondPassEvaluator() {
- return new IFailedStatusEvaluator() {
- public ProvisioningContext getSecondPassProvisioningContext(IProvisioningPlan failedPlan) {
- return null;
- }
- };
+ return failedPlan -> null;
}
- protected void updateJobProvisioningContexts(PlannerResolutionJob job, ProvisioningContext context) {
- job.setFirstPassProvisioningContext(context);
+ protected void updateJobProvisioningContexts(PlannerResolutionJob resolutionJob, ProvisioningContext provisioningContext) {
+ resolutionJob.setFirstPassProvisioningContext(provisioningContext);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProfileModificationJob.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProfileModificationJob.java
index fbab41a70..abf920518 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProfileModificationJob.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProfileModificationJob.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* 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
@@ -55,18 +55,12 @@ public class ProfileModificationJob extends ProvisioningJob implements IProfileC
this.phaseSet = phaseSet;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.equinox.p2.operations.IProfileChangeJob#getProfileId()
- */
+ @Override
public String getProfileId() {
return profileId;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.equinox.p2.operations.ProvisioningJob#runModal(org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
public IStatus runModal(IProgressMonitor monitor) {
if (monitor == null)
monitor = new NullProgressMonitor();
@@ -92,10 +86,7 @@ public class ProfileModificationJob extends ProvisioningJob implements IProfileC
this.taskName = label;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.equinox.p2.operations.ProvisioningJob#getRestartPolicy()
- */
+ @Override
public int getRestartPolicy() {
//if we are installing into self we must always use the restart policy
if (IProfileRegistry.SELF.equals(profileId))
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 e0c57a8df..91f861fc7 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* 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
@@ -10,12 +10,11 @@
*******************************************************************************/
package org.eclipse.equinox.p2.operations;
-import org.eclipse.equinox.p2.core.ProvisionException;
-
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.Messages;
+import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.osgi.util.NLS;
/**
@@ -40,54 +39,64 @@ public abstract class ProvisioningJob extends Job {
additionalMonitor = monitor2;
}
+ @Override
public void beginTask(String name, int totalWork) {
super.beginTask(name, totalWork);
additionalMonitor.beginTask(name, totalWork);
}
+ @Override
public void clearBlocked() {
super.clearBlocked();
if (additionalMonitor instanceof IProgressMonitorWithBlocking)
((IProgressMonitorWithBlocking) additionalMonitor).clearBlocked();
}
+ @Override
public void done() {
super.done();
additionalMonitor.done();
}
+ @Override
public void internalWorked(double work) {
super.internalWorked(work);
additionalMonitor.internalWorked(work);
}
+ @Override
public boolean isCanceled() {
if (super.isCanceled())
return true;
return additionalMonitor.isCanceled();
}
+ @Override
public void setBlocked(IStatus reason) {
super.setBlocked(reason);
if (additionalMonitor instanceof IProgressMonitorWithBlocking)
((IProgressMonitorWithBlocking) additionalMonitor).setBlocked(reason);
}
+ @Override
public void setCanceled(boolean b) {
super.setCanceled(b);
additionalMonitor.setCanceled(b);
}
+ @Override
public void setTaskName(String name) {
super.setTaskName(name);
additionalMonitor.setTaskName(name);
}
+ @Override
public void subTask(String name) {
super.subTask(name);
additionalMonitor.subTask(name);
}
+ @Override
public void worked(int work) {
super.worked(work);
additionalMonitor.worked(work);
@@ -170,6 +179,7 @@ public abstract class ProvisioningJob extends Job {
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
*
*/
+ @Override
public final IStatus run(IProgressMonitor monitor) {
IProgressMonitor wrappedMonitor = getCombinedProgressMonitor(monitor, additionalMonitor);
IStatus status = Status.OK_STATUS;
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 5e906f4d0..72aff8ab0 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
* 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
@@ -221,6 +221,7 @@ public class ProvisioningSession {
public void rememberJob(Job job) {
scheduledJobs.add(job);
job.addJobChangeListener(new JobChangeAdapter() {
+ @Override
public void done(IJobChangeEvent event) {
scheduledJobs.remove(event.getJob());
}
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 ab0d55748..c6770d5d8 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 Red Hat, Inc. and others
+ * Copyright (c) 2013, 2017 Red Hat, Inc. and others
* 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
@@ -19,7 +19,6 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.planner.IPlanner;
import org.eclipse.equinox.p2.planner.IProfileChangeRequest;
-import org.eclipse.equinox.p2.repository.IRunnableWithProgress;
/**
* <p>
@@ -66,7 +65,7 @@ public class RemediationOperation extends ProfileChangeOperation {
public RemediationOperation(ProvisioningSession session, IProfileChangeRequest originalRequest, RemedyConfig[] remedyConfigs) {
super(session);
this.originalRequest = originalRequest;
- remedies = new ArrayList<Remedy>();
+ remedies = new ArrayList<>();
this.remedyConfigs = remedyConfigs;
}
@@ -101,7 +100,7 @@ public class RemediationOperation extends ProfileChangeOperation {
private IStatus computeAllRemediations(IProgressMonitor monitor) {
SubMonitor sub = SubMonitor.convert(monitor, remedyConfigs.length);
sub.setTaskName(Messages.RemediationOperation_ProfileChangeRequestProgress);
- List<Remedy> tmpRemedies = new ArrayList<Remedy>(remedyConfigs.length);
+ List<Remedy> tmpRemedies = new ArrayList<>(remedyConfigs.length);
try {
for (int i = 0; i < remedyConfigs.length; i++) {
sub.subTask((i + 1) + " / " + remedyConfigs.length); //$NON-NLS-1$
@@ -185,6 +184,7 @@ public class RemediationOperation extends ProfileChangeOperation {
return Messages.RemediationOperation_RemediationJobName;
}
+ @Override
public ProvisioningJob getProvisioningJob(IProgressMonitor monitor) {
IStatus status = getResolutionResult();
if (status.getSeverity() != IStatus.CANCEL && status.getSeverity() != IStatus.ERROR) {
@@ -201,6 +201,7 @@ public class RemediationOperation extends ProfileChangeOperation {
return (ProfileChangeRequest) originalRequest;
}
+ @Override
void makeResolveJob(final IProgressMonitor monitor) {
// throw away any previous requests
request = null;
@@ -209,17 +210,15 @@ public class RemediationOperation extends ProfileChangeOperation {
// for the resolution job to get the request from the operation after it has been
// computed.
final ProfileChangeRequest[] requestHolder = new ProfileChangeRequest[1];
- job = new RemediationResolutionJob(getResolveJobName(), session, profileId, request, getFirstPassProvisioningContext(), getSecondPassEvaluator(), noChangeRequest, new IRunnableWithProgress() {
- public void run(IProgressMonitor mon) throws OperationCanceledException {
- SubMonitor sub = SubMonitor.convert(mon, 2);
- // We only check for other jobs running if this job is *not* scheduled
- if (job.getState() == Job.NONE && session.hasScheduledOperationsFor(profileId)) {
- noChangeRequest.add(PlanAnalyzer.getStatus(IStatusCodes.OPERATION_ALREADY_IN_PROGRESS, null));
- } else {
- sub.worked(1);
- computeProfileChangeRequest(noChangeRequest, sub.newChild(1));
- requestHolder[0] = RemediationOperation.this.request;
- }
+ job = new RemediationResolutionJob(getResolveJobName(), session, profileId, request, getFirstPassProvisioningContext(), getSecondPassEvaluator(), noChangeRequest, mon -> {
+ SubMonitor sub = SubMonitor.convert(mon, 2);
+ // We only check for other jobs running if this job is *not* scheduled
+ if (job.getState() == Job.NONE && session.hasScheduledOperationsFor(profileId)) {
+ noChangeRequest.add(PlanAnalyzer.getStatus(IStatusCodes.OPERATION_ALREADY_IN_PROGRESS, null));
+ } else {
+ sub.worked(1);
+ computeProfileChangeRequest(noChangeRequest, sub.newChild(1));
+ requestHolder[0] = RemediationOperation.this.request;
}
}, requestHolder, this);
}
@@ -232,7 +231,7 @@ public class RemediationOperation extends ProfileChangeOperation {
}
private void computeRemedyDetails(Remedy remedy) {
- ArrayList<String> updateIds = new ArrayList<String>();
+ ArrayList<String> updateIds = new ArrayList<>();
for (IInstallableUnit addedIU : remedy.getRequest().getAdditions()) {
for (IInstallableUnit removedIU : remedy.getRequest().getRemovals()) {
if (removedIU.getId().equals(addedIU.getId())) {
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/Remedy.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/Remedy.java
index 59d3ff859..648e980f2 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/Remedy.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/Remedy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 Red Hat, Inc. and others
+ * Copyright (c) 2013, 2017 Red Hat, Inc. and others
* 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
@@ -45,7 +45,7 @@ public class Remedy {
public Remedy(IProfileChangeRequest originalRequest) {
this.originalRequest = originalRequest;
- this.iusDetails = new ArrayList<RemedyIUDetail>();
+ this.iusDetails = new ArrayList<>();
}
public RemedyConfig getConfig() {
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemedyConfig.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemedyConfig.java
index 53c8007cc..89a18168c 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemedyConfig.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemedyConfig.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 Red Hat, Inc. and others
+ * Copyright (c) 2013, 2017 Red Hat, Inc. and others
* 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
@@ -46,7 +46,7 @@ public class RemedyConfig {
}
public static RemedyConfig[] getAllRemedyConfigs() {
- Collection<RemedyConfig> remedyConfigs = new ArrayList<RemedyConfig>();
+ Collection<RemedyConfig> remedyConfigs = new ArrayList<>();
int allMasks = (1 << 4);
for (int i = 1; i < allMasks; i++) {
RemedyConfig remedyConfig = new RemedyConfig();
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/SynchronizeOperation.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/SynchronizeOperation.java
index 3e9e4c493..da615804d 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/SynchronizeOperation.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/SynchronizeOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Sonatype, Inc. and others.
+ * Copyright (c) 2011, 2017 Sonatype, Inc. and others.
* 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
@@ -47,10 +47,7 @@ public class SynchronizeOperation extends InstallOperation {
super(session, toInstall);
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.equinox.p2.operations.ProfileChangeOperation#computeProfileChangeRequest(org.eclipse.core.runtime.MultiStatus, org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
protected void computeProfileChangeRequest(MultiStatus status, IProgressMonitor monitor) {
request = ProfileChangeRequest.createByProfileId(session.getProvisioningAgent(), profileId);
IProfile profile;
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UninstallOperation.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UninstallOperation.java
index e9899eaf5..5adac9c39 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UninstallOperation.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UninstallOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
* 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
@@ -18,7 +18,8 @@ import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
import org.eclipse.equinox.internal.p2.operations.IFailedStatusEvaluator;
import org.eclipse.equinox.internal.p2.operations.Messages;
-import org.eclipse.equinox.p2.engine.*;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.engine.ProvisioningContext;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
/**
@@ -55,9 +56,7 @@ public class UninstallOperation extends ProfileChangeOperation {
this.toUninstall = toUninstall;
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.p2.operations.ProfileChangeOperation#computeProfileChangeRequest(org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
protected void computeProfileChangeRequest(MultiStatus status, IProgressMonitor monitor) {
request = ProfileChangeRequest.createByProfileId(session.getProvisioningAgent(), profileId);
request.removeAll(toUninstall);
@@ -71,16 +70,12 @@ public class UninstallOperation extends ProfileChangeOperation {
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.p2.operations.ProfileChangeOperation#getProvisioningJobName()
- */
+ @Override
protected String getProvisioningJobName() {
return Messages.UninstallOperation_ProvisioningJobName;
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.p2.operations.ProfileChangeOperation#getResolveJobName()
- */
+ @Override
protected String getResolveJobName() {
return Messages.UninstallOperation_ResolveJobName;
}
@@ -95,10 +90,6 @@ public class UninstallOperation extends ProfileChangeOperation {
@Override
IFailedStatusEvaluator getSecondPassEvaluator() {
- return new IFailedStatusEvaluator() {
- public ProvisioningContext getSecondPassProvisioningContext(IProvisioningPlan failedPlan) {
- return context;
- }
- };
+ return failedPlan -> context;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/Update.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/Update.java
index 3a071c3d5..1280cf083 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/Update.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/Update.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
* 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
@@ -34,9 +34,7 @@ public class Update {
this.replacement = replacement;
}
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
+ @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -52,9 +50,7 @@ public class Update {
return toUpdate.equals(other.toUpdate) && replacement.equals(other.replacement);
}
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
+ @Override
public int hashCode() {
final int prime = 31;
int result = 1;
@@ -63,9 +59,7 @@ public class Update {
return result;
}
- /*(non-Javadoc)
- * @see java.lang.Object#toString()
- */
+ @Override
public String toString() {
return "Update " + toUpdate.toString() + " ==> " + replacement.toString(); //$NON-NLS-1$ //$NON-NLS-2$
}
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UpdateOperation.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UpdateOperation.java
index b8bf802b2..8706c7a1e 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UpdateOperation.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UpdateOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
* 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
@@ -21,7 +21,6 @@ import org.eclipse.equinox.p2.engine.query.UserVisibleRootQuery;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.planner.ProfileInclusionRules;
import org.eclipse.equinox.p2.query.*;
-import org.eclipse.equinox.p2.repository.IRunnableWithProgress;
/**
* An UpdateOperation describes an operation that updates {@link IInstallableUnit}s in
@@ -68,7 +67,7 @@ public class UpdateOperation extends ProfileChangeOperation {
public static final int STATUS_NOTHING_TO_UPDATE = IStatusCodes.NOTHING_TO_UPDATE;
private Collection<IInstallableUnit> iusToUpdate;
- private HashMap<IInstallableUnit, List<Update>> possibleUpdatesByIU = new HashMap<IInstallableUnit, List<Update>>();
+ private HashMap<IInstallableUnit, List<Update>> possibleUpdatesByIU = new HashMap<>();
private List<Update> defaultUpdates;
/**
@@ -103,7 +102,7 @@ public class UpdateOperation extends ProfileChangeOperation {
* updates.
*/
public void setSelectedUpdates(Update[] defaultUpdates) {
- this.defaultUpdates = new ArrayList<Update>(Arrays.asList(defaultUpdates));
+ this.defaultUpdates = new ArrayList<>(Arrays.asList(defaultUpdates));
}
/**
@@ -126,7 +125,7 @@ public class UpdateOperation extends ProfileChangeOperation {
* @return an array of all possible updates
*/
public Update[] getPossibleUpdates() {
- ArrayList<Update> all = new ArrayList<Update>();
+ ArrayList<Update> all = new ArrayList<>();
for (List<Update> updates : possibleUpdatesByIU.values())
all.addAll(updates);
return all.toArray(new Update[all.size()]);
@@ -140,7 +139,7 @@ public class UpdateOperation extends ProfileChangeOperation {
} else {
// We must consult the planner
IQueryResult<IInstallableUnit> replacements = session.getPlanner().updatesFor(iu, context, monitor);
- updates = new ArrayList<Update>();
+ updates = new ArrayList<>();
for (Iterator<IInstallableUnit> replacementIterator = replacements.iterator(); replacementIterator.hasNext();) {
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=273967
// In the case of patches, it's possible that a patch is returned as an available update
@@ -158,16 +157,14 @@ public class UpdateOperation extends ProfileChangeOperation {
return updates.toArray(new Update[updates.size()]);
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.p2.operations.ProfileChangeOperation#computeProfileChangeRequest(org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
protected void computeProfileChangeRequest(MultiStatus status, IProgressMonitor monitor) {
// Here we create a profile change request by finding the latest version available for any replacement, unless
// otherwise specified in the selections.
// We have to consider the scenario where the only updates available are patches, in which case the original
// IU should not be removed as part of the update.
- Set<IInstallableUnit> toBeUpdated = new HashSet<IInstallableUnit>();
- HashSet<Update> elementsToPlan = new HashSet<Update>();
+ Set<IInstallableUnit> toBeUpdated = new HashSet<>();
+ HashSet<Update> elementsToPlan = new HashSet<>();
boolean selectionSpecified = defaultUpdates != null;
IProfile profile = session.getProfileRegistry().getProfile(profileId);
if (profile == null)
@@ -192,7 +189,7 @@ public class UpdateOperation extends ProfileChangeOperation {
// Patches are keyed by their id because they are unique and should not be compared to
// each other. Updates are keyed by the IU they are updating so we can compare the
// versions and select the latest one
- HashMap<String, Update> latestVersions = new HashMap<String, Update>();
+ HashMap<String, Update> latestVersions = new HashMap<>();
boolean foundUpdate = false;
boolean foundPatch = false;
for (int j = 0; j < updates.length; j++) {
@@ -212,7 +209,7 @@ public class UpdateOperation extends ProfileChangeOperation {
// If there is a true update available, ignore any patches found
// Patches are keyed by their own id
if (foundPatch && foundUpdate) {
- Set<String> keys = new HashSet<String>();
+ Set<String> keys = new HashSet<>();
keys.addAll(latestVersions.keySet());
for (String id : keys) {
// Get rid of things keyed by a different id. We've already made sure
@@ -237,7 +234,7 @@ public class UpdateOperation extends ProfileChangeOperation {
for (Update update : elementsToPlan) {
IInstallableUnit theUpdate = update.replacement;
if (defaultUpdates == null) {
- defaultUpdates = new ArrayList<Update>();
+ defaultUpdates = new ArrayList<>();
defaultUpdates.add(update);
} else {
if (!defaultUpdates.contains(update))
@@ -255,24 +252,17 @@ public class UpdateOperation extends ProfileChangeOperation {
sub.done();
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.p2.operations.ProfileChangeOperation#getProvisioningJobName()
- */
+ @Override
protected String getProvisioningJobName() {
return Messages.UpdateOperation_UpdateJobName;
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.p2.operations.ProfileChangeOperation#getResolveJobName()
- */
+ @Override
protected String getResolveJobName() {
return Messages.UpdateOperation_ResolveJobName;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.equinox.p2.operations.ProfileChangeOperation#prepareToResolve()
- */
+ @Override
protected void prepareToResolve() {
super.prepareToResolve();
if (iusToUpdate == null) {
@@ -303,9 +293,8 @@ public class UpdateOperation extends ProfileChangeOperation {
* Overridden to delay computation of the profile change request until the resolution
* occurs. This is done because computing the request is expensive (it involves searching
* for updates).
- * (non-Javadoc)
- * @see org.eclipse.equinox.p2.operations.ProfileChangeOperation#makeResolveJob(org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
void makeResolveJob(IProgressMonitor monitor) {
// throw away any previous requests
request = null;
@@ -314,15 +303,13 @@ public class UpdateOperation extends ProfileChangeOperation {
// for the resolution job to get the request from the operation after it has been
// computed.
final ProfileChangeRequest[] requestHolder = new ProfileChangeRequest[1];
- job = new SearchForUpdatesResolutionJob(getResolveJobName(), session, profileId, request, getFirstPassProvisioningContext(), getSecondPassEvaluator(), noChangeRequest, new IRunnableWithProgress() {
- public void run(IProgressMonitor mon) throws OperationCanceledException {
- // We only check for other jobs running if this job is *not* scheduled
- if (job.getState() == Job.NONE && session.hasScheduledOperationsFor(profileId)) {
- noChangeRequest.add(PlanAnalyzer.getStatus(IStatusCodes.OPERATION_ALREADY_IN_PROGRESS, null));
- } else {
- computeProfileChangeRequest(noChangeRequest, mon);
- requestHolder[0] = UpdateOperation.this.request;
- }
+ job = new SearchForUpdatesResolutionJob(getResolveJobName(), session, profileId, request, getFirstPassProvisioningContext(), getSecondPassEvaluator(), noChangeRequest, mon -> {
+ // We only check for other jobs running if this job is *not* scheduled
+ if (job.getState() == Job.NONE && session.hasScheduledOperationsFor(profileId)) {
+ noChangeRequest.add(PlanAnalyzer.getStatus(IStatusCodes.OPERATION_ALREADY_IN_PROGRESS, null));
+ } else {
+ computeProfileChangeRequest(noChangeRequest, mon);
+ requestHolder[0] = UpdateOperation.this.request;
}
}, requestHolder, this);
}
@@ -332,9 +319,8 @@ public class UpdateOperation extends ProfileChangeOperation {
* before we've computed the profile change request, so we must ensure that we
* have already computed the profile change request.
*
- * (non-Javadoc)
- * @see org.eclipse.equinox.p2.operations.ProfileChangeOperation#hasResolved()
*/
+ @Override
public boolean hasResolved() {
return request != null && super.hasResolved();
}

Back to the top