Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 326280

Summary: Rename refactoring for Xtext languages
Product: [Modeling] TMF Reporter: Jan Koehnlein <jan>
Component: XtextAssignee: Jan Koehnlein <jan>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: moritz.eysholdt, sebastian.zarnekow, tmf.xtext-inbox
Version: 2.0.0Flags: jan: indigo+
Target Milestone: M5   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 326220    

Description Jan Koehnlein CLA 2010-09-27 05:09:59 EDT

    
Comment 1 Jan Koehnlein CLA 2010-11-19 04:08:05 EST
Pushed first shot to master.

The steps being taken are roughly:
1) Spot the declaration of the element to be refactored (the target) and get a document for it. We use the document API to apply the changes, as it's considered more robust as models could have syntax errors. If the element is not loaded within an editor we create a new file based document for it. 
2) Determine all elements whose name depends on the targets name. References to these will have to be refactored, too.
3) Find all references to the target and the dependent elements in the index and locally and store their offsets.
4) Apply the change in the document, reparse and retrieve the renamed target. The URI might have been changed by the renaming, so we use its offset to find the element.
5) Iterate the collected references (by document), use the ICrossRefSerializer to calculate the new link texts, create Changes. 
6) Apply these changes.

I also pushed some tests but will now head for more.

Still to be done:
- Currently we expect the declaration and all references to be in the same language. We should try to use RefatoringParticipants to decouple the actions to be taken in models of other languages.
- All model files are currently loaded eagerly which could limit scalability.
- Add more tests.
- Inplace refactoring. Currently we only have a wizard based version.
Comment 2 Moritz Eysholdt CLA 2010-11-22 07:29:45 EST
nice! I'll make sure to ask you for a demo the next days :)
Comment 3 Sebastian Zarnekow CLA 2010-12-15 11:46:03 EST
This one was pushed in M5. We should track refinements in new tickets.
Comment 4 Karsten Thoms CLA 2017-09-19 17:29:47 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 5 Karsten Thoms CLA 2017-09-19 17:41:10 EDT
Closing all bugs that were set to RESOLVED before Neon.0