Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Equinox/p2/Adding Self-Update to an RCP Application"
(→Helpful Links) |
|||
Line 1: | Line 1: | ||
This page consolidates information about how to add p2 self-updating support to your RCP application. | This page consolidates information about how to add p2 self-updating support to your RCP application. | ||
+ | |||
+ | == Configuring the update UI == | ||
+ | There are several different levels of integration with the p2 UI, depending on what kind of support you want to surface to your users. | ||
+ | |||
+ | === Reusing the Eclipse SDK UI in its entirety === | ||
+ | If your goal is to use the same UI used in the SDK inside your RCP app, you'll want to include the following bundles in your application: | ||
+ | * org.eclipse.equinox.p2.ui | ||
+ | * org.eclipse.equinox.p2.ui.sdk | ||
+ | * org.eclipse.equinox.p2.ui.sdk.scheduler | ||
+ | |||
+ | === Reusing the Eclipse SDK UI without automatic updating === | ||
+ | If you want the user to be able to install new software and manually update the application, you'll want to include only these ui bundles: | ||
+ | * org.eclipse.equinox.p2.ui | ||
+ | * org.eclipse.equinox.p2.ui.sdk | ||
+ | |||
+ | === Modifying the UI entry points === | ||
+ | Suppose you want to include the ability to install and update software, but you don't want this to appear in the Help menu of your application. Or suppose you want to be able to install software, but not update it. Or conversely, you want to be able to update software, but not add new software. | ||
+ | |||
+ | First, you'll need to include the p2 UI class library bundle. | ||
+ | * org.eclipse.equinox.p2.ui | ||
+ | |||
+ | If you want the user to be able to use automatic updating, using the same UI used in the SDK (pref page, popup, etc.), then you can include this bundle: | ||
+ | * org.eclipse.equinox.p2.ui.sdk.scheduler | ||
+ | |||
+ | Now, you need to replace 'org.eclipse.equinox.p2.ui.sdk' with a bundle of your own that contributes whatever functionality is needed. Use the sdk bundle as a model. Things you need to think about: | ||
+ | * Your bundle will need to configure a default instance of org.eclipse.equinox.p2.ui.policy.Policy. This can be done by simply setting the policy as appropriate for your application, or by exposing some of the policy decisions to the user in a preference page. See ProvSDKUIActivator.initializePolicy() for an example of how this is done. | ||
+ | * If you are exposing user preferences, and you are including the SDK's automatic update support (and pref page), then you might want the automatic update preferences to appear underneath your RCP 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 automatic update pref 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 new bundle and simply revise the menu contributions as you wish. Or you can choose invoke the UI in a completely different way. | ||
== Helpful Links == | == Helpful Links == |
Revision as of 20:23, 13 November 2008
This page consolidates information about how to add p2 self-updating support to your RCP application.
Contents
Configuring the update UI
There are several different levels of integration with the p2 UI, depending on what kind of support you want to surface to your users.
Reusing the Eclipse SDK UI in its entirety
If your goal is to use the same UI used in the SDK inside your RCP app, you'll want to include the following bundles in your application:
- org.eclipse.equinox.p2.ui
- org.eclipse.equinox.p2.ui.sdk
- org.eclipse.equinox.p2.ui.sdk.scheduler
Reusing the Eclipse SDK UI without automatic updating
If you want the user to be able to install new software and manually update the application, you'll want to include only these ui bundles:
- org.eclipse.equinox.p2.ui
- org.eclipse.equinox.p2.ui.sdk
Modifying the UI entry points
Suppose you want to include the ability to install and update software, but you don't want this to appear in the Help menu of your application. Or suppose you want to be able to install software, but not update it. Or conversely, you want to be able to update software, but not add new software.
First, you'll need to include the p2 UI class library bundle.
- org.eclipse.equinox.p2.ui
If you want the user to be able to use automatic updating, using the same UI used in the SDK (pref page, popup, etc.), then you can include this bundle:
- org.eclipse.equinox.p2.ui.sdk.scheduler
Now, you need to replace 'org.eclipse.equinox.p2.ui.sdk' with a bundle of your own that contributes whatever functionality is needed. Use the sdk bundle as a model. Things you need to think about:
- Your bundle will need to configure a default instance of org.eclipse.equinox.p2.ui.policy.Policy. This can be done by simply setting the policy as appropriate for your application, or by exposing some of the policy decisions to the user in a preference page. See ProvSDKUIActivator.initializePolicy() for an example of how this is done.
- If you are exposing user preferences, and you are including the SDK's automatic update support (and pref page), then you might want the automatic update preferences to appear underneath your RCP 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 automatic update pref 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 new bundle and simply revise the menu contributions as you wish. Or you can choose invoke the UI in a completely different way.
Helpful Links
- http://toedter.com/blog/?p=27 Kai Toedter's blog post about adding p2 support to an RCP app