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

Side by Side Diff: obsolete/Microsoft.VisualStudio.Project/SolutionListener.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
13 [CLSCompliant(false)]
14 public abstract class SolutionListener : IVsSolutionEvents3, IVsSolution Events4, IDisposable
15 {
16
17 #region fields
18 private uint eventsCookie;
19 private IVsSolution solution;
20 private IServiceProvider serviceProvider;
21 private bool isDisposed;
22 /// <summary>
23 /// Defines an object that will be a mutex for this object for s ynchronizing thread calls.
24 /// </summary>
25 private static volatile object Mutex = new object();
26 #endregion
27
28 #region ctors
29 protected SolutionListener(IServiceProvider serviceProvider)
30 {
31
32 this.serviceProvider = serviceProvider;
33 this.solution = serviceProvider.GetService(typeof(SVsSol ution)) as IVsSolution;
34
35 Debug.Assert(this.solution != null, "Could not get the I VsSolution object from the services exposed by this project");
36
37 if(this.solution == null)
38 {
39 throw new InvalidOperationException();
40 }
41 }
42 #endregion
43
44 #region properties
45 protected uint EventsCookie
46 {
47 get
48 {
49 return this.eventsCookie;
50 }
51 }
52
53 protected IVsSolution Solution
54 {
55 get
56 {
57 return this.solution;
58 }
59 }
60
61 protected IServiceProvider ServiceProvider
62 {
63 get
64 {
65 return this.serviceProvider;
66 }
67 }
68 #endregion
69
70 #region IVsSolutionEvents3, IVsSolutionEvents2, IVsSolutionEvent s methods
71 public virtual int OnAfterCloseSolution(object reserved)
72 {
73 return VSConstants.E_NOTIMPL;
74 }
75
76 public virtual int OnAfterClosingChildren(IVsHierarchy hierarchy )
77 {
78 return VSConstants.E_NOTIMPL;
79 }
80
81 public virtual int OnAfterLoadProject(IVsHierarchy stubHierarchy , IVsHierarchy realHierarchy)
82 {
83 return VSConstants.E_NOTIMPL;
84 }
85
86 public virtual int OnAfterMergeSolution(object pUnkReserved)
87 {
88 return VSConstants.E_NOTIMPL;
89 }
90
91 public virtual int OnAfterOpenProject(IVsHierarchy hierarchy, in t added)
92 {
93 return VSConstants.E_NOTIMPL;
94 }
95
96 public virtual int OnAfterOpenSolution(object pUnkReserved, int fNewSolution)
97 {
98 return VSConstants.E_NOTIMPL;
99 }
100
101 public virtual int OnAfterOpeningChildren(IVsHierarchy hierarchy )
102 {
103 return VSConstants.E_NOTIMPL;
104 }
105
106 public virtual int OnBeforeCloseProject(IVsHierarchy hierarchy, int removed)
107 {
108 return VSConstants.E_NOTIMPL;
109 }
110
111 public virtual int OnBeforeCloseSolution(object pUnkReserved)
112 {
113 return VSConstants.E_NOTIMPL;
114 }
115
116 public virtual int OnBeforeClosingChildren(IVsHierarchy hierarch y)
117 {
118 return VSConstants.E_NOTIMPL;
119 }
120
121 public virtual int OnBeforeOpeningChildren(IVsHierarchy hierarch y)
122 {
123 return VSConstants.E_NOTIMPL;
124 }
125
126 public virtual int OnBeforeUnloadProject(IVsHierarchy realHierar chy, IVsHierarchy rtubHierarchy)
127 {
128 return VSConstants.E_NOTIMPL;
129 }
130
131 public virtual int OnQueryCloseProject(IVsHierarchy hierarchy, i nt removing, ref int cancel)
132 {
133 return VSConstants.E_NOTIMPL;
134 }
135
136 public virtual int OnQueryCloseSolution(object pUnkReserved, ref int cancel)
137 {
138 return VSConstants.E_NOTIMPL;
139 }
140
141 public virtual int OnQueryUnloadProject(IVsHierarchy pRealHierar chy, ref int cancel)
142 {
143 return VSConstants.E_NOTIMPL;
144 }
145 #endregion
146
147 #region IVsSolutionEvents4 methods
148 public virtual int OnAfterAsynchOpenProject(IVsHierarchy hierarc hy, int added)
149 {
150 return VSConstants.E_NOTIMPL;
151 }
152
153 public virtual int OnAfterChangeProjectParent(IVsHierarchy hiera rchy)
154 {
155 return VSConstants.E_NOTIMPL;
156 }
157
158 public virtual int OnAfterRenameProject(IVsHierarchy hierarchy)
159 {
160 return VSConstants.E_NOTIMPL;
161 }
162
163 /// <summary>
164 /// Fired before a project is moved from one parent to another i n the solution explorer
165 /// </summary>
166 public virtual int OnQueryChangeProjectParent(IVsHierarchy hiera rchy, IVsHierarchy newParentHier, ref int cancel)
167 {
168 return VSConstants.E_NOTIMPL;
169 }
170 #endregion
171
172 #region Dispose
173
174 /// <summary>
175 /// The IDispose interface Dispose method for disposing the obje ct determinastically.
176 /// </summary>
177 public void Dispose()
178 {
179 this.Dispose(true);
180 GC.SuppressFinalize(this);
181 }
182
183 #endregion
184
185 #region methods
186 public void Init()
187 {
188 if(this.solution != null)
189 {
190 ErrorHandler.ThrowOnFailure(this.solution.Advise SolutionEvents(this, out this.eventsCookie));
191 }
192 }
193
194 /// <summary>
195 /// The method that does the cleanup.
196 /// </summary>
197 /// <param name="disposing"></param>
198 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usag e", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.VisualStudio.Shell .Interop.IVsSolution.UnadviseSolutionEvents(System.UInt32)")]
199 protected virtual void Dispose(bool disposing)
200 {
201 // Everybody can go here.
202 if(!this.isDisposed)
203 {
204 // Synchronize calls to the Dispose simultenious ly.
205 lock(Mutex)
206 {
207 if(disposing && this.eventsCookie != (ui nt)ShellConstants.VSCOOKIE_NIL && this.solution != null)
208 {
209 this.solution.UnadviseSolutionEv ents((uint)this.eventsCookie);
210 this.eventsCookie = (uint)ShellC onstants.VSCOOKIE_NIL;
211 }
212
213 this.isDisposed = true;
214 }
215 }
216 }
217 #endregion
218 }
219 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698