Time for action – creating a target definition

A target definition is a set of features and plug-ins that will be used to build plug-in and feature projects against. The target definition is an XML file that is typically persisted in a project or top-level container that can be shared in a source code repository for other developers to use.

  1. Create a new project by navigating to the File | New | Project… menu and selecting General | Project with the name com.packtpub.e4.target.mars.
  2. Create a new Target Definition by navigating to the File | New | Other… menu and searching for target:
    Time for action – creating a target definition
  3. After clicking on Next choose the com.packtpub.e4.target.mars project to store the target definition, and call it com.packtpub.e4.target.mars. This will allow anyone building the project to use that target platform to build the project. Select the Base RCP (Binary Only) template:
    Time for action – creating a target definition
  4. Open the newly created com.packtpub.e4.target.mars.target file and the target definition editor will be shown:
    Time for action – creating a target definition
  5. Clicking on Set as Target Platform will result in many compile errors, because the Base RCP feature doesn't contain E4 features such as javax.inject.
  6. Change the Target Name to Eclipse Mars and click on Add to add new content.
  7. Choose Features from the dialog, and then select ${eclipse_home} from the dropdown and choose org.eclipse.e4.rcp, org.eclipse.rcp and org.eclipse.platform from the feature list, followed by clicking on Finish:
    Time for action – creating a target definition
  8. Save the edited target file, and click on Set as Target Platform again to refresh the content. Eclipse should re-build the files and have fewer errors than before.

What just happened?

A target platform was created, consisting of the basic RCP features and plug-ins, using both E4 and Eclipse 3.x functionality. The content is based on the running platform, which means that when run in different versions of Eclipse, different versions will be used.

Note

Some of the code created in the earlier chapters uses Eclipse 3.x technology; for example, bundles that depend on org.eclipse.ui have activators and handlers used by the older platform, and often miss out dependencies on org.eclipse.jface or org.eclipse.core.runtime. By removing the org.eclipse.rcp dependency from the target platform, it becomes possible to see where these dependencies are and to remove or upgrade them.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.62.45