Class OperationFactory
java.lang.Object
org.eclipse.equinox.p2.operations.OperationFactory
OperationFactory provides a set of helpers to simplify dealing with the running installation.
Among other things, it simplifies the installation, un-installation and update.
If the system you are trying to modify is not the running one, you need to directly use the various subclass of
ProfileChangeOperation
.- Since:
- 2.1
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateInstallOperation
(Collection<? extends IVersionedId> toInstall, Collection<URI> repos, IProgressMonitor monitor) This factory method creates anInstallOperation
to install all the elements listed from the specified repositories.createSynchronizeOperation
(Collection<? extends IVersionedId> toInstall, Collection<URI> repos, IProgressMonitor monitor) This factory method creates anSynchronizeOperation
that will cause the current installation to exclusively contain the elements listed once executed.createUninstallOperation
(Collection<? extends IVersionedId> toUninstall, Collection<URI> repos, IProgressMonitor monitor) Create anUninstallOperation
that will uninstall the listed elements from the running instance.createUpdateOperation
(Collection<? extends IVersionedId> toUpdate, Collection<URI> repos, IProgressMonitor monitor) Create anUpdateOperation
that will update the elements specified.listInstalledElements
(boolean rootsOnly, IProgressMonitor monitor) Returns theIInstallableUnit
s that are installed in the running instance of Eclipse.
-
Constructor Details
-
OperationFactory
public OperationFactory()
-
-
Method Details
-
createInstallOperation
public InstallOperation createInstallOperation(Collection<? extends IVersionedId> toInstall, Collection<URI> repos, IProgressMonitor monitor) throws ProvisionException This factory method creates anInstallOperation
to install all the elements listed from the specified repositories.- Parameters:
toInstall
- the elements to install. This can not be null.repos
- the repositories to install the elements from. If null is passed, it will use all previously registered repositories.monitor
- the progress monitor- Returns:
- an operation to install
- Throws:
ProvisionException
-
createUninstallOperation
public UninstallOperation createUninstallOperation(Collection<? extends IVersionedId> toUninstall, Collection<URI> repos, IProgressMonitor monitor) throws ProvisionException Create anUninstallOperation
that will uninstall the listed elements from the running instance.- Parameters:
toUninstall
- the elements to uninstall. This can not be null.repos
- the repositories to install the elements from. If null is passed, it will use all previously registered repositories.monitor
- the progress monitor- Returns:
- an operation to uninstall
- Throws:
ProvisionException
-
listInstalledElements
public IQueryResult<IInstallableUnit> listInstalledElements(boolean rootsOnly, IProgressMonitor monitor) Returns theIInstallableUnit
s that are installed in the running instance of Eclipse.- Parameters:
rootsOnly
- set to true to return only the elements that have been explicitly installed (aka roots).monitor
- the progress monitor- Returns:
- the installable units installed, or an empty result if the installation profile of the running system cannot be accessed
-
createUpdateOperation
public UpdateOperation createUpdateOperation(Collection<? extends IVersionedId> toUpdate, Collection<URI> repos, IProgressMonitor monitor) throws ProvisionException Create anUpdateOperation
that will update the elements specified.- Parameters:
toUpdate
- The elements to update.Passing null will result in looking for an update to all the installed. Note that you can pass the results oflistInstalledElements(boolean, IProgressMonitor)
to this method if you wish to update all elements installed in the running instance of eclipse.repos
- the repositories to update the elements from. If null is passed, it will use all previously registered repositories.monitor
- the progress monitor- Returns:
- an instance of
UpdateOperation
- Throws:
ProvisionException
-
createSynchronizeOperation
public SynchronizeOperation createSynchronizeOperation(Collection<? extends IVersionedId> toInstall, Collection<URI> repos, IProgressMonitor monitor) throws ProvisionException This factory method creates anSynchronizeOperation
that will cause the current installation to exclusively contain the elements listed once executed.- Parameters:
toInstall
- the elements to install. This can not be null.repos
- the repositories to install the elements from. If null is passed, it will use all previously registered repositories.monitor
- the progress monitor- Returns:
- an instance of
SynchronizeOperation
. - Throws:
ProvisionException
-