Community
Participate
Working Groups
Build : I20110425-1800 (not a regression for M7) Create a test project with 2 text files linked to another(B linked to A) in a fresh workspace //A.txt test //B.txt test Select 'test' and Search->Text-> Workspace -> Shows 2 entries A & B as matches in Search view 1) A.test-> Replace Selected...-> 'THING' => replaces in both files but highlights only 4 characters in B.text, and also does not update the search view for B.txt match. 2) Now drill down to B#THING in search view and right click , 'Replace Selected...' with 'AAAAAA' The replace happens only for B.txt and when you go to A.txt , it prompts for replacing the text there as well. On clicking OK, the text is replaced but the highlighting is not proper(highlights prev text size) and also search view is not updated by the replace action. 3) Same problem as 2 with Replace All... for both selections (ie even if A->text is selected, only text in B is replaced) I'm guessing the Replace refactoring also does update the search view ( I see that in the preview) and not sure who takes care of the highlighting of the replaced text.
> ... and when you go to A.txt , it prompts for > replacing the text there as well.(In reply to comment #0) That's the expected behavior (assuming you did not save A.txt before).
To complete the support from bug 320533, the ReplaceRefactoring should also - remove the skipped secondary links to matches from the search result - refresh the secondary files in the workspace
A complete fix would be too expensive and would not be local to the replace refactoring but also touch the view updating (search for file matches with same link target). In addition, once the view is involved, 'Undo' becomes problematic as the refactoring doesn't know what the view did. Actually, this is already know an issue when replacing "normal" matches.
Created attachment 194717 [details] Fix The attached patch fixes the case where the selected/all matches to replace contain all the links pointing to the same target. If that's not the case then the view will still be out of sync. This patch also cleans up some code. Relevant part of the changes are in: - ReplaceRefactoring.SearchResultUpdateChange.getMatches() - ReplaceRefactoring.isAlreadyCollected(FileMatch)
Markus, OK for RC1?
+1 for RC1. Released ReplaceRefactoring.java to HEAD with a few minor changes.
Verified for 3.7RC1 with I20110514-0800.