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.
Difference between revisions of "Howto: Register Refactoring Support"
Line 4: | Line 4: | ||
=== Introduction === | === Introduction === | ||
− | + | URI of an annotated objects may be changed during object lifetime. To solve this problem Annotation Framework supports annotated object refactoring. From the Annotation Framework side - refactoring is an operation which change one URI to another. To inform framework about URI changes org.eclipse.tigerstripe.annotation.core.IRefactoringSupport interface with following methods provided: | |
− | * deleted(URI uri) - notify framework about object with | + | |
− | * changed(URI newUri, URI oldUri) - notify framework about object's URI | + | * deleted(URI uri) - notify framework about object with specified URI has been deleted; |
+ | * changed(URI newUri, URI oldUri) - notify framework about object's URI change; | ||
+ | |||
+ | Annotation Manager provides IRefactoringSupport instance as following: | ||
+ | |||
+ | AnnotationPlugin.getManager().getRefactoringSupport(); | ||
=== Examples === | === Examples === | ||
==== Eclipse 3.3 ==== | ==== Eclipse 3.3 ==== | ||
− | + | ||
+ | '''org.eclipse.tigerstripe.annotation.java.ui.refactoring''' plugin support refactoring for JavaElements and Workspace resources. Below is excerpt from plugin code demonstrating calls into TAF notifying URI changes and object deletions. | ||
protected void changed(Map<URI, URI> uris) { | protected void changed(Map<URI, URI> uris) { | ||
Line 18: | Line 24: | ||
AnnotationPlugin.getManager().getRefactoringSupport().changed(uri, uris.get(uri)); | AnnotationPlugin.getManager().getRefactoringSupport().changed(uri, uris.get(uri)); | ||
} | } | ||
+ | |||
public void deleted(ILazyObject object) { | public void deleted(ILazyObject object) { | ||
IResource resource = getResource(object); | IResource resource = getResource(object); | ||
Line 28: | Line 35: | ||
} | } | ||
− | |||
− | |||
− | |||
− | |||
[[Category:Tigerstripe_APIs]] | [[Category:Tigerstripe_APIs]] |
Revision as of 08:23, 3 June 2008
Contents
< To: Tigerstripe_APIs
Introduction
URI of an annotated objects may be changed during object lifetime. To solve this problem Annotation Framework supports annotated object refactoring. From the Annotation Framework side - refactoring is an operation which change one URI to another. To inform framework about URI changes org.eclipse.tigerstripe.annotation.core.IRefactoringSupport interface with following methods provided:
- deleted(URI uri) - notify framework about object with specified URI has been deleted;
- changed(URI newUri, URI oldUri) - notify framework about object's URI change;
Annotation Manager provides IRefactoringSupport instance as following:
AnnotationPlugin.getManager().getRefactoringSupport();
Examples
Eclipse 3.3
org.eclipse.tigerstripe.annotation.java.ui.refactoring plugin support refactoring for JavaElements and Workspace resources. Below is excerpt from plugin code demonstrating calls into TAF notifying URI changes and object deletions.
protected void changed(Map<URI, URI> uris) { for (URI uri : uris.keySet()) //inform annotation framework about changes AnnotationPlugin.getManager().getRefactoringSupport().changed(uri, uris.get(uri)); }
public void deleted(ILazyObject object) { IResource resource = getResource(object); if (resource != null) { URI uri = ResourceURIConverter.toURI(resource); if (uri != null) //inform annotation framework about resource deletion AnnotationPlugin.getManager().getRefactoringSupport().deleted(uri); } }