~ubuntu-branches/ubuntu/natty/monodevelop/natty

« back to all changes in this revision

Viewing changes to src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/OutputProgressMonitor.cs

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Ebner
  • Date: 2008-03-29 23:36:33 UTC
  • mto: (1.5.1 sid)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: james.westby@ubuntu.com-20080329233633-l550uuwvfh1e68at
Tags: upstream-1.0+dfsg
ImportĀ upstreamĀ versionĀ 1.0+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
using System.CodeDom.Compiler;
32
32
using System.IO;
33
33
using System.Diagnostics;
 
34
using System.Text;
34
35
 
35
36
using MonoDevelop.Core;
 
37
using MonoDevelop.Core.ProgressMonitoring;
36
38
using MonoDevelop.Core.Gui;
37
39
using MonoDevelop.Ide.Gui.Pads;
38
40
using MonoDevelop.Core.Execution;
43
45
 
44
46
namespace MonoDevelop.Ide.Gui
45
47
{       
46
 
        internal class OutputProgressMonitor : BaseProgressMonitor, IConsole
 
48
        internal class OutputProgressMonitor : NullProgressMonitor, IConsole
47
49
        {
48
50
                DefaultMonitorPad outputPad;
49
51
                event EventHandler stopRequested;
50
52
                
 
53
                LogTextWriter logger = new LogTextWriter ();
 
54
                
51
55
                public OutputProgressMonitor (DefaultMonitorPad pad, string title, string icon)
52
56
                {
53
57
                        pad.AsyncOperation = this.AsyncOperation;
54
58
                        outputPad = pad;
55
59
                        outputPad.BeginProgress (title);
 
60
                        logger.TextWritten += outputPad.WriteText;
56
61
                }
57
62
                
58
 
                [AsyncDispatch]
59
63
                public override void BeginTask (string name, int totalWork)
60
64
                {
61
65
                        if (outputPad == null) throw GetDisposedException ();
63
67
                        base.BeginTask (name, totalWork);
64
68
                }
65
69
                
66
 
                [AsyncDispatch]
67
70
                public override void EndTask ()
68
71
                {
69
72
                        if (outputPad == null) throw GetDisposedException ();
71
74
                        base.EndTask ();
72
75
                }
73
76
                
74
 
                protected override void OnWriteLog (string text)
75
 
                {
76
 
                        if (outputPad == null) throw GetDisposedException ();
77
 
                        outputPad.WriteText (text);
78
 
                }
79
 
                
80
77
                protected override void OnCompleted ()
81
78
                {
82
79
                        if (outputPad == null) throw GetDisposedException ();
83
80
                        outputPad.WriteText ("\n");
84
81
                        
85
 
                        foreach (string msg in SuccessMessages)
 
82
                        foreach (string msg in Messages)
86
83
                                outputPad.WriteText (msg + "\n");
87
84
                        
88
85
                        foreach (string msg in Warnings)
89
86
                                outputPad.WriteText (msg + "\n");
90
87
                        
91
 
                        foreach (string msg in Errors)
92
 
                                outputPad.WriteError (msg + "\n");
 
88
                        foreach (ProgressError msg in Errors)
 
89
                                outputPad.WriteError (msg.Message + "\n");
93
90
                        
94
91
                        outputPad.EndProgress ();
95
92
                        base.OnCompleted ();
109
106
                                stopRequested (this, null);
110
107
                }
111
108
                
 
109
                public override TextWriter Log {
 
110
                        get { return logger; }
 
111
                }
 
112
                
112
113
                TextReader IConsole.In {
113
114
                        get { return new StringReader (""); }
114
115
                }
115
116
                
116
117
                TextWriter IConsole.Out {
117
 
                        get { return Log; }
 
118
                        get { return logger; }
118
119
                }
119
120
                
120
121
                TextWriter IConsole.Error {
121
 
                        get { return Log; }
122
 
                }
 
122
                        get { return logger; }
 
123
                } 
123
124
                
124
125
                bool IConsole.CloseOnDispose {
125
126
                        get { return false; }