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

« back to all changes in this revision

Viewing changes to src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProgressMonitors.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:
61
61
                
62
62
                public IProgressMonitor GetRunProgressMonitor ()
63
63
                {
64
 
                        return GetOutputProgressMonitor (GettextCatalog.GetString ("Application Output"), Stock.RunProgramIcon, true, true);
 
64
                        return GetOutputProgressMonitor ("MonoDevelop.Ide.ApplicationOutput", GettextCatalog.GetString ("Application Output"), Stock.RunProgramIcon, true, true);
 
65
                }
 
66
                
 
67
                public IProgressMonitor GetToolOutputProgressMonitor (bool bringToFront)
 
68
                {
 
69
                        return GetOutputProgressMonitor ("MonoDevelop.Ide.ToolOutput", GettextCatalog.GetString ("Tool Output"), Stock.RunProgramIcon, bringToFront, true);
65
70
                }
66
71
                
67
72
                public IProgressMonitor GetLoadProgressMonitor (bool lockGui)
76
81
                
77
82
                public IConsole CreateConsole (bool closeOnDispose)
78
83
                {
79
 
                        return (IConsole) GetOutputProgressMonitor (GettextCatalog.GetString ("Application Output"), Stock.RunProgramIcon, true, true);
 
84
                        return (IConsole) GetOutputProgressMonitor ("MonoDevelop.Ide.ApplicationOutput", GettextCatalog.GetString ("Application Output"), Stock.RunProgramIcon, true, true);
80
85
                }
81
86
                
82
87
                /******************************/
104
109
                
105
110
                public IProgressMonitor GetOutputProgressMonitor (string title, IconId icon, bool bringToFront, bool allowMonitorReuse)
106
111
                {
107
 
                        Pad pad = CreateMonitorPad (title, icon, bringToFront, allowMonitorReuse, true);
 
112
                        return GetOutputProgressMonitor (null, title, icon, bringToFront, allowMonitorReuse);
 
113
                }
 
114
                
 
115
                public IProgressMonitor GetOutputProgressMonitor (string id, string title, IconId icon, bool bringToFront, bool allowMonitorReuse)
 
116
                {
 
117
                        Pad pad = CreateMonitorPad (id, title, icon, bringToFront, allowMonitorReuse, true);
108
118
                        pad.Visible = true;
109
119
                        return ((DefaultMonitorPad) pad.Content).BeginProgress (title);
110
120
                }
111
121
                
112
 
                Pad CreateMonitorPad (string title, string icon, bool bringToFront, bool allowMonitorReuse, bool show)
 
122
                /// <summary>
 
123
                /// Gets the pad that is showing the output of a progress monitor
 
124
                /// </summary>
 
125
                /// <param name='monitor'>
 
126
                /// The monitor.
 
127
                /// </param>
 
128
                /// <remarks>
 
129
                /// For example, if you have a monitor 'm' created with a call to GetOutputProgressMonitor,
 
130
                /// GetPadForMonitor (m) will return the output pad.
 
131
                /// </remarks>
 
132
                public Pad GetPadForMonitor (IProgressMonitor monitor)
 
133
                {
 
134
                        foreach (Pad pad in outputMonitors) {
 
135
                                DefaultMonitorPad p = (DefaultMonitorPad) pad.Content;
 
136
                                if (p.CurrentMonitor == monitor)
 
137
                                        return pad;
 
138
                        }
 
139
                        return null;
 
140
                }
 
141
                
 
142
                Pad CreateMonitorPad (string id, string title, string icon, bool bringToFront, bool allowMonitorReuse, bool show)
113
143
                {
114
144
                        Pad pad = null;
115
145
                        if (icon == null)
116
146
                                icon = Stock.OutputIcon;
 
147
                        
 
148
                        if (id == null)
 
149
                                id = title;
117
150
 
118
151
                        int instanceCount = -1;
119
152
                        if (allowMonitorReuse) {
122
155
                                        for (int n=0; n<outputMonitors.Count; n++) {
123
156
                                                Pad mpad = (Pad) outputMonitors [n];
124
157
                                                DefaultMonitorPad mon = (DefaultMonitorPad) mpad.Content;
125
 
                                                if (mon.TypeTag == title) {
 
158
                                                if (mon.TypeTag == id) {
126
159
                                                        if (mon.InstanceNum > instanceCount)
127
160
                                                                instanceCount = mon.InstanceNum;
128
161
                                                        if (mon.AllowReuse) {
139
172
                        }
140
173
 
141
174
                        instanceCount++;
142
 
                        DefaultMonitorPad monitorPad = new DefaultMonitorPad (title, icon, instanceCount);
 
175
                        DefaultMonitorPad monitorPad = new DefaultMonitorPad (id, icon, instanceCount);
143
176
                        
144
 
                        string newPadId = "OutputPad-" + title.Replace (' ','_') + "-" + instanceCount;
145
 
                        string basePadId = "OutputPad-" + title.Replace (' ','_') + "-0";
 
177
                        string newPadId = "OutputPad-" + id + "-" + instanceCount;
 
178
                        string basePadId = "OutputPad-" + id + "-0";
146
179
                        
147
180
                        if (instanceCount > 0) {
148
181
                                // Translate the title before adding the count