/// <summary>
 /// Initializes the singleton instance of the command.
 /// </summary>
 /// <param name="package">Owner package, not null.</param>
 /// <param name="commandService">The command service.</param>
 public static void Initialize(Shell.AsyncPackage package, Shell.OleMenuCommandService commandService)
 {
     if (Interlocked.CompareExchange(ref _isCommandInitialized, value: INITIALIZED, comparand: NOT_INITIALIZED) == NOT_INITIALIZED)
     {
         Instance = new SuppressDiagnosticInSuppressionFileCommand(package, commandService);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes the singleton instance of the command. Internal method shich should be called only from UI thread.
 /// </summary>
 /// <param name="package">Owner package, not null.</param>
 /// <param name="oleCommandService">The OLE command service.</param>
 /// <returns/>
 internal static void Initialize(Shell.AsyncPackage package, Shell.OleMenuCommandService oleCommandService)
 {
     if (Interlocked.CompareExchange(ref _isCommandInitialized, value: INITIALIZED, comparand: NOT_INITIALIZED) == NOT_INITIALIZED)
     {
         Instance = new GoToDeclarationOrHandlerCommand(package, oleCommandService);
     }
 }
Exemplo n.º 3
0
        public static async Task InitializeAsync(Shell.AsyncPackage package)
        {
            await Shell.ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);

            Shell.OleMenuCommandService commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as Shell.OleMenuCommandService;

            Instance = new OpenT4EditorSettingsCommand(package, commandService);
        }
Exemplo n.º 4
0
        private OpenT4EditorSettingsCommand(Shell.AsyncPackage package, Shell.OleMenuCommandService commandService)
        {
            this.package   = package ?? throw new ArgumentNullException(nameof(package));
            commandService = commandService ?? throw new ArgumentNullException(nameof(commandService));

            var menuCommandID = new CommandID(CommandSet, CommandId);
            var menuItem      = new MenuCommand(this.Execute, menuCommandID);

            commandService.AddCommand(menuItem);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Initializes the singleton instance of the command.
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        public static async Task InitializeAsync(Microsoft.VisualStudio.Shell.AsyncPackage package)
        {
            // Switch to the main thread - the call to AddCommand in MenuContext's constructor requires
            // the UI thread.
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);

            OleMenuCommandService commandService = await package.GetServiceAsync((typeof(IMenuCommandService))) as OleMenuCommandService;

            Instance = new MenuContext(package, commandService);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MenuContext"/> 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="commandService">Command service to add command to, not null.</param>
        private MenuContext(Microsoft.VisualStudio.Shell.AsyncPackage package, OleMenuCommandService commandService)
        {
            this.package   = package ?? throw new ArgumentNullException(nameof(package));
            commandService = commandService ?? throw new ArgumentNullException(nameof(commandService));

            var menuCommandID = new CommandID(CommandSet, CommandId);
            var menuItem      = new MenuCommand(this.Execute, menuCommandID);

            commandService.AddCommand(menuItem);
            _workSpace = WorkSpace.Instance;
        }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GoToDeclarationOrHandlerCommand"/> 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="commandService">The command service.</param>
 private GoToDeclarationOrHandlerCommand(Shell.AsyncPackage package, Shell.OleMenuCommandService commandService) :
     base(package, commandService, GoToDeclarationCommandId)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SuppressDiagnosticInSuppressionFileCommand"/> class.
 /// Adds our command handlers for menu (commands must exist in the command table file)
 /// </summary>
 /// <param name="package">Owner package, not null.</param>
 private SuppressDiagnosticInSuppressionFileCommand(Shell.AsyncPackage package, Shell.OleMenuCommandService commandService) :
     base(package, commandService, SuppressDiagnosticInSuppressionFileId)
 {
 }
Exemplo n.º 9
0
 protected SuppressDiagnosticCommandBase(Shell.AsyncPackage package, Shell.OleMenuCommandService commandService, int commandID) :
     base(package, commandService, commandID)
 {
 }