Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tigerstripe-dev] TAF New API Migration Guide

.IAnnotationProvider

1. Annotation adapter factory was removed and it's logic migrated to the IAnnotationProvider:

public interface IAnnotationProvider {
   
    /**
     * Return annotable object by URI
     *
     * @param uri
     * @return annotable object
     */
    public Object getObject(URI uri);
   
    /**
     * Return annotable object URI
     *
     * @return annotable object URI
     */
    public URI getUri(Object object);

}

So, to migrate this version you need to move adapter factory logic to the annotation provider method getUri(Object object). You also needn't use IAnnotable interface as URI container, because this method return URI directly.

2. IAnnotationProvider bound to some java type. For example, JavaProvider bound to the IJavaElement, ResourceProvider bound to the IResource. This type should be declared with the org.eclipse.tigerstripe.annotation.core.annotationProvider extension point in the type field. Human-readable description of this type should be also added with the targetDescription field.

3. Another IAnnotationProvider feature is delegating to other providers. Sometimes, annotations added to the IResource can be also used as annotations added to corresponding IJavaElement. In this case, annotation provider should describe all delegating information using delegate property. For example, JavaAnnotationProvider delegate to the ResourceAnnotationProvider using following declaration:

<provider
    id="org.eclipse.tigerstripe.annotation.java.provider"
    class="org.eclipse.tigerstripe.annotation.java.JavaAnnotationProvider"
    targetDescription="Java Element"
    type="org.eclipse.jdt.core.IJavaElement">
  <delegate type="org.eclipse.core.resources.IResource"/>
</provider>

Annotation Type target

Annotation type target allow to add annotations with the specified type only for specified annotable objects. For example, MimeType annotation can be attached only to the IResource:

  <extension point="org.eclipse.tigerstripe.annotation.core.annotationType">
     <definition
           name="MIME Type"
           ...>
         <target
               type="org.eclipse.core.resources.IResource"/>
     </definition>
  </extension>

If there are no one target defined, annotation of this type can be attached to any annotable objects.

Annotation type images

annotationTypeImages extension point replaced with the annotationLabelProvider extension point. This new extension provide JFace label provider which will be used in the UI to display annotations.

Router

Router API didn't change at all. But most probably router try to get annotated object by annotation with the following code:

    URI uri = annotation.getUri();
    Object annotable = AnnotationPlugin.getManager().getObject(uri);

URI logic completely removed from the IAnnotationManager. So this code should be replaced with the following:

    Object annotable = AnnotationPlugin.getManager().getAnnotatedObject(annotation);

Refactoring support

Refactoring support moved to TAF core. So, old refactoring support extension point:

<extension
    point="org.eclipse.tigerstripe.annotation.ui.workbenchAnnotationProvider">
  <refactoringSupport
      class="org.eclipse.tigerstripe.annotation.java.ui.refactoring.JavaRefactoringSupport"/>
</extension>

should be replaced with the org.eclipse.tigerstripe.annotation.core.refactoringSupport extension point:

<extension
    point="org.eclipse.tigerstripe.annotation.core.refactoringSupport">
  <refactoringSupport
      id="org.eclipse.tigerstripe.annotation.java.refactoring"
      class="org.eclipse.tigerstripe.annotation.java.ui.refactoring.JavaRefactoringSupport"/>
</extension>

--
Best regards,
Yuri Strot

Back to the top