Reusing parts of the UI

You may reuse the p2 UI in its entirety, or you may pick and choose which aspects of the UI you want to include in your application.

Reusing the Eclipse SDK UI in its entirety

If your goal is to simply use the same update UI used in the SDK inside your RCP app, very few modifications are required. You'll need to include the org.eclipse.equinox.p2.user.ui feature in your application. This will add the following UI bundles to your application (in addition to all of the p2 core and other required bundles):

The contributions made in the org.eclipse.equinox.p2.ui.sdk assume that the application has defined a Help menu and an additions group for adding menu contributions.

A sample RCP Mail application which shows this kind of reuse can be found in CVS.

Example RCP Application with p2 UI

Reusing the Eclipse SDK UI without automatic updating

If you want to use the SDK UI, but do not wish to add automatic update support, the application is modified as above. However, the following bundles can be eliminated from the product:

A sample RCP Mail application which shows how to do this can also be found in CVS.

Modifying the UI contributions

If you want to include p2 update functionality in the UI, but you don't want these items to appear in exactly the same way as they do in the SDK, you can provide your own bundle that makes p2 UI contributions in lieu of the SDK bundle. This allows you to simply rearrange the way users encounter the install/update functionality, or provide more precise control of what can be done by the user. For example, you may wish to expose a subset of functionality, such as permitting updating, but not allowing the user to uninstall, install, or revert configurations.

The general approach for this kind of reuse is as follows:

Use the org.eclipse.equinox.p2.ui.sdk bundle as a model when determining which contributions to make. For example, if you are exposing user preferences, and you are including the SDK's automatic update support (and pref page), then you probably want the automatic update preferences to appear underneath your application's update preferences. If so, then you'll want to use the same preference page ID as used by org.eclipse.equinox.p2.ui.sdk so that the automatic update preference page contribution falls underneath it.

The IHandler classes in org.eclipse.equinox.p2.ui.sdk invoke the update and install function. If you are simply rearranging the menus in your application, you can copy these handler classes and command contributions to your bundle and revise the menu contributions as you wish. Or you can invoke the UI in a completely different way.

The org.eclipse.ui.about.installationPages contributions made by the SDK UI provide access to update functionality. Consider replacing or modifying the installation page contributions if some of the actions are not relevant.