|
|
|
@ -22,22 +22,22 @@ namespace SearchAndReplace
@@ -22,22 +22,22 @@ namespace SearchAndReplace
|
|
|
|
|
{ |
|
|
|
|
public static SearchAndReplaceDialog SearchAndReplaceDialog = null; |
|
|
|
|
|
|
|
|
|
static Search find = new Search(); |
|
|
|
|
static Search find = new Search(); |
|
|
|
|
|
|
|
|
|
static SearchReplaceManager() |
|
|
|
|
{ |
|
|
|
|
find.TextIteratorBuilder = new ForwardTextIteratorBuilder(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void SetSearchOptions() |
|
|
|
|
static void SetSearchOptions(IProgressMonitor monitor) |
|
|
|
|
{ |
|
|
|
|
find.SearchStrategy = SearchReplaceUtilities.CreateSearchStrategy(SearchOptions.SearchStrategyType); |
|
|
|
|
find.DocumentIterator = SearchReplaceUtilities.CreateDocumentIterator(SearchOptions.DocumentIteratorType); |
|
|
|
|
find.DocumentIterator = SearchReplaceUtilities.CreateDocumentIterator(SearchOptions.DocumentIteratorType, monitor); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void Replace(IProgressMonitor monitor) |
|
|
|
|
{ |
|
|
|
|
SetSearchOptions(); |
|
|
|
|
SetSearchOptions(monitor); |
|
|
|
|
if (lastResult != null && WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) { |
|
|
|
|
ITextEditorControlProvider provider = WorkbenchSingleton.Workbench.ActiveViewContent as ITextEditorControlProvider; |
|
|
|
|
if (provider != null) { |
|
|
|
@ -66,7 +66,7 @@ namespace SearchAndReplace
@@ -66,7 +66,7 @@ namespace SearchAndReplace
|
|
|
|
|
|
|
|
|
|
public static void ReplaceFirstInSelection(int offset, int length, IProgressMonitor monitor) |
|
|
|
|
{ |
|
|
|
|
SetSearchOptions(); |
|
|
|
|
SetSearchOptions(monitor); |
|
|
|
|
FindFirstInSelection(offset, length, monitor); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -100,7 +100,7 @@ namespace SearchAndReplace
@@ -100,7 +100,7 @@ namespace SearchAndReplace
|
|
|
|
|
|
|
|
|
|
public static void MarkAll(IProgressMonitor monitor) |
|
|
|
|
{ |
|
|
|
|
SetSearchOptions(); |
|
|
|
|
SetSearchOptions(monitor); |
|
|
|
|
ClearSelection(); |
|
|
|
|
find.Reset(); |
|
|
|
|
if (!find.SearchStrategy.CompilePattern(monitor)) |
|
|
|
@ -125,7 +125,7 @@ namespace SearchAndReplace
@@ -125,7 +125,7 @@ namespace SearchAndReplace
|
|
|
|
|
|
|
|
|
|
public static void MarkAll(int offset, int length, IProgressMonitor monitor) |
|
|
|
|
{ |
|
|
|
|
SetSearchOptions(); |
|
|
|
|
SetSearchOptions(monitor); |
|
|
|
|
find.Reset(); |
|
|
|
|
|
|
|
|
|
if (!find.SearchStrategy.CompilePattern(monitor)) |
|
|
|
@ -189,7 +189,7 @@ namespace SearchAndReplace
@@ -189,7 +189,7 @@ namespace SearchAndReplace
|
|
|
|
|
|
|
|
|
|
public static void ReplaceAll(IProgressMonitor monitor) |
|
|
|
|
{ |
|
|
|
|
SetSearchOptions(); |
|
|
|
|
SetSearchOptions(monitor); |
|
|
|
|
ClearSelection(); |
|
|
|
|
find.Reset(); |
|
|
|
|
if (!find.SearchStrategy.CompilePattern(monitor)) |
|
|
|
@ -237,7 +237,7 @@ namespace SearchAndReplace
@@ -237,7 +237,7 @@ namespace SearchAndReplace
|
|
|
|
|
|
|
|
|
|
public static void ReplaceAll(int offset, int length, IProgressMonitor monitor) |
|
|
|
|
{ |
|
|
|
|
SetSearchOptions(); |
|
|
|
|
SetSearchOptions(monitor); |
|
|
|
|
find.Reset(); |
|
|
|
|
|
|
|
|
|
if (!find.SearchStrategy.CompilePattern(monitor)) |
|
|
|
@ -268,7 +268,7 @@ namespace SearchAndReplace
@@ -268,7 +268,7 @@ namespace SearchAndReplace
|
|
|
|
|
|
|
|
|
|
public static void FindNext(IProgressMonitor monitor) |
|
|
|
|
{ |
|
|
|
|
SetSearchOptions(); |
|
|
|
|
SetSearchOptions(monitor); |
|
|
|
|
if (find == null || |
|
|
|
|
SearchOptions.FindPattern == null || |
|
|
|
|
SearchOptions.FindPattern.Length == 0) { |
|
|
|
@ -312,7 +312,7 @@ namespace SearchAndReplace
@@ -312,7 +312,7 @@ namespace SearchAndReplace
|
|
|
|
|
{ |
|
|
|
|
foundAtLeastOneItem = false; |
|
|
|
|
textSelection = null; |
|
|
|
|
SetSearchOptions(); |
|
|
|
|
SetSearchOptions(monitor); |
|
|
|
|
|
|
|
|
|
if (find == null || |
|
|
|
|
SearchOptions.FindPattern == null || |
|
|
|
|