diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2014-01-20 19:32:53 +0400 |
---|---|---|
committer | Lluis Sanchez Gual <lluis@xamarin.com> | 2014-10-21 18:39:14 +0400 |
commit | f73b2a9990495587d514aa1856919c21170a3940 (patch) | |
tree | 9842411ee8644ead5915a715ee7e53984a601df4 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchProgressMonitor.cs | |
parent | a2046b6331a271e8203df7d3d0f14500d33d60fa (diff) |
Initial drop of the new project model
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchProgressMonitor.cs')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchProgressMonitor.cs | 97 |
1 files changed, 25 insertions, 72 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchProgressMonitor.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchProgressMonitor.cs index 4923f53fd3..d695fc29fa 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchProgressMonitor.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchProgressMonitor.cs @@ -34,55 +34,52 @@ using MonoDevelop.Ide.Gui; namespace MonoDevelop.Ide.FindInFiles { - class SearchProgressMonitor : BaseProgressMonitor, ISearchProgressMonitor + public class SearchProgressMonitor : ProgressMonitor, ISearchProgressMonitor { SearchResultPad outputPad;
- readonly IProgressMonitor statusMonitor;
- public SearchProgressMonitor (Pad pad) + public SearchProgressMonitor (Pad pad): base (Runtime.MainSynchronizationContext) { + AddSlaveMonitor (IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor (GettextCatalog.GetString ("Searching..."), Stock.StatusSearch, false, true, false, pad)); + outputPad = (SearchResultPad) pad.Content; - outputPad.AsyncOperation = AsyncOperation; + outputPad.CancellationTokenSource = CancellationTokenSource; outputPad.BeginProgress (pad.Title); - statusMonitor = IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor (GettextCatalog.GetString ("Searching..."), Stock.StatusSearch, false, true, false, pad); - } - - [FreeDispatch] - public bool AllowReuse { - get { return outputPad.AllowReuse; } } - [FreeDispatch] public void SetBasePath (string path) { outputPad.BasePath = path; } - [AsyncDispatch] public void ReportResult (SearchResult result) { - try { - outputPad.ReportResult (result); - } catch (Exception ex) { - LoggingService.LogError ("Error adding search result for file {0}:{1} to result pad:\n{2}", - result.FileName, result.Offset, ex.ToString ()); - } + DispatchService.GuiDispatch (delegate { + try { + outputPad.ReportResult (result); + } catch (Exception ex) { + LoggingService.LogError ("Error adding search result for file {0}:{1} to result pad:\n{2}", + result.FileName, result.Offset, ex.ToString ()); + } + }); } - [AsyncDispatch] public void ReportResults (IEnumerable<SearchResult> results) { - try { - outputPad.ReportResults (results); - } catch (Exception ex) { - LoggingService.LogError ("Error adding search results.", ex.ToString ()); - } + DispatchService.GuiDispatch (delegate { + try { + outputPad.ReportResults (results); + } catch (Exception ex) { + LoggingService.LogError ("Error adding search results.", ex.ToString ()); + } + }); } - [AsyncDispatch] public void ReportStatus (string resultMessage) { - outputPad.ReportStatus (resultMessage); + DispatchService.GuiDispatch (delegate { + outputPad.ReportStatus (resultMessage); + }); } protected override void OnWriteLog (string text) @@ -93,8 +90,6 @@ namespace MonoDevelop.Ide.FindInFiles protected override void OnCompleted () { - statusMonitor.Dispose (); - if (outputPad == null) throw GetDisposedException (); outputPad.WriteText ("\n"); @@ -104,8 +99,8 @@ namespace MonoDevelop.Ide.FindInFiles foreach (string msg in Warnings) outputPad.WriteText (msg + "\n"); - foreach (string msg in Errors) - outputPad.WriteText (msg + "\n"); + foreach (var msg in Errors) + outputPad.WriteText (msg.Message + "\n"); outputPad.EndProgress (); base.OnCompleted (); @@ -117,47 +112,5 @@ namespace MonoDevelop.Ide.FindInFiles { return new InvalidOperationException ("Search progress monitor already disposed."); } - - public override void ReportError (string message, Exception ex) - { - base.ReportError (message, ex); - statusMonitor.ReportError (message, ex); - } - - public override void ReportSuccess (string message) - { - base.ReportSuccess (message); - statusMonitor.ReportSuccess (message); - } - - public override void ReportWarning (string message) - { - base.ReportWarning (message); - statusMonitor.ReportWarning (message); - } - - public override void Step (int work) - { - base.Step (work); - statusMonitor.Step (work); - } - - public override void BeginStepTask (string name, int totalWork, int stepSize) - { - base.BeginStepTask (name, totalWork, stepSize); - statusMonitor.BeginStepTask (name, totalWork, stepSize); - } - - public override void BeginTask (string name, int totalWork) - { - base.BeginTask (name, totalWork); - statusMonitor.BeginTask (name, totalWork); - } - - public override void EndTask () - { - base.EndTask (); - statusMonitor.EndTask (); - } } }
\ No newline at end of file |