Time for action – creating a feature

A feature project is used in Eclipse to create, test, and export features. Features are used to group many plug-ins together into a coherent unit. For example, the JDT feature consists of 25 separate plug-ins. Features are also used in the construction of update sites, which are covered later in this chapter.

  1. Create a feature project by going to File | New | Project... and then selecting Feature Project.
  2. Name the project com.packtpub.e4.feature, which will also be used as the default name for the Feature ID. As with plug-ins, they are named in reverse domain name format, though typically they end with feature to distinguish them from the plug-in that they represent. The version number defaults to 1.0.0.qualifier. The feature name is used for the text name shown to the user when it's installed, and will default to the last segment of the project name:
    Time for action – creating a feature
  3. Click on Next and it will prompt to choose plug-ins. Choose com.packtpub.e4.clock.ui from the list:
    Time for action – creating a feature
  4. Click on Finish to create the feature project.
  5. Double-click on the feature.xml file to open it in an editor, go to the Included Plug-ins tab, and verify that the clock plug-in has been added as part of the feature.
  6. Add more information, such as feature descriptions, copyright notices, and license agreements via the Information tab.

What just happened?

A feature project called com.packtpub.e4.feature was created with a feature.xml file. The information specified in the dialog can be seen in this file and changed later if necessary:

<feature id="com.packtpub.e4.feature"
  label="Feature"
  version="1.0.0.qualifier"
  provider-name="PACKTPUB">
   <plugin id="com.packtpub.e4.clock.ui"
     download-size="0"
     install-size="0"
     version="0.0.0"
     unpack="false"/>
</feature>

The feature id must be globally unique, as this is the identifier Eclipse and P2 will use for installation. The feature version follows the same format as plug-in versions, major.minor.micro.qualifier, where:

  • Increments of major versions indicate backward-incompatible changes
  • Increments of minor versions indicate new functionality with backward compatibility
  • Increments of micro versions indicate no new functionality other than bug fixes

The qualifier can be any textual value. The special keyword qualifier is used by Eclipse to substitute the build number, which if not specified is formed from the date and timestamp.

The plug-in listed here is the one chosen from the wizard. It will default to 0.0.0, but when the feature is published, it will choose the highest version available and then replace the version string for the plug-in.

There may also be other elements in the feature.xml file, such as license, description, and copyright. These are optional, but if present, they will be displayed in the update dialog when installing.

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

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