Browse Source

SD2-833. The currently active view is checked to see if it implements the ITextEditorControlProvider interface before attempting to clear the selection when bookmarking all found search results.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1443 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 20 years ago
parent
commit
5a58e676fe
  1. 25
      src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Engine/SearchReplaceManager.cs

25
src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Engine/SearchReplaceManager.cs

@ -102,11 +102,7 @@ namespace SearchAndReplace
public static void MarkAll() public static void MarkAll()
{ {
SetSearchOptions(); SetSearchOptions();
TextEditorControl textArea = null; ClearSelection();
if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
textArea = ((ITextEditorControlProvider)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).TextEditorControl;
textArea.ActiveTextAreaControl.TextArea.SelectionManager.ClearSelection();
}
find.Reset(); find.Reset();
if (!find.SearchStrategy.CompilePattern()) if (!find.SearchStrategy.CompilePattern())
return; return;
@ -190,12 +186,7 @@ namespace SearchAndReplace
public static void ReplaceAll() public static void ReplaceAll()
{ {
SetSearchOptions(); SetSearchOptions();
if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) { ClearSelection();
ITextEditorControlProvider provider = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent as ITextEditorControlProvider;
if (provider != null) {
provider.TextEditorControl.ActiveTextAreaControl.TextArea.SelectionManager.ClearSelection();
}
}
find.Reset(); find.Reset();
if (!find.SearchStrategy.CompilePattern()) if (!find.SearchStrategy.CompilePattern())
return; return;
@ -285,7 +276,7 @@ namespace SearchAndReplace
return; return;
} }
TextEditorControl textArea = null;; TextEditorControl textArea = null;
while (textArea == null) { while (textArea == null) {
SearchResult result = find.FindNext(); SearchResult result = find.FindNext();
if (result == null) { if (result == null) {
@ -387,5 +378,15 @@ namespace SearchAndReplace
} }
return null; return null;
} }
static void ClearSelection()
{
if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
ITextEditorControlProvider provider = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent as ITextEditorControlProvider;
if (provider != null) {
provider.TextEditorControl.ActiveTextAreaControl.TextArea.SelectionManager.ClearSelection();
}
}
}
} }
} }

Loading…
Cancel
Save