Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Side by Side Diff: obsolete/Microsoft.VisualStudio.Project/UpdateSolutionEventsListener.cs

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /// Copyright (c) Microsoft Corporation. All rights reserved.
2
3 using System;
4 using System.Diagnostics;
5 using Microsoft.VisualStudio;
6 using Microsoft.VisualStudio.Shell.Interop;
7 using IServiceProvider = System.IServiceProvider;
8 using ShellConstants = Microsoft.VisualStudio.Shell.Interop.Constants;
9
10 namespace Microsoft.VisualStudio.Project
11 {
12 /// <summary>
13 /// Defines an abstract class implementing IVsUpdateSolutionEvents inter faces.
14 /// </summary>
15 [CLSCompliant(false)]
16 public abstract class UpdateSolutionEventsListener : IVsUpdateSolutionEv ents3, IVsUpdateSolutionEvents2, IDisposable
17 {
18 #region fields
19 /// <summary>
20 /// The cookie associated to the the events based IVsUpdateSolut ionEvents2.
21 /// </summary>
22 private uint solutionEvents2Cookie;
23
24 /// <summary>
25 /// The cookie associated to the theIVsUpdateSolutionEvents3 eve nts.
26 /// </summary>
27 private uint solutionEvents3Cookie;
28
29 /// <summary>
30 /// The IVsSolutionBuildManager2 object controlling the update s olution events.
31 /// </summary>
32 private IVsSolutionBuildManager2 solutionBuildManager;
33
34
35 /// <summary>
36 /// The associated service provider.
37 /// </summary>
38 private IServiceProvider serviceProvider;
39
40 /// <summary>
41 /// Flag determining if the object has been disposed.
42 /// </summary>
43 private bool isDisposed;
44
45 /// <summary>
46 /// Defines an object that will be a mutex for this object for s ynchronizing thread calls.
47 /// </summary>
48 private static volatile object Mutex = new object();
49 #endregion
50
51 #region ctors
52 /// <summary>
53 /// Overloaded constructor.
54 /// </summary>
55 /// <param name="serviceProvider">A service provider.</param>
56 protected UpdateSolutionEventsListener(IServiceProvider serviceP rovider)
57 {
58 if(serviceProvider == null)
59 {
60 throw new ArgumentNullException("serviceProvider ");
61 }
62
63 this.serviceProvider = serviceProvider;
64
65 this.solutionBuildManager = this.serviceProvider.GetServ ice(typeof(SVsSolutionBuildManager)) as IVsSolutionBuildManager2;
66
67 if(this.solutionBuildManager == null)
68 {
69 throw new InvalidOperationException();
70 }
71
72 ErrorHandler.ThrowOnFailure(this.solutionBuildManager.Ad viseUpdateSolutionEvents(this, out this.solutionEvents2Cookie));
73
74 Debug.Assert(this.solutionBuildManager is IVsSolutionBui ldManager3, "The solution build manager object implementing IVsSolutionBuildMana ger2 does not implement IVsSolutionBuildManager3");
75 ErrorHandler.ThrowOnFailure(this.SolutionBuildManager3.A dviseUpdateSolutionEvents3(this, out this.solutionEvents3Cookie));
76 }
77 #endregion
78
79 #region properties
80
81 /// <summary>
82 /// The associated service provider.
83 /// </summary>
84 protected IServiceProvider ServiceProvider
85 {
86 get
87 {
88 return this.serviceProvider;
89 }
90 }
91
92 /// <summary>
93 /// The solution build manager object controlling the solution e vents.
94 /// </summary>
95 protected IVsSolutionBuildManager2 SolutionBuildManager2
96 {
97 get
98 {
99 return this.solutionBuildManager;
100 }
101 }
102
103 /// <summary>
104 /// The solution build manager object controlling the solution e vents.
105 /// </summary>
106 protected IVsSolutionBuildManager3 SolutionBuildManager3
107 {
108 get
109 {
110 return (IVsSolutionBuildManager3)this.solutionBu ildManager;
111 }
112
113 }
114 #endregion
115
116 #region IVsUpdateSolutionEvents3 Members
117
118 /// <summary>
119 /// Fired after the active solution config is changed (pOldActiv eSlnCfg can be NULL).
120 /// </summary>
121 /// <param name="oldActiveSlnCfg">Old configuration.</param>
122 /// <param name="newActiveSlnCfg">New configuration.</param>
123 /// <returns>If the method succeeds, it returns S_OK. If it fail s, it returns an error code.</returns>
124 public virtual int OnAfterActiveSolutionCfgChange(IVsCfg oldActi veSlnCfg, IVsCfg newActiveSlnCfg)
125 {
126 return VSConstants.E_NOTIMPL;
127 }
128
129 /// <summary>
130 /// Fired before the active solution config is changed (pOldActi veSlnCfg can be NULL
131 /// </summary>
132 /// <param name="oldActiveSlnCfg">Old configuration.</param>
133 /// <param name="newActiveSlnCfg">New configuration.</param>
134 /// <returns>If the method succeeds, it returns S_OK. If it fail s, it returns an error code.</returns>
135 public virtual int OnBeforeActiveSolutionCfgChange(IVsCfg oldAct iveSlnCfg, IVsCfg newActiveSlnCfg)
136 {
137 return VSConstants.E_NOTIMPL;
138 }
139
140 #endregion
141
142 #region IVsUpdateSolutionEvents2 Members
143
144 /// <summary>
145 /// Called when the active project configuration for a project i n the solution has changed.
146 /// </summary>
147 /// <param name="hierarchy">The project whose configuration has changed.</param>
148 /// <returns>If the method succeeds, it returns S_OK. If it fail s, it returns an error code.</returns>
149 public virtual int OnActiveProjectCfgChange(IVsHierarchy hierarc hy)
150 {
151 return VSConstants.E_NOTIMPL;
152 }
153
154 /// <summary>
155 /// Called right before a project configuration begins to build.
156 /// </summary>
157 /// <param name="hierarchy">The project that is to be build.</pa ram>
158 /// <param name="configProject">A configuration project object.< /param>
159 /// <param name="configSolution">A configuration solution object .</param>
160 /// <param name="action">The action taken.</param>
161 /// <param name="cancel">A flag indicating cancel.</param>
162 /// <returns>If the method succeeds, it returns S_OK. If it fail s, it returns an error code.</returns>
163 /// <remarks>The values for the action are defined in the enum _ SLNUPDACTION env\msenv\core\slnupd2.h</remarks>
164 public int UpdateProjectCfg_Begin(IVsHierarchy hierarchy, IVsCfg configProject, IVsCfg configSolution, uint action, ref int cancel)
165 {
166 return VSConstants.E_NOTIMPL;
167 }
168
169 /// <summary>
170 /// Called right after a project configuration is finished build ing.
171 /// </summary>
172 /// <param name="hierarchy">The project that has finished buildi ng.</param>
173 /// <param name="configProject">A configuration project object.< /param>
174 /// <param name="configSolution">A configuration solution object .</param>
175 /// <param name="action">The action taken.</param>
176 /// <param name="success">Flag indicating success.</param>
177 /// <param name="cancel">Flag indicating cancel.</param>
178 /// <returns>If the method succeeds, it returns S_OK. If it fail s, it returns an error code.</returns>
179 /// <remarks>The values for the action are defined in the enum _ SLNUPDACTION env\msenv\core\slnupd2.h</remarks>
180 public virtual int UpdateProjectCfg_Done(IVsHierarchy hierarchy, IVsCfg configProject, IVsCfg configSolution, uint action, int success, int canc el)
181 {
182 return VSConstants.E_NOTIMPL;
183 }
184
185 /// <summary>
186 /// Called before any build actions have begun. This is the last chance to cancel the build before any building begins.
187 /// </summary>
188 /// <param name="cancelUpdate">Flag indicating cancel update.</p aram>
189 /// <returns>If the method succeeds, it returns S_OK. If it fail s, it returns an error code.</returns>
190 public virtual int UpdateSolution_Begin(ref int cancelUpdate)
191 {
192 return VSConstants.E_NOTIMPL;
193 }
194
195 /// <summary>
196 /// Called when a build is being cancelled.
197 /// </summary>
198 /// <returns>If the method succeeds, it returns S_OK. If it fail s, it returns an error code.</returns>
199 public virtual int UpdateSolution_Cancel()
200 {
201 return VSConstants.E_NOTIMPL;
202 }
203
204 /// <summary>
205 /// Called when a build is completed.
206 /// </summary>
207 /// <param name="succeeded">true if no update actions failed.</p aram>
208 /// <param name="modified">true if any update action succeeded.< /param>
209 /// <param name="cancelCommand">true if update actions were canc eled.</param>
210 /// <returns>If the method succeeds, it returns S_OK. If it fail s, it returns an error code.</returns>
211 public virtual int UpdateSolution_Done(int fSucceeded, int fModi fied, int fCancelCommand)
212 {
213 return VSConstants.E_NOTIMPL;
214 }
215
216 /// <summary>
217 /// Called before the first project configuration is about to be built.
218 /// </summary>
219 /// <param name="cancelUpdate">A flag indicating cancel update.< /param>
220 /// <returns>If the method succeeds, it returns S_OK. If it fail s, it returns an error code.</returns>
221 public virtual int UpdateSolution_StartUpdate(ref int cancelUpda te)
222 {
223 return VSConstants.E_NOTIMPL;
224 }
225
226 #endregion
227
228
229 #region IDisposable Members
230
231 /// <summary>
232 /// The IDispose interface Dispose method for disposing the obje ct determinastically.
233 /// </summary>
234 public void Dispose()
235 {
236 this.Dispose(true);
237 GC.SuppressFinalize(this);
238 }
239
240 #endregion
241
242 #region methods
243 /// <summary>
244 /// The method that does the cleanup.
245 /// </summary>
246 /// <param name="disposing">true if called from IDispose.Dispose ; false if called from Finalizer.</param>
247 protected virtual void Dispose(bool disposing)
248 {
249 // Everybody can go here.
250 if(!this.isDisposed)
251 {
252 // Synchronize calls to the Dispose simultanious ly.
253 lock(Mutex)
254 {
255 if(this.solutionEvents2Cookie != (uint)S hellConstants.VSCOOKIE_NIL)
256 {
257 ErrorHandler.ThrowOnFailure(this .solutionBuildManager.UnadviseUpdateSolutionEvents(this.solutionEvents2Cookie));
258 this.solutionEvents2Cookie = (ui nt)ShellConstants.VSCOOKIE_NIL;
259 }
260
261 if(this.solutionEvents3Cookie != (uint)S hellConstants.VSCOOKIE_NIL)
262 {
263 ErrorHandler.ThrowOnFailure(this .SolutionBuildManager3.UnadviseUpdateSolutionEvents3(this.solutionEvents3Cookie) );
264 this.solutionEvents3Cookie = (ui nt)ShellConstants.VSCOOKIE_NIL;
265 }
266
267 this.isDisposed = true;
268 }
269 }
270 }
271 #endregion
272 }
273 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698