1 | using System; |
---|
2 | using System.ComponentModel.Design; |
---|
3 | using System.Diagnostics; |
---|
4 | using System.Globalization; |
---|
5 | using System.Runtime.InteropServices; |
---|
6 | using System.Security.Permissions; |
---|
7 | using System.Text; |
---|
8 | using IOleServiceProvider = Microsoft.VisualStudio.OLE.Interop.IServiceProvider; |
---|
9 | using Microsoft.VisualStudio.Shell; |
---|
10 | using Microsoft.VisualStudio.Shell.Interop; |
---|
11 | |
---|
12 | namespace Lol.VisualStudio.Plugin |
---|
13 | { |
---|
14 | [PackageRegistration(UseManagedResourcesOnly = true)] |
---|
15 | |
---|
16 | [ProvideMenuResource(1000, 1)] |
---|
17 | [Guid("f96f7ac5-16ac-4061-8b92-0a02bb455ae9")] |
---|
18 | [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] |
---|
19 | [ComVisible(true)] |
---|
20 | [ProvideAutoLoad("f1536ef8-92ec-443c-9ed7-fdadf150da82")] // This is needed for the package to be autoloaded |
---|
21 | public sealed class PluginPackage : Package |
---|
22 | { |
---|
23 | public PluginPackage() |
---|
24 | { |
---|
25 | Trace.WriteLine(String.Format(CultureInfo.CurrentUICulture, "Entering constructor for: {0}", this.ToString())); |
---|
26 | } |
---|
27 | |
---|
28 | [SecurityPermission(SecurityAction.Demand, Flags=SecurityPermissionFlag.UnmanagedCode)] |
---|
29 | protected override void Initialize() |
---|
30 | { |
---|
31 | // Trace the beginning of this method and call the base implementation. |
---|
32 | Trace.WriteLine(String.Format(CultureInfo.CurrentUICulture, "Entering Initialize() of: {0}", this.ToString())); |
---|
33 | base.Initialize(); |
---|
34 | |
---|
35 | // Ensure the "Build" output pane exists |
---|
36 | IVsOutputWindow outputWindow = GetService(typeof(SVsOutputWindow)) as IVsOutputWindow; |
---|
37 | if (null != outputWindow) |
---|
38 | { |
---|
39 | Guid guidBuild = Microsoft.VisualStudio.VSConstants.OutputWindowPaneGuid.BuildOutputPane_guid; |
---|
40 | outputWindow.CreatePane(guidBuild, "Build", 1, 0); |
---|
41 | } |
---|
42 | |
---|
43 | // Register the "Generate Compilers" context menu |
---|
44 | OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; |
---|
45 | if (null != mcs) |
---|
46 | { |
---|
47 | CommandID id = new CommandID(GuidsList.guidVsLolCmdSet, VsLolIDList.cmdidGenerateCompilers); |
---|
48 | OleMenuCommand command = new MenuGenerateCompilers(new ServiceProvider((IOleServiceProvider)this.GetService(typeof(IOleServiceProvider))), id); |
---|
49 | mcs.AddCommand(command); |
---|
50 | } |
---|
51 | } |
---|
52 | } |
---|
53 | |
---|
54 | internal static class GuidsList |
---|
55 | { |
---|
56 | // Now define the list of guids as public static members. |
---|
57 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] |
---|
58 | public static readonly Guid guidVsLolPkg = new Guid("{f96f7ac5-16ac-4061-8b92-0a02bb455ae9}"); |
---|
59 | |
---|
60 | public static readonly Guid guidVsLolCmdSet = new Guid("{ce508d12-530e-45d0-8b52-1e9ee3f8eaaf}"); |
---|
61 | |
---|
62 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] |
---|
63 | public static readonly Guid guidGearBmp = new Guid("{560dba06-c26b-4731-8229-b816818e5992}"); |
---|
64 | } |
---|
65 | |
---|
66 | internal static class VsLolIDList |
---|
67 | { |
---|
68 | public const int cmdidGenerateCompilers = 0x2001; |
---|
69 | public const int cmdidUnused1 = 0x2002; |
---|
70 | public const int cmdidUnused2 = 0x2003; |
---|
71 | } |
---|
72 | } |
---|
73 | |
---|