Skip to main content

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.

Jump to: navigation, search

Howto: Register Annotation Types

< To: Tigerstripe_APIs

Introduction

A new annotation type is added to the framework using a simple two extension point.

  • Core extension point described general information, like name, description and EMF object.
  • UI extension point provided annotation type icon which will be used in all dialogs, views, etc.

Adding extension

To create new annotation type we need first create EMF class with standard EMF facilities. This EMF class will be used as an annotation type content, i.e. any annotation would be an instance of this EMF class. It can be any EMF class, it need not implement any interface or something else. Annotation type should be contributed with the org.eclipse.tigerstripe.annotation.core.annotationType extension point:

 <extension point="org.eclipse.tigerstripe.annotation.core.annotationType">
    <definition
          id="org.eclipse.tigerstripe.annotation.example.person"
          name="Person"
          description="Personal information, like a full name, e-mail address, telephone number and so on"
          epackage-uri="http:///org/eclipse/tigerstripe/annotation/example/person.ecore"
          eclass="Person">
    </definition>
 </extension>

The attributes are described as follows.

  • id - a unique name that will be used to identify this annotation type
  • name - a human-readable name that will be used in the UI
  • description - an annotation type description
  • epackage-uri - identity of the EMF package contains annotation object
  • eclass - EMF class name from the specified package which will be used as an annotation object

This extension point allow to use org.eclipse.tigerstripe.annotation.example.person.Person EMF class as an annotation.This annotation type would be also added to the Create Annotation Wizard.

Contribute Image to the Annotation Type

An UI extension point (org.eclipse.tigerstripe.annotation.ui.annotationTypeImages) just provide an icon for this annotation type using in the Create Annotation Wizard, Annotations View, etc.

 <extension point="org.eclipse.tigerstripe.annotation.ui.annotationTypeImages">
    <annotationTypeImage
          icon="icons/person.gif"
          typeID="org.eclipse.tigerstripe.annotation.example.person"/>
 </extension>

The attributes are described as following:

  • icon - a relative name of the icon that will be associated with the annotation type
  • typeID - an annotation type identifier

Back to the top