Updating Eclipse E4 project fails through p2 [message #1043053] |
Wed, 17 April 2013 07:57 |
Lakhveer Singh Messages: 26 Registered: March 2013 |
Junior Member |
|
|
hello guys,
please help me out here!
i m working on eclipse e4 project. in its menu bar i have added an menu item Update in help menu bar assigned an handler to it which contains the code for checking the update code for application, but when i clicks on the menu item it doesn't responds,
my products configuration is based on plugin.
here is the code of that handler
public class P2UpdateHandler {
private static final String REPOSITORY_LOC = "file:///c:/tmp/repository";
@Execute
public void execute(final IProvisioningAgent agent, final Shell parent,
final UISynchronize sync) {
Job j = new Job("Update Job") {
@Override
protected IStatus run(final IProgressMonitor monitor) {
/* 1. prepare update plumbing */
final ProvisioningSession session = new ProvisioningSession(agent);
final UpdateOperation operation = new UpdateOperation(session);
// create uri
URI uri = null;
try
{
uri = new URI(REPOSITORY_LOC);
}
catch (URISyntaxException e)
{
return Status.CANCEL_STATUS;
}
// set location of artifact and metadata repo
operation.getProvisioningContext().setArtifactRepositories(new URI[] { uri });
operation.getProvisioningContext().setMetadataRepositories(new URI[] { uri });
/* 2. check for updates */
// run update checks causing I/O
final IStatus status = operation.resolveModal(monitor);
// Failed to find updates (inform user and exit)
if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE)
{
sync.syncExec(new Runnable()
{
@Override
public void run()
{
MessageDialog
.openWarning(parent, "No update",
"No updates for the current installation have been found");
}
});
return Status.CANCEL_STATUS;
}
/* 3. install updates (causing I/0!) */
try
{
operation.getProvisioningJob(monitor).schedule();
}
catch(final NullPointerException ex)
{
sync.syncExec(new Runnable()
{
@Override
public void run()
{
System.out.println(ex);
MessageDialog
.openWarning(parent, "Null Pointer",
"null pointer exception");
}
});
}
// Optionally register a job change listener to track
// installation progress and notify user upon success
return Status.OK_STATUS;
}
};
j.schedule();
}
}
i m getting a null pointer exception @ operation.getProvisioningJob(monitor).schedule();
so please help me out here!
thanks in advance
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02841 seconds