public class UpdateOperation extends ProfileChangeOperation
IInstallableUnit
s in
a profile.
The following snippet shows how one might use an UpdateOperation to check for updates
to the profile and then install them in the background.
UpdateOperation op = new UpdateOperation(session); IStatus result = op.resolveModal(monitor); if (result.isOK()) { op.getProvisioningJob(monitor).schedule(); }The life cycle of an UpdateOperation is different than that of the other operations. Since assembling the list of possible updates may be costly, clients should not have to create a new update operation if the desired updates to be applied need to change. In this case, the client can set a new set of chosen updates on the update operation and resolve again.
UpdateOperation op = new UpdateOperation(session); IStatus result = op.resolveModal(monitor); if (result.isOK()) { op.getProvisioningJob(monitor).schedule(); } else if (result.getSeverity() == IStatus.ERROR) { Update [] chosenUpdates = letUserPickFrom(op.getPossibleUpdates()); op.setSelectedUpdates(chosenUpdates); IStatus result = op.resolveModal(monitor); }
Modifier and Type | Field and Description |
---|---|
static int |
STATUS_NOTHING_TO_UPDATE
A status code used to indicate that there were no updates found when
looking for updates.
|
Constructor and Description |
---|
UpdateOperation(ProvisioningSession session)
Create an update operation that will update all of the user-visible installable
units in the profile (the profile roots).
|
UpdateOperation(ProvisioningSession session,
Collection<IInstallableUnit> toBeUpdated)
Create an update operation on the specified provisioning session that updates
the specified IInstallableUnits.
|
Modifier and Type | Method and Description |
---|---|
protected void |
computeProfileChangeRequest(MultiStatus status,
IProgressMonitor monitor)
Compute the profile change request for this operation, adding any relevant intermediate status
to the supplied status.
|
Update[] |
getPossibleUpdates()
Get the list of all possible updates.
|
protected String |
getProvisioningJobName()
Return an appropriate name for the provisioning job.
|
protected String |
getResolveJobName()
Return an appropriate name for the resolution job.
|
Update[] |
getSelectedUpdates()
Get the updates that have been selected from the set of available updates.
|
boolean |
hasResolved()
Return a boolean indicating whether the operation has been resolved.
|
protected void |
prepareToResolve()
Perform any processing that must occur just before resolving this operation.
|
void |
setSelectedUpdates(Update[] defaultUpdates)
Set the updates that should be selected from the set of available updates.
|
getProfileChangeRequest, getProfileId, getProvisioningContext, getProvisioningJob, getProvisioningPlan, getResolutionDetails, getResolutionDetails, getResolutionResult, getResolveJob, resolveModal, setProfileId, setProvisioningContext, updateJobProvisioningContexts
public static final int STATUS_NOTHING_TO_UPDATE
public UpdateOperation(ProvisioningSession session, Collection<IInstallableUnit> toBeUpdated)
session
- the session to use for obtaining provisioning servicestoBeUpdated
- the IInstallableUnits to be updated.public UpdateOperation(ProvisioningSession session)
session
- the session providing the provisioning servicespublic void setSelectedUpdates(Update[] defaultUpdates)
defaultUpdates
- the updates that should be chosen from all of the available
updates.public Update[] getSelectedUpdates()
public Update[] getPossibleUpdates()
protected void computeProfileChangeRequest(MultiStatus status, IProgressMonitor monitor)
ProfileChangeOperation
computeProfileChangeRequest
in class ProfileChangeOperation
status
- a multi-status to be used to add relevant status. If a profile change request cannot
be computed for any reason, a status should be added to explain the problem.monitor
- the progress monitor to use for computing the profile change requestprotected String getProvisioningJobName()
ProfileChangeOperation
getProvisioningJobName
in class ProfileChangeOperation
protected String getResolveJobName()
ProfileChangeOperation
getResolveJobName
in class ProfileChangeOperation
protected void prepareToResolve()
ProfileChangeOperation
prepareToResolve
in class ProfileChangeOperation
public boolean hasResolved()
ProfileChangeOperation
false
while resolution is taking place if it is performed
in the background.hasResolved
in class ProfileChangeOperation
true
if the operation has been resolved, false
if it has not resolved.
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.