Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GenerateComment"/> 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 GenerateComment(AsyncPackage package, OleMenuCommandService commandService, DoxygenConfigService configService)
        {
            m_generator = new DoxygenGenerator(configService);

            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);
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="textViewAdapter"></param>
        /// <param name="textView"></param>
        /// <param name="provider"></param>
        /// <param name="dte"></param>
        public DoxygenCompletionCommandHandler(IVsTextView textViewAdapter, IWpfTextView textView, CompletionHandlerProvider provider, DTE dte, DoxygenConfigService configService)
        {
            m_textView      = textView;
            m_provider      = provider;
            m_dte           = dte;
            m_configService = configService;

            // Add the command to the command chain.
            if (textViewAdapter != null &&
                textView != null &&
                textView.TextBuffer != null &&
                textView.TextBuffer.ContentType.TypeName == CppTypeName)
            {
                textViewAdapter.AddCommandFilter(this, out m_nextCommandHandler);
            }

            m_generator = new DoxygenGenerator(m_configService);

            m_configService.Config.ConfigChanged += onDoxygenConfigChanged;
            onDoxygenConfigChanged(this, EventArgs.Empty);
        }