Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Extending Rename Refactoring for Annotation Values support
Extending Rename Refactoring for Annotation Values support [message #661879] Mon, 28 March 2011 11:59
Xavier Coulon is currently offline Xavier CoulonFriend
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
Previous Topic:add javanature into my own project
Next Topic:API to access .settings
Goto Forum:
  


Current Time: Tue May 07 01:39:19 GMT 2024

Powered by FUDForum. Page generated in 5.02829 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top