|
|
|
@ -7,6 +7,7 @@
@@ -7,6 +7,7 @@
|
|
|
|
|
|
|
|
|
|
using System; |
|
|
|
|
using System.Collections; |
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
using System.Diagnostics; |
|
|
|
|
|
|
|
|
|
using ICSharpCode.SharpDevelop.Gui; |
|
|
|
@ -89,34 +90,38 @@ namespace SearchAndReplace
@@ -89,34 +90,38 @@ namespace SearchAndReplace
|
|
|
|
|
public static void ReplaceAll() |
|
|
|
|
{ |
|
|
|
|
SetSearchOptions(); |
|
|
|
|
TextEditorControl textArea = null; |
|
|
|
|
if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) { |
|
|
|
|
textArea = ((ITextEditorControlProvider)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).TextEditorControl; |
|
|
|
|
TextEditorControl textArea = ((ITextEditorControlProvider)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).TextEditorControl; |
|
|
|
|
textArea.ActiveTextAreaControl.TextArea.SelectionManager.ClearSelection(); |
|
|
|
|
} |
|
|
|
|
find.Reset(); |
|
|
|
|
find.SearchStrategy.CompilePattern(); |
|
|
|
|
|
|
|
|
|
List<TextEditorControl> textAreas = new List<TextEditorControl>(); |
|
|
|
|
while (true) { |
|
|
|
|
SearchResult result = SearchReplaceManager.find.FindNext(); |
|
|
|
|
|
|
|
|
|
if (result == null) { |
|
|
|
|
|
|
|
|
|
foreach (TextEditorControl textArea in textAreas) { |
|
|
|
|
textArea.EndUpdate(); |
|
|
|
|
textArea.Refresh(); |
|
|
|
|
} |
|
|
|
|
MessageService.ShowMessage("${res:ICSharpCode.TextEditor.Document.SearchReplaceManager.ReplaceAllDone}", "${res:Global.FinishedCaptionText}"); |
|
|
|
|
find.Reset(); |
|
|
|
|
return; |
|
|
|
|
} else { |
|
|
|
|
textArea = OpenTextArea(result.FileName); |
|
|
|
|
TextEditorControl textArea = OpenTextArea(result.FileName); |
|
|
|
|
|
|
|
|
|
if (!textAreas.Contains(textArea)) { |
|
|
|
|
textArea.BeginUpdate(); |
|
|
|
|
textArea.ActiveTextAreaControl.TextArea.SelectionManager.SelectionCollection.Clear(); |
|
|
|
|
textAreas.Add(textArea); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
string transformedPattern = result.TransformReplacePattern(SearchOptions.ReplacePattern); |
|
|
|
|
find.Replace(result.Offset, |
|
|
|
|
result.Length, |
|
|
|
|
transformedPattern); |
|
|
|
|
textArea.EndUpdate(); |
|
|
|
|
textArea.Refresh(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|