Updating a RCP application might be different from updating Eclipse IDE. In Eclipse IDE, the update *usually* triggered by the user and he is allowed to select the updates he wants to install and cancel it at any time. But in RCP application, the situation might be different. You might have a requirement that you should be always running the latest version. In this case, the application update need not be triggered by the user, rather it can be triggered automatically during startup (like Gchat) and/or periodically by a job.
To enable such updates, you need to specify the update site in your feature:
In your Application's startup code, add this:
ProgressMonitorDialog dialog = new ProgressMonitorDialog(new Shell(display, SWT.NONE));
dialog.run(false, false, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
UpdateCommand command = new UpdateCommand("in.cypal.studio.wsdlEditor", "false");
command.run(monitor);
}
});
The comman.run() method returns a boolean value indicating whether an update happened or not. Depending on that you can decide whether to proceed normally or to force a restart by returning IApplication.EXIT_RESTART from the start method of your Application.
Feb 4, 2008
How to automatically update my RCP Application?
Subscribe to:
Post Comments (Atom)

3 comments:
Hi,
I would like to automatically update my RCP app with the new p2 provisioning system available with Eclipse 3.4.
Is there a way for doing that ?
Thanks a lot
P2 is backward compatible with the old update site. This should work fine with 3.4 as well
Thanks for your answer.
I know that Update Manager is 3.4 compatible. I've used your snippet code in my RCP 3.4 application and it works fine :-)
However I would prefer use the new p2 system and I wonder if there is a way for using p2 API for doing the same job.
Thanks
Post a Comment