/// <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;
            }
        }
示例#2
0
        /// <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;
            }
        }
 void FindAllButtonClicked(object sender, EventArgs e)
 {
     WritebackOptions();
     if (IsSelectionSearch)
     {
         if (IsTextSelected(selection))
         {
             RunAllInSelection(0);
         }
     }
     else
     {
         using (AsynchronousWaitDialog monitor = AsynchronousWaitDialog.ShowWaitDialog("Search"))
         {
             SearchInFilesManager.FindAll(monitor);
         }
     }
 }
示例#5
0
 void FindAllButtonClicked(object sender, EventArgs e)
 {
     WritebackOptions();
     if (IsSelectionSearch)
     {
         if (selection.IsTextSelected)
         {
             RunAllInSelection(0);
         }
     }
     else
     {
         using (AsynchronousWaitDialog monitor = AsynchronousWaitDialog.ShowWaitDialog("Search", true))
         {
             monitor.Progress = double.NaN;                     // progress not implemented, use indeterminate progress
             SearchInFilesManager.FindAll(monitor);
         }
     }
 }