OLD | NEW |
| (Empty) |
1 // Copyright 2009 The Native Client Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can | |
3 // be found in the LICENSE file. | |
4 using System; | |
5 using System.Diagnostics; | |
6 using System.Globalization; | |
7 using System.Reflection; | |
8 using System.Runtime.InteropServices; | |
9 using Google.MsAd7.BaseImpl; | |
10 using Google.NaClVsx.DebugSupport; | |
11 using Google.NaClVsx.Installation; | |
12 using Google.NaClVsx.ProjectSupport; | |
13 using Microsoft.VisualStudio; | |
14 using Microsoft.VisualStudio.Shell; | |
15 using Microsoft.VisualStudio.Shell.Interop; | |
16 using Microsoft.VisualStudio.Project; | |
17 | |
18 namespace Google.NaClVsx { | |
19 /// <summary> | |
20 /// This is the class that implements the package exposed by this assembly. | |
21 /// | |
22 /// The minimum requirement for a class to be considered a valid package for V
isual Studio | |
23 /// is to implement the IVsPackage interface and register itself with the shel
l. | |
24 /// This package uses the helper classes defined inside the Managed Package Fr
amework (MPF) | |
25 /// to do it: it derives from the Package class that provides the implementati
on of the | |
26 /// IVsPackage interface and uses the registration attributes defined in the f
ramework to | |
27 /// register itself and its components with the shell. | |
28 /// </summary> | |
29 // This attribute tells the registration utility (regpkg.exe) that this class
needs | |
30 // to be registered as package. | |
31 [PackageRegistration(UseManagedResourcesOnly = true)] | |
32 // A Visual Studio component can be registered under different registry roots;
for instance | |
33 // when you debug your package you want to register it in the experimental hiv
e. This | |
34 // attribute specifies the registry root to use if none is provided to regpkg.
exe with | |
35 // the /root switch. | |
36 [DefaultRegistryRoot("Software\\Microsoft\\VisualStudio\\9.0")] | |
37 // This attribute is used to register the informations needed to show the this
package | |
38 // in the Help/About dialog of Visual Studio. | |
39 [InstalledProductRegistration(true, "#110", "#112", "1.0", | |
40 IconResourceID = 400)] | |
41 // In order be loaded inside Visual Studio in a machine that has not the VS SD
K installed, | |
42 // package needs to have a valid load key (it can be requested at | |
43 // http://msdn.microsoft.com/vstudio/extend/). This attributes tells the shell
that this | |
44 // package has a load key embedded in its resources. | |
45 [ProvideLoadKey("Standard", "1.0", "Google Native Client Support", | |
46 "Google, Inc.", 101)] | |
47 [Guid(NaClGuids.kGuidNaClVsxPackagePkgString)] | |
48 [DebugEngineRegistration( | |
49 DebugEngineId = Engine.kId, | |
50 Disassembly = true, | |
51 Name = Engine.kName, | |
52 Attach = true, | |
53 AlwaysLoadLocal = true, | |
54 DebugEngineClsId = Engine.kClsId, | |
55 LoadUnderWow64 = false, | |
56 LoadProgramProviderUnderWow64 = true, | |
57 ProgramProviderClsId = ProgramProvider.kClsId, | |
58 PortSupplierClsIds = NaClPortSupplier.kClsId + ", " + NaClPortSupplier.kCl
sId | |
59 )] | |
60 [PortSupplierRegistration(typeof(NaClPortSupplier), Name = "Native Client")] | |
61 [ProvideProjectFactory( | |
62 typeof(NaClProjectFactory), | |
63 "NaCl", | |
64 "NaCl Project Files (*naclproj);*.naclproj", | |
65 "naclproj", | |
66 "naclproj", | |
67 @"..\..\Templates\Projects", | |
68 LanguageVsTemplate = "NaCl" | |
69 )] | |
70 [ProvideAutoLoad("adfc4e64-0397-11d1-9f4e-00a0c911004f")] | |
71 [ProvideObject(typeof (Engine))] | |
72 [ProvideObject(typeof (ProgramProvider))] | |
73 [ProvideObject(typeof(GeneralProperties))] | |
74 [ProvideObject(typeof(DebugProperties))] | |
75 [ProvideObject(typeof(NaClPortSupplier))] | |
76 [ProvideMSBuildTargets("NaCl_1.0", @"%ProgramFiles%\MSBuild\Google\NaCl\1.0\Na
Cl.Common.targets")] | |
77 public sealed class NaClPackage : ProjectPackage, IVsInstalledProduct | |
78 { | |
79 /// <summary> | |
80 /// Default constructor of the package. | |
81 /// Inside this method you can place any initialization code that does not r
equire | |
82 /// any Visual Studio service because at this point the package object is cr
eated but | |
83 /// not sited yet inside Visual Studio environment. The place to do all the
other | |
84 /// initialization is the Initialize method. | |
85 /// </summary> | |
86 public NaClPackage() { | |
87 Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, | |
88 "Entering constructor for: {0}", | |
89 ToString())); | |
90 } | |
91 | |
92 | |
93 ////////////////////////////////////////////////////////////////////////////
/ | |
94 // Overriden Package Implementation | |
95 | |
96 /// <summary> | |
97 /// Initialization of the package; this method is called right after the pac
kage is sited, so this is the place | |
98 /// where you can put all the initialization code that rely on services prov
ided by VisualStudio. | |
99 /// </summary> | |
100 protected override void Initialize() { | |
101 Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, | |
102 "Entering Initialize() of: {0}", | |
103 ToString())); | |
104 base.Initialize(); | |
105 RegisterProjectFactory(new NaClProjectFactory(this)); | |
106 } | |
107 | |
108 #region Implementation of IVsInstalledProduct | |
109 | |
110 int IVsInstalledProduct.IdBmpSplash(out uint pIdBmp) { | |
111 pIdBmp = 400; | |
112 return VSConstants.S_OK; | |
113 } | |
114 | |
115 int IVsInstalledProduct.OfficialName(out string pbstrName) { | |
116 pbstrName = "Google Native Client Support"; | |
117 return VSConstants.S_OK; | |
118 } | |
119 | |
120 int IVsInstalledProduct.ProductID(out string pbstrPID) { | |
121 pbstrPID = "1.0"; | |
122 return VSConstants.S_OK; | |
123 } | |
124 | |
125 int IVsInstalledProduct.ProductDetails(out string pbstrProductDetails) { | |
126 pbstrProductDetails = "Adds support for Google's Native Client SDK, a runt
ime and toolchain for secure, " | |
127 + "high-performance Web applications. For more information see http://co
de.google.com/p/nativeclient-sdk/"; | |
128 return VSConstants.S_OK; | |
129 } | |
130 | |
131 int IVsInstalledProduct.IdIcoLogoForAboutbox(out uint pIdIco) { | |
132 pIdIco = 400; | |
133 return VSConstants.S_OK; | |
134 } | |
135 | |
136 #endregion | |
137 } | |
138 } | |
OLD | NEW |