Search code examples
eclipsercpp2

eclipse RCP p2 UpdateOperation ProvisioningJob null


I am trying to implement an RCP project with p2 update. When try to get ProvisioningJob returns null.

final ProvisioningSession session = new ProvisioningSession(agent);
final UpdateOperation operation = new UpdateOperation(session);
configureUpdate(operation);
//some other code
final ProvisioningJob provisioningJob = operation.getProvisioningJob(monitor);

the monitor is a NullProgressMonitor (I've tried to configure another with Dependency Injection, but not work).

Can anyone help me?


Solution

  • The JavaDoc for UpdateOperation says you need to resolve the update before getting the provisioning job:

    UpdateOperation op = new UpdateOperation(session);
    IStatus result = op.resolveModal(monitor);
    if (result.isOK()) {
      op.getProvisioningJob(monitor).schedule();
    }
    

    (not sure exactly what this does as I don't use p2!)