I would like to update a P2 repository with Eclipse 4 programmatically and I would like to choose plugins to update. Classic way to retrieve the provisioning job which updates the repository is:
ProvisioningSession session = new ProvisioningSession(agent);
UpdateOperation operation = new UpdateOperation(session);
operation.getProvisioningContext().setArtifactRepositories(new URI[] { uri});
operation.getProvisioningContext().setMetadataRepositories(new URI[] { uri});
IStatus status = operation.resolveModal(sub.newChild(100))
ProvisioningJob provisioningJob = operation.getProvisioningJob(monitor);
IStatus st = provisioningJob.runModal(monitor);
The resolveModal method checks plugins to update. If I print the possible updates I will have only the product and not the plugins to update.
Update[] updates = operation.getPossibleUpdates();
Now, how to choose the plugins I would like to updates? The UpdateOperation object constructor allows me to specify a list of Installable Units, but if I exclude only the plugin I do not want, the system equally updates all the repository (because of product which is included in the list of installable units?).
Thank you.