[Monodevelop-patches-list] r994 - in trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor: Commands Gui/Dialogs
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Sun Feb 22 22:04:36 EST 2004
Author: tberman
Date: 2004-02-22 22:04:36 -0500 (Sun, 22 Feb 2004)
New Revision: 994
Modified:
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/SearchCommands.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Dialogs/ReplaceInFilesDialog.cs
Log:
pick up selected text as default search patterns, closes #54732
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/SearchCommands.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/SearchCommands.cs 2004-02-23 02:50:08 UTC (rev 993)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/SearchCommands.cs 2004-02-23 03:04:36 UTC (rev 994)
@@ -54,16 +54,15 @@
{
public static void SetSearchPattern()
{
-// // Get Highlighted value and set it to FindDialog.searchPattern
-// IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
-//
-// if (window != null && (window.ViewContent is ITextEditorControlProvider)) {
-// TextAreaControl textarea = ((ITextEditorControlProvider)window.ViewContent).TextAreaControl;
-// string selectedText = textarea.Document.SelectedText;
-// if (selectedText != null && selectedText.Length > 0) {
-// SearchReplaceManager.SearchOptions.SearchPattern = selectedText;
-// }
-// }
+ IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
+
+ if (window != null && window.ViewContent is SourceEditorDisplayBindingWrapper)
+ {
+ SourceEditor editor = (SourceEditor) ((SourceEditorDisplayBindingWrapper)window.ViewContent).Control;
+ string selectedText = editor.Buffer.GetSelectedText ();
+ if (selectedText != null && selectedText.Length > 0)
+ SearchReplaceManager.SearchOptions.SearchPattern = selectedText;
+ }
}
public override void Run()
@@ -120,17 +119,16 @@
{
public static void SetSearchPattern()
{
-// // Get Highlighted value and set it to FindDialog.searchPattern
-// IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
-//
-// if (window != null && (window.ViewContent is ITextEditorControlProvider)) {
-// TextAreaControl textarea = ((ITextEditorControlProvider)window.ViewContent).TextAreaControl;
-// string selectedText = textarea.Document.SelectedText;
-// if (selectedText != null && selectedText.Length > 0) {
-// SearchReplaceInFilesManager.SearchOptions.SearchPattern = selectedText;
-// }
-// }
+ IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
+ if (window != null && window.ViewContent is SourceEditorDisplayBindingWrapper)
+ {
+ SourceEditor editor = (SourceEditor) ((SourceEditorDisplayBindingWrapper)window.ViewContent).Control;
+ string selectedText = editor.Buffer.GetSelectedText ();
+ if (selectedText != null && selectedText.Length > 0)
+ SearchReplaceInFilesManager.SearchOptions.SearchPattern = selectedText;
+ }
}
+
public override void Run()
{
SetSearchPattern();
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Dialogs/ReplaceInFilesDialog.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Dialogs/ReplaceInFilesDialog.cs 2004-02-23 02:50:08 UTC (rev 993)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Dialogs/ReplaceInFilesDialog.cs 2004-02-23 03:04:36 UTC (rev 994)
@@ -233,8 +233,11 @@
browseButton.Clicked += new EventHandler(BrowseDirectoryEvent);
findButton.Clicked += new EventHandler(FindEvent);
+ searchPatternComboBox.Entry.Text = SearchReplaceInFilesManager.SearchOptions.SearchPattern;
+
if (replaceMode) {
replaceAllButton.Clicked += new EventHandler(ReplaceEvent);
+ replacePatternComboBox.Entry.Text = SearchReplaceInFilesManager.SearchOptions.ReplacePattern;
}
ReplaceDialogPointer.Close += new EventHandler (CloseDialogEvent);
More information about the Monodevelop-patches-list
mailing list