mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-65207 Multiline selection doesn't pop in the search field in the replace/search dialogs
This commit is contained in:
@@ -80,6 +80,20 @@ public class FindUtil {
|
||||
return file != null ? file.getVirtualFile() : null;
|
||||
}
|
||||
|
||||
public static void initStringToFindWithSelection(FindModel findModel, Editor editor) {
|
||||
if (editor != null){
|
||||
String s = editor.getSelectionModel().getSelectedText();
|
||||
if (!StringUtil.isEmpty(s)) {
|
||||
if (!s.contains("\r") && !s.contains("\n")) {
|
||||
findModel.setStringToFind(s);
|
||||
} else {
|
||||
findModel.setStringToFind(StringUtil.escapeToRegexp(s));
|
||||
findModel.setRegularExpressions(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum Direction {
|
||||
UP, DOWN
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.intellij.find.findInProject;
|
||||
import com.intellij.find.FindManager;
|
||||
import com.intellij.find.FindModel;
|
||||
import com.intellij.find.FindSettings;
|
||||
import com.intellij.find.FindUtil;
|
||||
import com.intellij.find.impl.FindInProjectUtil;
|
||||
import com.intellij.find.replaceInProject.ReplaceInProjectManager;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
@@ -27,7 +28,6 @@ import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Factory;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.ui.content.Content;
|
||||
import com.intellij.usageView.UsageInfo;
|
||||
@@ -71,12 +71,8 @@ public class FindInProjectManager {
|
||||
FindInProjectUtil.setDirectoryName(findModel, dataContext);
|
||||
|
||||
Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
|
||||
if (editor != null){
|
||||
String s = editor.getSelectionModel().getSelectedText();
|
||||
if (!StringUtil.isEmpty(s) && !s.contains("\r") && !s.contains("\n")){
|
||||
findModel.setStringToFind(s);
|
||||
}
|
||||
}
|
||||
FindUtil.initStringToFindWithSelection(findModel, editor);
|
||||
|
||||
|
||||
findManager.showFindDialog(findModel, new Runnable() {
|
||||
public void run() {
|
||||
|
||||
+2
-10
@@ -16,10 +16,7 @@
|
||||
|
||||
package com.intellij.find.replaceInProject;
|
||||
|
||||
import com.intellij.find.FindBundle;
|
||||
import com.intellij.find.FindManager;
|
||||
import com.intellij.find.FindModel;
|
||||
import com.intellij.find.FindResult;
|
||||
import com.intellij.find.*;
|
||||
import com.intellij.find.findInProject.FindInProjectManager;
|
||||
import com.intellij.find.impl.FindInProjectUtil;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
@@ -108,12 +105,7 @@ public class ReplaceInProjectManager {
|
||||
FindInProjectUtil.setDirectoryName(findModel, dataContext);
|
||||
|
||||
Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
|
||||
if (editor != null) {
|
||||
String s = editor.getSelectionModel().getSelectedText();
|
||||
if (s != null && !s.contains("\r") && !s.contains("\n")) {
|
||||
findModel.setStringToFind(s);
|
||||
}
|
||||
}
|
||||
FindUtil.initStringToFindWithSelection(findModel, editor);
|
||||
|
||||
findManager.showFindDialog(findModel, new Runnable() {
|
||||
public void run() {
|
||||
|
||||
Reference in New Issue
Block a user