/// <summary> /// Registers new tool window. /// </summary> void IMenuCustomizator.AddToolWindow(string parentMenuName, MenuCommand menuCommand, bool beginGroup, int itemIndex, string afterItemCaption) { IMenuCreator menuCreator = manager.MenuCreator; if (menuCreator.IsSetupUI) { if (!string.IsNullOrEmpty(parentMenuName)) { CommandBar menu = menuCreator.GetMainMenuCommandBar(parentMenuName); menuCreator.AddButton(menu, menuCommand, false, itemIndex, afterItemCaption); } // add only icon on the toolbar: if (tytanToolbar != null) { CommandBarButton b = menuCreator.AddButton(tytanToolbar, menuCommand, beginGroup, 1); b.Style = MsoButtonStyle.msoButtonIcon; } } }
/// <summary> /// Registers new tool window as an auxiliary item. /// </summary> public void AddAuxToolWindow(string parentMenuName, MenuCommand menuCommand, bool beginGroup, int itemIndex, string afterItemCaption) { IMenuCreator menuCreator = manager.MenuCreator; if (menuCreator.IsSetupUI) { if (!string.IsNullOrEmpty(parentMenuName)) { CommandBar menu = menuCreator.GetMainMenuCommandBar(parentMenuName); menuCreator.AddButton(menu, menuCommand, false, itemIndex, afterItemCaption); } // add icons with text on the toolbar: if (tytanAuxTools != null) { CommandBarButton b = menuCreator.AddButton(tytanAuxTools.CommandBar, menuCommand, beginGroup, 1); b.Style = MsoButtonStyle.msoButtonIconAndCaption; tytanAuxTools.BeginGroup = false; } } }
/// <summary> /// Registers new refactoring method. /// </summary> void IMenuCustomizator.AddRefactoring(MenuCommand menuCommand, bool beginGroup, int itemIndex, string afterItemCaption) { IMenuCreator menuCreator = manager.MenuCreator; if (menuCreator.IsSetupUI && tytanRefactors != null) { foreach (CommandBar r in refactors) { menuCreator.AddButton(r, menuCommand, beginGroup, itemIndex, afterItemCaption); } } }
/// <summary> /// Registers new item inside 'About' popup. /// </summary> public void AddAboutItem(MenuCommand menuCommand, bool beginGroup, int itemIndex, string afterItemCaption) { IMenuCreator menuCreator = manager.MenuCreator; if (menuCreator.IsSetupUI) { if (aboutItems == null) { aboutItems = menuCreator.AddPopup(tytanToolbar, AboutMenu, null, true, -1); } menuCreator.AddButton(aboutItems.CommandBar, menuCommand, beginGroup, itemIndex, afterItemCaption); } }
/// <summary> /// Registers new popup menu for Reference-Project group. /// </summary> public void AddReferenceProject(MenuCommand menuCommand, bool beginGroup, int itemIndex, params string[] afterItemCaption) { if (referenceProjects != null) { try { IMenuCreator menuCreator = manager.MenuCreator; foreach (CommandBarPopup vsPopup in referenceProjects) { menuCreator.AddButton(vsPopup.CommandBar, menuCommand, beginGroup, itemIndex, afterItemCaption); } } catch (Exception ex) { Trace.WriteLine(ex.Message); } } }
/// <summary> /// Registers new item for solution-explorer. /// </summary> public void AddSolutionExplorerItem(MenuCommand menuCommand, bool alsoMdiMenu, bool beginGroup, int itemIndex, params string[] afterItemCaption) { IMenuCreator menuCreator = manager.MenuCreator; if (menuCreator.IsSetupUI) { string[] commandBarNames = (alsoMdiMenu ? SolutionTreeMdiContextMenu : SolutionTreeMenu); foreach (string n in commandBarNames) { // find proper command-bar: CommandBar cmdBar = menuCreator.GetCommandBar(n); // try to insert new element: if (cmdBar != null) { menuCreator.AddButton(cmdBar, menuCommand, beginGroup, itemIndex, afterItemCaption); } } } }
/// <summary> /// Registers new item inside 'Insert' popup. /// </summary> public void AddInsertionItem(MenuCommand menuCommand, bool beginGroup, int itemIndex, string afterItemCaption) { IMenuCreator menuCreator = manager.MenuCreator; if (menuCreator.IsSetupUI) { if (insertionItems == null) { insertionItems = new List <CommandBarPopup>(); foreach (CommandBar r in refactors) { insertionItems.Add(menuCreator.AddPopup(r, InsertMenu, null, false, -1)); } } // and insert the button inside each popup menu: foreach (CommandBarPopup p in insertionItems) { menuCreator.AddButton(p.CommandBar, menuCommand, beginGroup, itemIndex, afterItemCaption); } } }