Example #1
0
        public void Initialize()
        {
            const int windowMenuId    = 30009;
            var       menuBarControls = IDE.CommandBars[1].Controls;
            var       beforeIndex     = FindMenuInsertionIndex(menuBarControls, windowMenuId);

            _menu = menuBarControls.Add(MsoControlType.msoControlPopup, Before: beforeIndex, Temporary: true) as CommandBarPopup;

            _menu.Caption = RubberduckUI.RubberduckMenu;

            _testMenu.Initialize(_menu.Controls);
            _codeExplorerMenu.Initialize(_menu);
            _refactorMenu.Initialize(_menu.Controls);
            _todoItemsMenu.Initialize(_menu);
            _codeInspectionsMenu.Initialize(_menu);

            _sourceControl = AddButton(_menu, RubberduckUI.RubberduckMenu_SourceControl, false, OnSourceControlClick);
            _settings      = AddButton(_menu, RubberduckUI.RubberduckMenu_Options, true, OnOptionsClick);
            _about         = AddButton(_menu, RubberduckUI.RubberduckMenu_About, true, OnAboutClick);

            _projectExplorerContextMenu = new ProjectExplorerContextMenu(IDE, _addIn, _parser);
            _projectExplorerContextMenu.Initialize();
            _projectExplorerContextMenu.RunInspections      += codePresenter_RunInspections;
            _projectExplorerContextMenu.FindReferences      += codePresenter_FindAllReferences;
            _projectExplorerContextMenu.FindImplementations += codePresenter_FindAllImplementations;
            _projectExplorerContextMenu.RunAllTests         += CodePresenterRunAllAllTests;
        }
        public void Initialize()
        {
            const int windowMenuId = 30009;
            var menuBarControls = IDE.CommandBars[1].Controls;
            var beforeIndex = FindMenuInsertionIndex(menuBarControls, windowMenuId);
            _menu = menuBarControls.Add(MsoControlType.msoControlPopup, Before: beforeIndex, Temporary: true) as CommandBarPopup;

            _menu.Caption = RubberduckUI.RubberduckMenu;

            _testMenu.Initialize(_menu.Controls);
            _codeExplorerMenu.Initialize(_menu);
            _refactorMenu.Initialize(_menu.Controls);
            _todoItemsMenu.Initialize(_menu);
            _codeInspectionsMenu.Initialize(_menu);

            _sourceControl = AddButton(_menu, RubberduckUI.RubberduckMenu_SourceControl, false, OnSourceControlClick);
            _settings = AddButton(_menu, RubberduckUI.RubberduckMenu_Options, true, OnOptionsClick);
            _about = AddButton(_menu, RubberduckUI.RubberduckMenu_About, true, OnAboutClick);

            _projectExplorerContextMenu = new ProjectExplorerContextMenu(IDE, _addIn, _parser);
            _projectExplorerContextMenu.Initialize();
            _projectExplorerContextMenu.RunInspections += codePresenter_RunInspections;
            _projectExplorerContextMenu.FindReferences += codePresenter_FindAllReferences;
            _projectExplorerContextMenu.FindImplementations += codePresenter_FindAllImplementations;
            _projectExplorerContextMenu.RunAllTests += CodePresenterRunAllAllTests;
        }