Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Howto: Register Refactoring Support

< To: Tigerstripe_APIs

Some of the annotated objects URI can be changed (for example, annotated resource can be moved to another place and it path used for annotation URI will be changed). To solve this problem, Annotation Framework provide a way to listen this changes, named refactoring support. Refactoring Support class can be registered with the following 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>

Provided class need to implements IRefactoringSupport interface (Clients may also extends org.eclipse.tigerstripe.annotation.core.RefactoringSupport class):

 public interface IRefactoringSupport {
     public void addRefactoringListener(IRefactoringListener listener);
     public void removeRefactoringListener(IRefactoringListener listener);
 }

This interface provide a simple way to register and unregister refactoring listeners:

 public interface IRefactoringListener {
     public void containerUpdated();
     public void refactoringPerformed(Map<URI, URI> changes);
 }

containerUpdated() method should be called every time when annotable objects changed independently can we determine how exactly they changed or not.

From the Annotation Framework side - refactoring is an operation which map one URI to another. refactoringPerformed(Map<URI, URI>) should be called every time when some annotable URIs changed to another URIs and pass changes map.

Сomplete example of how refactoring support uses can be found in the org.eclipse.tigerstripe.annotation.java.ui.refactoring plug-in.

Back to the top