Creating an Eclipse RCP Target Platform
Join the DZone community and get the full member experience.Join For Free
the pde team has given rcp developers some great new features in eclipse 3.5. it’s now much easier to create and manage target platforms for eclipse rcp applications. in this post, i’ll outline one simple workflow that should work in most cases.
but first, if you’re interested in what a target platform is or why you might want to create one, check out these previous posts.
so now that you understand why we should create a target platform, what’s the best way to do it?
create a target definition file
eclipse target platforms can be created and selected directly in the target platform preferences page, but a better approach is to define your target platform using a target definition file. a target definition file outlines what should be included in your target platform and where the features and bundles can be located. more importantly, target definition files can be checked in to your version control repository and shared among the members of your team.
so how do we create one? you see here a sample rcp application that
was generated with the hello world template. let’s add a target
definition to this project.
right-click on the project name and select
new > other
. then choose
plug-in development > target definition
in the wizard selection dialog.
the wizard page prompts you to select a file name, and i’m going to choose samplercp.target to match my project name. remember, it’s a good idea to have a separate target platform for each project you work on.
define your target platform
now that we have a target definition file in our project, we can select what to include in our target platform. we do that by identifying one or more locations that may contain features or bundles. eclipse 3.5 supports four types of locations (directories, installations, features, and software sites).
in this workflow, i’ll be using a software site which means that the features and bundles will be downloaded from a repository and stored locally under my workspace .metadata folder.
for an rcp application, we typically want to set our target platform to the eclipse rcp sdk which is made up of two features:
let’s add these features to our target platform. start by clicking
in the target definition editor (this editor should have opened
automatically after you created the target definition file). then
dialog and click
the next page of the wizard is where the real work is done. we’re going to specify a repository location where the eclipse rcp sdk can be retrieved.
- first, select the galileo repository from the work with drop-down.
- next, deselect the group by category checkbox. for some reason, the eclipse rcp sdk does not appear anywhere in the category listing. you would think it would be included under the eclipsert target platform components category, but no such luck.
- finally, place a check next to the eclipse rcp sdk entry in the list and click finish
as soon as you click finish, eclipse pde will start the process of downloading the rcp sdk to your machine. your target definition file should look like this:
activate your new target platform
the final step is to activate your target platform by clicking the set as target platform link in the upper-right corner of the target definition editor. then you’re all set! and make sure to check in your target definition so everyone on your team can share the fruits of your hard work ;-)
Opinions expressed by DZone contributors are their own.