/// <summary> /// Initializes a new instance of the <see cref="AceJumpCommand"/> class. /// Adds our command handlers for menu (commands must exist in the command table file) /// </summary> /// <param name="package">Owner package, not null.</param> /// <param name="commandExecutor"></param> /// <param name="viewProvider"></param> private AceJumpCommand(IServiceProvider package, ICommandExecutorService commandExecutor, IViewProvider viewProvider) { if (package == null) { throw new ArgumentNullException(nameof(package)); } if (commandExecutor == null) { throw new ArgumentNullException(nameof(commandExecutor)); } if (viewProvider == null) { throw new ArgumentNullException(nameof(viewProvider)); } this._serviceProvider = package; this.myCommandExecutorService = commandExecutor; myViewProvider = viewProvider; OleMenuCommandService commandService = this._serviceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (commandService != null) { var menuCommandID = new CommandID(CommandSet, CommandId); var menuItem = new MenuCommand(this.MenuItemCallback, menuCommandID); commandService.AddCommand(menuItem); } }
/// <summary> /// Initializes the singleton instance of the command. /// </summary> /// <param name="package">Owner package, not null.</param> /// <param name="commandExecutor">command executor, not null. Needed to turn off VsVim during command execution</param> /// <param name="viewProvider">service to get current view</param> public static void Initialize(IServiceProvider package, ICommandExecutorService commandExecutor, IViewProvider viewProvider) { Instance = new AceJumpCommand(package, commandExecutor, viewProvider); }