Showing posts with label Update. Show all posts
Showing posts with label Update. Show all posts

Feb 6, 2008

Feature based configuration of an RCP application

For a RCP application, I started with plugins based product configuration. When I reached a point where I need to provide software updates thru an update site, I needed a feature based product configuration. I thought should be as simple as selecting the features check box and adding the feature. But I spent around two whole days googling and debugging to bring it up and running. I think everyone would have gone thru the phase. I thought I'll write a blog entry on the issues, but I was lazy to draft such a long post. Yesterday Jan Kohnert sent a nice mail on his experience to the news group. Instead of copy-pasting the whole thing here, I present the information with little modifications. Thanks Jan.

  • Open your product file and select features in the Overview tab:


  • In the Configuration tab, click "New Feature...", and create the new feature:

  • In the newly created feature, go to the included features tab and add "org.eclipse.rcp" feature:
  • Go to the plugins tab and add your product's plugins
  • RCP feature has most of the plugins that you would require. However if you use anything other plugins (core.resources, ui.forms, etc), you need to add those plugins to the feature:
At this point you should be successfully running your RCP application. If you are not interesting in providing support for Software Updates for your app, you should be fine with this.

Ideally, even for software updates, this should work fine. However, if you try to create an update site and try running software update, you will be hitting the java.lang.SecurityException: "Invalid signature file digest for Manifest main attributes". To get rid of that, remove the RCP feature from the included features list of your feature and add the plugins in RCP feature to your feature. Thanks to PDE team, copy-pasting works in the plugins tab of Feature Editor :-)



While going thru the update stuff, I realized that the update will not function as expected if we launch it from the IDE (Not sure of why). So I have to export the product and run from the disk, which means I can't debug and step thru the code :-( To know what happens during the update, I start the application with -debug options and add these lines in the .options file:

org.eclipse.update.core/debug=true
org.eclipse.update.core/debug/warning=true
org.eclipse.update.core/debug/parsing=true
org.eclipse.update.core/debug/install=true
org.eclipse.update.core/debug/configuration=true
org.eclipse.update.core/debug/type=true
org.eclipse.update.core/debug/web=true
org.eclipse.update.core/debug/installhandler=true
org.eclipse.update.core/debug/reconciler=true


Click here for more info on the .options

Feb 4, 2008

How to automatically update my RCP Application?

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.