Extending Rename Refactoring for Annotation Values support [message #661879] |
Mon, 28 March 2011 11:59 |
Xavier Coulon Messages: 58 Registered: July 2009 |
Member |
|
|
Hello,
I'm working on a plugin in which I'd like to provide support for annotation value renaming.
For example, in a typical JAX-RS resource method, there are usually one @Path and one or more @PathParam annotations whose parameters (in {}) must match, as the example below shows :
@GET
@Path("/{id}")
public Book getProduct(@PathParam("id") Integer id) { ... }
Ideally, when the user triggers the rename refactoring on the 'id' value of the @PathParam annotation, it should also rename the 'id' portion of the @Path annotation above. Even better, this renaming support would also rename the LocalVariable 'id' at the same time ! (well, at least, as a JAX-RS developer, I'd find this pretty nice).
I've started looking at the rename refactoring support in JDT and found some the extension I'd need to use in the LTK plugin : org.eclipse.ltk.core.refactoring.refactoringContributions, and some base class I could extend : JavaUIRefactoringContribution.
Yet, I'm facing a first problem : the renaming support in JDT does not include annotation values, and from what I've seen in the RenameJavaElementAction class, the range of supported elements (IProject, IField, ILocalVariable, etc..) does not seem to be extendable.
I could write my own renaming support besides the JDT ones, but here comes another issue : can I bind the same keys to my own action/command to seemlessly 'extend' the default refactoring support provided by JDT ?
What would be the best way to proceed ? I'd like to extend the current refactoring support and benefit from all the functionnalities, but how ?
Thank you in advance
Regards,
Xavier
|
|
|
Powered by
FUDForum. Page generated in 5.02829 seconds