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