Bug 254682 - [refactoring] [rename] Renaming not cascadable.
Summary: [refactoring] [rename] Renaming not cascadable.
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4.1   Edit
Hardware: PC Windows XP
: P5 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-08 15:40 EST by Wynne Crisman CLA
Modified: 2008-11-29 14:05 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wynne Crisman CLA 2008-11-08 15:40:21 EST
Build ID: M20080911-1700

Steps To Reproduce:
I have a custom file that generates java source.  When I rename the file I want it to rename the java source also.

1.Create a rename participant which given a file of type X it renames both the X file, and the related java file.
2.Create a file of type X, and a java file (named the same but for the extension and in the same path).
3.Select the X file and rename it.  The rename participant can easily rename X, and can also rename the java source, but cannot take advantage of the built in jdt renaming code since it appears bundled into the RenameTypeProcessor which must have been used to start the rename refactoring.


More information:
It seems like refactoring the RenameTypeProcessor (and other JDT refactoring code) such that it is useable by custom refactorings should solve this problem.  

Another possible solution (perhaps more clean) is to allow adding to the RenameAction (include other actions such as the move?) while performing discovery (calling initialize(Object) on RefactoringParticipant instances).  This solution would appear to be much more flexible.
Comment 1 Dani Megert CLA 2008-11-13 03:28:15 EST
Markus, please comment.
Comment 2 Markus Keller CLA 2008-11-13 07:02:09 EST
Cascaded refactorings are currently not supported by the processor/participant infrastructure. The framework would need to make sure that cascaded refactorings don't end up in loops.

I agree that this would be nice, but it would be a lot of work to implement, and we unfortunately don't have the resources to do this at the moment. The best advice I can give you right now is to do it asynchronously, i.e. schedule a Job in your participant which calls the RenameSupport API to trigger rename of the Java file after X has been renamed.