0

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.

2
  • Does Equinox/p2/Adding Self-Update to an RCP Application help you? Maybe you have also a look at the implementation of the p2 director.
    – howlger
    Commented Aug 21, 2017 at 9:47
  • Not too much !! I was even thinking about the fact that it should be possible to force the update of a single plugin by changing its timestamp probably. Looking at this solution if nothing comes out from my first question. Any ideas?
    – Diego T
    Commented Aug 21, 2017 at 15:30

0