~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric

« back to all changes in this revision

Viewing changes to src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchProgressMonitor.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2011-06-27 17:03:13 UTC
  • mto: (1.8.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 54.
  • Revision ID: james.westby@ubuntu.com-20110627170313-6cvz3s19x6e9hqe9
ImportĀ upstreamĀ versionĀ 2.5.92+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
27
//
28
28
 
29
 
using System;
 
29
using System;
 
30
using System.Collections.Generic;
30
31
using MonoDevelop.Core;
31
32
using MonoDevelop.Ide.ProgressMonitoring;
32
33
using MonoDevelop.Ide.Gui;
35
36
{
36
37
        class SearchProgressMonitor : BaseProgressMonitor, ISearchProgressMonitor
37
38
        {
38
 
                SearchResultPad outputPad;
39
 
                IProgressMonitor statusMonitor;
40
 
                event EventHandler stopRequested;
41
 
                
 
39
                SearchResultPad outputPad;
 
40
                readonly IProgressMonitor statusMonitor;
 
41
 
42
42
                public SearchProgressMonitor (Pad pad)
43
43
                {
44
44
                        outputPad = (SearchResultPad) pad.Content;
45
 
                        outputPad.AsyncOperation = this.AsyncOperation;
 
45
                        outputPad.AsyncOperation = AsyncOperation;
46
46
                        outputPad.BeginProgress (pad.Title);
47
47
                        statusMonitor = IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor (GettextCatalog.GetString ("Searching..."), Stock.FindIcon, false, true, false, pad);
48
48
                }
70
70
                }
71
71
                
72
72
                [AsyncDispatch]
 
73
                public void ReportResults (IEnumerable<SearchResult> results)
 
74
                {
 
75
                        try {
 
76
                                outputPad.ReportResults (results);
 
77
                        } catch (Exception ex) {
 
78
                                LoggingService.LogError ("Error adding search results.", ex.ToString ());
 
79
                        }
 
80
                }
 
81
                
 
82
                [AsyncDispatch]
73
83
                public void ReportStatus (string resultMessage)
74
84
                {
75
85
                        outputPad.ReportStatus (resultMessage);
101
111
                        base.OnCompleted ();
102
112
                        
103
113
                        outputPad = null;
104
 
                }
105
 
                
106
 
                Exception GetDisposedException ()
 
114
                }
 
115
 
 
116
                static Exception GetDisposedException ()
107
117
                {
108
118
                        return new InvalidOperationException ("Search progress monitor already disposed.");
109
119
                }
110
 
                
111
 
                protected override void OnCancelRequested ()
112
 
                {
113
 
                        base.OnCancelRequested ();
114
 
                        if (stopRequested != null)
115
 
                                stopRequested (this, null);
116
 
                }
117
 
                
 
120
 
118
121
                public override void ReportError (string message, Exception ex)
119
122
                {
120
123
                        base.ReportError (message, ex);