mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
- replace in path replaces already processed text in certain cases ( IDEA-141232)
- Show full path in the Dialog in Find/Replace Path (IDEA-138684)
This commit is contained in:
+12
-5
@@ -254,11 +254,11 @@ public class ReplaceInProjectManager {
|
||||
final PsiFile psiFile = elt.getContainingFile();
|
||||
if (!psiFile.isWritable()) continue;
|
||||
|
||||
final VirtualFile virtualFile = psiFile.getVirtualFile();
|
||||
|
||||
Runnable selectOnEditorRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final VirtualFile virtualFile = psiFile.getVirtualFile();
|
||||
|
||||
if (virtualFile != null && ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
|
||||
@Override
|
||||
public Boolean compute() {
|
||||
@@ -274,9 +274,15 @@ public class ReplaceInProjectManager {
|
||||
}
|
||||
};
|
||||
|
||||
String path = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
|
||||
@Override
|
||||
public String compute() {
|
||||
return virtualFile != null ? virtualFile.getPath() : null;
|
||||
}
|
||||
});
|
||||
CommandProcessor.getInstance()
|
||||
.executeCommand(myProject, selectOnEditorRunnable, FindBundle.message("find.replace.select.on.editor.command"), null);
|
||||
String title = FindBundle.message("find.replace.found.usage.title", i + 1, usages.length);
|
||||
String title = FindBundle.message("find.replace.found.usage.title", i + 1, usages.length, path);
|
||||
|
||||
int result;
|
||||
try {
|
||||
@@ -479,7 +485,6 @@ public class ReplaceInProjectManager {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private boolean getStringToReplace(int textOffset,
|
||||
int textEndOffset,
|
||||
Document document, FindModel findModel, Ref<String> stringToReplace)
|
||||
@@ -494,7 +499,9 @@ public class ReplaceInProjectManager {
|
||||
final CharSequence foundString = document.getCharsSequence().subSequence(textOffset, textEndOffset);
|
||||
PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(document);
|
||||
FindResult findResult = findManager.findString(document.getCharsSequence(), textOffset, findModel, file != null ? file.getVirtualFile() : null);
|
||||
if (!findResult.isStringFound()) {
|
||||
if (!findResult.isStringFound() ||
|
||||
// find result should be in needed range
|
||||
!(findResult.getStartOffset() >= textOffset && findResult.getEndOffset() <= textEndOffset) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ find.usage.view.usages.text=occurrences of ''{0}''
|
||||
|
||||
find.replace.occurrences.found.in.read.only.files.status=Occurrences found in read-only files
|
||||
find.replace.select.on.editor.command=Select on Editor
|
||||
find.replace.found.usage.title=Replace Usage {0} of {1} Found
|
||||
find.replace.found.usage.title=Replace Usage {0} of {1} Found - {2}
|
||||
find.replace.command=Replace
|
||||
find.replace.all.action=Replace All
|
||||
find.replace.all.action.description=&Do Replace Al&&l
|
||||
|
||||
Reference in New Issue
Block a user