RSS

Search Engine

Showing posts with label Eclipse p2 Packaging and Update - Tutorial. Show all posts
Showing posts with label Eclipse p2 Packaging and Update - Tutorial. Show all posts

Wednesday, December 22, 2010

Eclipse plugin updates and installations

1.1. Overview

The Eclipse platform provides an installation and update mechanism called p2. This update mechanism allow to install new Eclipse functionality and to update existing. Eclipse p2 can be integrated into Eclipse RCP applications.

The update and installation of functionality with p2 is based on Eclipse Features Feature simply describe a list of plugins and other features.

1.2. Prerequisites

You should know how to develop Eclipse plugins and Eclipse RCP application. See Eclipse Plugins Development and Eclipse RCP Development for further information.

Create base application

2.1. Create plugin and feature project

Create a Eclipse RCP project "de.vogella.rcp.p2.base" based on the "Eclipse RCP with a view" template. Create a feature project "de.vogella.rcp.p2.base.feature" which includes the plugin "de.vogella.rcp.p2.base".

Add a product configuration called "p2base.product" to your "de.vogella.rcp.p2.base" plugin. Select that this product will be based on "features".

2.2. Adding the p2 UI

The pre-defined p2 UI can be found in the feature "org.eclipse.equinox.p2.user.ui". Add this feature to your product. You also need to make the p2 UI visible in your application. Create a new menu in your application and add the pre-defined commands "org.eclipse.equinox.p2.ui.sdk.update", "org.eclipse.equinox.p2.ui.sdk.install" and "org.eclipse.ui.window.preferences" to the menu. If you start your application you should already seen the menu entries but p2 does not work in an application which is started from the workbench you need to export your product.

Export your product via the "Eclipse Product export wizard" on the overview tab of p2base.product. Make sure to select the "Generate metadata repository" flag on the export dialog.

2.3. Create category

In your feature project create file File -> New -> Other -> "Category Definition" a new category for your feature.

Press "New Category" and create a category, e.g. with the name "vogella.de". Add your feature to this category.

2.4. Export your feature

Export your feature via File -> Export -> "Deployable features". Deploy it to a local directory on your machine. Make sure you select on the Option tab your "category.xml". Also make sure to select "Generate metadata repository".

2.5. Test

Try if this feature can be installed into your Eclipse IDE. See Using the Eclipse Update Manager for information on how to use the Eclipse update manager. Use the update manager and point to your local directory. Restart the IDE after installation. You should have a new command after the installation.

After a restart of your Eclipse IDE you should have an additional menu entry.

Using the Eclipse Update Manager revert this installation.

Create RCP application

Using the "Hello RCP" template create a Eclipse RCP application in plugin "de.vogella.p2.app". Create a feature "de.vogella.p2.app.feature" which includes plugin "de.vogella.p2.app" and "org.eclipse.rcp".

In the plugin "de.vogella.p2.app" create a new product configuration "app.product". The product should be feature based. Export your product and make sure you can start it. Please see Eclipse RCP for details.

Add p2 to your RCP application

Add the feature "org.eclipse.equinox.p2.user.ui" to your product. Adjust your runtime configuration and run your product again. You should see now difference.

The p2 commands attach themself to the menu with the ID "help". Create a menu with the id "help" and re-run your application. See Eclipse Commands Tutorial if you need information on how to define a menu.

If you select the menu you will get an error message.

Export your product then you should be able to open the update manager.

Use the update manager to install your "de.vogella.p2.add.command.feature" feature.

Thursday, November 25, 2010

Eclipse plugin updates and installations

1.1. Overview

The Eclipse platform provides an installation and update mechanism called p2. This update mechanism allow to install new Eclipse functionality and to update existing. Eclipse p2 can be integrated into Eclipse RCP applications.

The update and installation of functionality with p2 is based on Eclipse Features Feature simply describe a list of plugins and other features.

1.2. Prerequisites

You should know how to develop Eclipse plugins and Eclipse RCP application. See Eclipse Plugins Development and Eclipse RCP Development for further information.

Create base application

2.1. Create plugin and feature project

Create a Eclipse RCP project "de.vogella.rcp.p2.base" based on the "Eclipse RCP with a view" template. Create a feature project "de.vogella.rcp.p2.base.feature" which includes the plugin "de.vogella.rcp.p2.base".

Add a product configuration called "p2base.product" to your "de.vogella.rcp.p2.base" plugin. Select that this product will be based on "features".

2.2. Adding the p2 UI

The pre-defined p2 UI can be found in the feature "org.eclipse.equinox.p2.user.ui". Add this feature to your product. You also need to make the p2 UI visible in your application. Create a new menu in your application and add the pre-defined commands "org.eclipse.equinox.p2.ui.sdk.update", "org.eclipse.equinox.p2.ui.sdk.install" and "org.eclipse.ui.window.preferences" to the menu. If you start your application you should already seen the menu entries but p2 does not work in an application which is started from the workbench you need to export your product.

Export your product via the "Eclipse Product export wizard" on the overview tab of p2base.product. Make sure to select the "Generate metadata repository" flag on the export dialog.

2.3. Create category

In your feature project create file File -> New -> Other -> "Category Definition" a new category for your feature.

Press "New Category" and create a category, e.g. with the name "vogella.de". Add your feature to this category.

2.4. Export your feature

Export your feature via File -> Export -> "Deployable features". Deploy it to a local directory on your machine. Make sure you select on the Option tab your "category.xml". Also make sure to select "Generate metadata repository".

2.5. Test

Try if this feature can be installed into your Eclipse IDE. See Using the Eclipse Update Manager for information on how to use the Eclipse update manager. Use the update manager and point to your local directory. Restart the IDE after installation. You should have a new command after the installation.

After a restart of your Eclipse IDE you should have an additional menu entry.

Using the Eclipse Update Manager revert this installation.

Create RCP application

Using the "Hello RCP" template create a Eclipse RCP application in plugin "de.vogella.p2.app". Create a feature "de.vogella.p2.app.feature" which includes plugin "de.vogella.p2.app" and "org.eclipse.rcp".

In the plugin "de.vogella.p2.app" create a new product configuration "app.product". The product should be feature based. Export your product and make sure you can start it. Please see Eclipse RCP for details.

Add p2 to your RCP application

Add the feature "org.eclipse.equinox.p2.user.ui" to your product. Adjust your runtime configuration and run your product again. You should see now difference.

The p2 commands attach themself to the menu with the ID "help". Create a menu with the id "help" and re-run your application. See Eclipse Commands Tutorial if you need information on how to define a menu.

If you select the menu you will get an error message.

Export your product then you should be able to open the update manager.

Use the update manager to install your "de.vogella.p2.add.command.feature" feature.

Thank you

If you like this tutorial please support this website.