You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

74 lines
3.1 KiB

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