/// <summary> /// action: 0 = find, 1 = mark, 2 = replace /// </summary> void RunAllInSelection(int action) { const IProgressMonitor monitor = null; int startOffset = Math.Min(selection.Offset, selection.EndOffset); int endOffset = Math.Max(selection.Offset, selection.EndOffset); SearchReplaceUtilities.SelectText(textEditor, startOffset, endOffset); SetCaretPosition(textEditor.ActiveTextAreaControl.TextArea, startOffset); try { ignoreSelectionChanges = true; if (action == 0) { SearchInFilesManager.FindAll(startOffset, endOffset - startOffset, monitor); } else if (action == 1) { SearchReplaceManager.MarkAll(startOffset, endOffset - startOffset, monitor); } else if (action == 2) { SearchReplaceManager.ReplaceAll(startOffset, endOffset - startOffset, monitor); } SearchReplaceUtilities.SelectText(textEditor, startOffset, endOffset); } finally { ignoreSelectionChanges = false; } }
/// <summary> /// action: 0 = find, 1 = mark, 2 = replace /// </summary> void RunAllInSelection(int action) { const IProgressMonitor monitor = null; int startOffset = Math.Min(selection.Offset, selection.EndOffset); int endOffset = Math.Max(selection.Offset, selection.EndOffset); textEditor.Select(startOffset, endOffset - startOffset); try { ignoreSelectionChanges = true; if (action == 0) { SearchInFilesManager.FindAll(startOffset, endOffset - startOffset, monitor); } else if (action == 1) { SearchReplaceManager.MarkAll(startOffset, endOffset - startOffset, monitor); } else if (action == 2) { SearchReplaceManager.ReplaceAll(startOffset, endOffset - startOffset, monitor); } textEditor.Select(startOffset, endOffset - startOffset); } finally { ignoreSelectionChanges = false; } }
/// <summary> /// action: 0 = find, 1 = mark, 2 = replace /// </summary> void RunAllInSelection(int action) { const IProgressMonitor monitor = null; int startOffset = Math.Min(selection.Offset, selection.EndOffset); int endOffset = Math.Max(selection.Offset, selection.EndOffset); textEditor.Select(startOffset, endOffset - startOffset); try { ignoreSelectionChanges = true; if (action == 0) { SearchInFilesManager.FindAll(startOffset, endOffset - startOffset, monitor); } else if (action == 1) { SearchReplaceManager.MarkAll(startOffset, endOffset - startOffset, monitor); } else if (action == 2) { // use anchor for endOffset because the replacement might change the text length var anchor = textEditor.Document.CreateAnchor(endOffset); SearchReplaceManager.ReplaceAll(startOffset, endOffset - startOffset, monitor); endOffset = anchor.Offset; } textEditor.Select(startOffset, endOffset - startOffset); } finally { ignoreSelectionChanges = false; } }
private void Button_BookmarkAll_Click(object sender, EventArgs e) { WritebackOptions(); if (IsSelectionSearch) { if (IsTextSelected(selection)) { RunAllInSelection(1); } } else { using (AsynchronousWaitDialog monitor = AsynchronousWaitDialog.ShowWaitDialog("Search", true)) { SearchReplaceManager.MarkAll(monitor); } } }
void BookmarkAllButtonClicked(object sender, EventArgs e) { WritebackOptions(); if (IsSelectionSearch) { if (selection.IsTextSelected) { RunAllInSelection(1); } } else { using (AsynchronousWaitDialog monitor = AsynchronousWaitDialog.ShowWaitDialog("Search", true)) { monitor.Progress = double.NaN; // progress not implemented, use indeterminate progress SearchReplaceManager.MarkAll(monitor); } } }