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

Difference between revisions of "Howto: Register Annotation Types"

Line 5: Line 5:
  
 
* Core extension point described general information, like name, description and EMF object.
 
* 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.
+
* UI extension point provided annotation type display information which will be used in all dialogs, views, etc.
  
 
=== Adding extension ===
 
=== Adding extension ===
Line 18: Line 18:
 
           epackage-uri="http:///org/eclipse/tigerstripe/annotation/example/person.ecore"
 
           epackage-uri="http:///org/eclipse/tigerstripe/annotation/example/person.ecore"
 
           eclass="Person">
 
           eclass="Person">
 +
        <target
 +
            type="org.eclipse.core.resources.IResource"/>
 
     </definition>
 
     </definition>
 
   </extension>
 
   </extension>
Line 28: Line 30:
 
* epackage-uri - identity of the EMF package contains annotation object
 
* 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
 
* eclass - EMF class name from the specified package which will be used as an annotation object
 +
* target type - target allow to add annotations with the specified type only for specified annotable objects. For example, Person annotation can be attached only to the IResource. If there are no one target defined, annotation of this type can be attached to any annotable objects.
  
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.
+
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 ===
+
=== Display 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.
+
An UI extension point (org.eclipse.tigerstripe.annotation.ui.annotationTypeImages) just provide an JFace label provider for this annotation type using in the Create Annotation Wizard, Annotations View, etc.
  
   <extension point="org.eclipse.tigerstripe.annotation.ui.annotationTypeImages">
+
   <extension point="org.eclipse.tigerstripe.annotation.ui.annotationLabelProvider">
     <annotationTypeImage
+
     <provider
           icon="icons/person.gif"
+
           class="org.eclipse.tigerstripe.annotation.example.person.PersonLabelProvider"
 
           typeID="org.eclipse.tigerstripe.annotation.example.person"/>
 
           typeID="org.eclipse.tigerstripe.annotation.example.person"/>
 
   </extension>
 
   </extension>
Line 43: Line 46:
 
The attributes are described as following:
 
The attributes are described as following:
  
* icon - a relative name of the icon that will be associated with the annotation type
+
* class - ILabelProvider class name that will be used to display this annotation type
 
* typeID - an annotation type identifier
 
* typeID - an annotation type identifier
  
 
[[Category:Tigerstripe_APIs]]
 
[[Category:Tigerstripe_APIs]]

Revision as of 06:55, 27 May 2008

< 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 display information 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">
        <target
            type="org.eclipse.core.resources.IResource"/>
    </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
  • target type - target allow to add annotations with the specified type only for specified annotable objects. For example, Person annotation can be attached only to the IResource. If there are no one target defined, annotation of this type can be attached to any annotable objects.

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.

Display Annotation Type

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

 <extension point="org.eclipse.tigerstripe.annotation.ui.annotationLabelProvider">
    <provider
          class="org.eclipse.tigerstripe.annotation.example.person.PersonLabelProvider"
          typeID="org.eclipse.tigerstripe.annotation.example.person"/>
 </extension>

The attributes are described as following:

  • class - ILabelProvider class name that will be used to display this annotation type
  • typeID - an annotation type identifier

Back to the top