/// <summary> /// Performs initialization of this action and /// also registers all the UI elements required by the action, e.g.: menus / menu groups / toolbars. /// </summary> public void Initialize(IPackageEnvironment env, IMenuCreator mc) { solutionListener = new SolutionEventsListener(env.DTE); solutionListener.SolutionQueryClose += SolutionEvents_SolutionQueryClose; config = ObjectFactory.LoadConfiguration(ConfigurationName); }
/// <summary> /// Performs initialization of this action and /// also registers all the UI elements required by the action, e.g.: menus / menu groups / toolbars. /// </summary> public void Initialize(IPackageEnvironment env, IMenuCreator mc) { MenuCommand nameMenu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, ID, Execute, BeforeExecute); parent = env; // ------------------------------------------------------- mc.AddCommand(nameMenu, "InsertClassName", "Insert Class &Name...", 0, null, null, false); mc.Customizator.AddInsertionItem(nameMenu, true, -1, null); // ------------------------------------------------------- string[] pre = new string[] { "Byte", "String", "Object", "Thread", "Int", "Custom", "Type", "Editor", "Environment", "Code", "File", "Socket", "Handle", "Image", "Picture", "Icon", "Bitmap", "Color", "Smart", "Stupid", "Secure", "Custom", "Client", "Server", "Remote", "Random", "MultiByte", "Shared", "Box", "Static", "Dynamic" }; string[] body = new string[] { "Provider", "Executor", "Factory", "Locator", "Helper", "Util", "Record", "Randomizer", "Modeler", "Listener", "Serializer", "Generator", "Consumer" }; string[] post = new string[] { "Info", "Ext", "Extension", "Param", "Event", "Args", "Contract", "Annotation", "Attribute", "Action", "Array", "Mode", "Comparer", "Metadata", "Data", }; // and create random-names-generator: nameGenerator = new NameProvider(pre, 0.8, body, 1, post, 0.5); }
/// <summary> /// Performs initialization over each known custom Visual Studio action. /// </summary> public void Initialize(IPackageEnvironment env, IMenuCreator menuCreator) { foreach (IPackageAction a in data) { a.Initialize(env, menuCreator); } }
/// <summary> /// Performs initialization of this action and /// also registers all the UI elements required by the action, e.g.: menus / menu groups / toolbars. /// </summary> public void Initialize(IPackageEnvironment env, IMenuCreator mc) { MenuCommand tipsMenu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, PackageCmdIDList.toolAction_AbouxBoxPopup, ExecuteTips); MenuCommand checkMenu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, PackageCmdIDList.toolAction_AbouxBoxCheckUpdate, ExecuteCheckUpdate); MenuCommand bugMenu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, PackageCmdIDList.toolAction_AbouxBoxSubmitBug, ExecuteBug); MenuCommand featureMenu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, PackageCmdIDList.toolAction_AbouxBoxRequestFeature, ExecuteFeature); MenuCommand visitMenu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, PackageCmdIDList.toolAction_AbouxBoxVisit, ExecuteVisit); MenuCommand aboutMenu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, PackageCmdIDList.toolAction_AbouxBoxInfo, ExecuteAboutBox); parent = env; // ------------------------------------------------------- mc.AddCommand(tipsMenu, "TipsAndTricks", "&Tips && tricks...", 9013, null, null, false); mc.AddCommand(checkMenu, "CheckForUpdate", "&Check for update...", 0, null, null, false); mc.AddCommand(bugMenu, "SubmitBug", "Submit &bug...", 0, null, null, false); mc.AddCommand(featureMenu, "SubmitFeature", "Submit &feature request...", 0, null, null, false); mc.AddCommand(visitMenu, "VisitHomepage", "Visit &homepage", 9014, null, null, false); mc.AddCommand(aboutMenu, "AboutBox", "&About...", 0, null, null, false); mc.Customizator.AddAboutItem(tipsMenu, false, 1, null); mc.Customizator.AddAboutItem(checkMenu, false, 2, null); mc.Customizator.AddAboutItem(bugMenu, true, 3, null); mc.Customizator.AddAboutItem(featureMenu, false, 4, null); mc.Customizator.AddAboutItem(visitMenu, false, 5, null); mc.Customizator.AddAboutItem(aboutMenu, true, 6, null); CheckVersion(); }
/// <summary> /// Performs initialization of this action and /// also registers all the UI elements required by the action, e.g.: menus / menu groups / toolbars. /// </summary> public void Initialize(IPackageEnvironment env, IMenuCreator mc) { MenuCommand menu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, ID, Execute); parent = env; // ------------------------------------------------------- mc.AddCommand(menu, "CommandView", "&Command Browser", BitmapIndex, "Global::Ctrl+W, B", null, true); mc.Customizator.AddAuxToolWindow("View", menu, false, 9, "Properties Window"); }
/// <summary> /// Performs initialization of this action and /// also registers all the UI elements required by the action, e.g.: menus / menu groups / toolbars. /// </summary> public void Initialize(IPackageEnvironment env, IMenuCreator mc) { MenuCommand menu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, ID, Execute, BeforeQueryStatus); parent = env; // ------------------------------------------------------- mc.AddCommand(menu, "ExpandEnumRefactor", "Ex&pand Switch From Enum...", 9021, "Global::Ctrl+R, J", null, false); mc.Customizator.AddRefactoring(menu, false, -1, null); }
/// <summary> /// Performs initialization of this action and /// also registers all the UI elements required by the action, e.g.: menus / menu groups / toolbars. /// </summary> public void Initialize(IPackageEnvironment env, IMenuCreator mc) { MenuCommand databaseMenu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, ID, Execute, BeforeExecute); parent = env; // ------------------------------------------------------- mc.AddCommand(databaseMenu, "InsertConnectionString", "Insert &Connection String...", 9016, "Global::Ctrl+R, S", null, false); mc.Customizator.AddInsertionItem(databaseMenu, true, -1, null); }
/// <summary> /// Performs initialization of this action and /// also registers all the UI elements required by the action, e.g.: menus / menu groups / toolbars. /// </summary> public void Initialize(IPackageEnvironment env, IMenuCreator mc) { MenuCommand menu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, ID, Execute); parent = env; // ------------------------------------------------------- mc.AddCommand(menu, "NativeImagePreview", "NativeImage &Preview", BitmapIndex, "Global::Ctrl+W, N", null, true); mc.Customizator.AddAuxToolWindow("View", menu, true, 11, "Object Browser"); }
/// <summary> /// Performs initialization of this action and /// also registers all the UI elements required by the action, e.g.: menus / menu groups / toolbars. /// </summary> public void Initialize(IPackageEnvironment env, IMenuCreator mc) { MenuCommand menu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, ID, Execute); parent = env; // ------------------------------------------------------- mc.AddCommand(menu, "DebugOutputView", "&Debug Output", BitmapIndex, "Global::Ctrl+W, V", null, true); mc.Customizator.AddToolWindow("View", menu, false, 8, "Output"); }
/// <summary> /// Performs initialization of this action and /// also registers all the UI elements required by the action, e.g.: menus / menu groups / toolbars. /// </summary> public void Initialize(IPackageEnvironment env, IMenuCreator mc) { MenuCommand menu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, ID, Execute); parent = env; // ------------------------------------------------------- mc.AddCommand(menu, "RegistryExplorerView", "&Registry Explorer", BitmapIndex, "Global::Ctrl+W, M", null, true); mc.Customizator.AddToolWindow("View", menu, false, 4, "Object Browser"); }
/// <summary> /// Performs initialization of this action and /// also registers all the UI elements required by the action, e.g.: menus / menu groups / toolbars. /// </summary> public void Initialize(IPackageEnvironment env, IMenuCreator mc) { MenuCommand menu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, ID, Execute, BeforeQueryStatus); parent = env; // ------------------------------------------------------- mc.AddCommand(menu, "InitConstructorRefactor", "Init &Constructor...", 9003, "Global::Ctrl+R, C", null, false); mc.Customizator.AddRefactoring(menu, false, -1, null); }
/// <summary> /// Performs initialization of this action and /// also registers all the UI elements required by the action, e.g.: menus / menu groups / toolbars. /// </summary> public void Initialize(IPackageEnvironment env, IMenuCreator mc) { MenuCommand menu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, ID, Execute); parent = env; // ------------------------------------------------------- mc.AddCommand(menu, "EnvironmentVariablesView", "Variabl&es View", BitmapIndex, "Global::Ctrl+W, I", null, true); mc.Customizator.AddToolWindow("View", menu, false, 3, "Class View"); }
/// <summary> /// Performs initialization of this action and /// also registers all the UI elements required by the action, e.g.: menus / menu groups / toolbars. /// </summary> public void Initialize(IPackageEnvironment env, IMenuCreator mc) { MenuCommand menu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, ID, Execute); parent = env; // ------------------------------------------------------- mc.AddCommand(menu, "OpenWindowsExplorer", "Open &Folder...", 9008, null, null, false); mc.Customizator.AddSolutionExplorerItem(menu, true, false, 1, "Exclude From Project", "Set as StartUp Project", "Add", "Copy Full Path"); }
/// <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> /// Performs initialization of this action and /// also registers all the UI elements required by the action, e.g.: menus / menu groups / toolbars. /// </summary> public void Initialize(IPackageEnvironment env, IMenuCreator mc) { MenuCommand menu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, ID, Execute, BeforeQueryStatus); parent = env; // load configuration: config = ObjectFactory.LoadConfiguration(ConfigurationName); // ------------------------------------------------------- mc.AddCommand(menu, "MultiRenameRefactor", "Multi Method &Rename...", 9004, "Global::Ctrl+R, L", null, false); mc.Customizator.AddRefactoring(menu, false, -1, null); }
/// <summary> /// Performs initialization of this action and /// also registers all the UI elements required by the action, e.g.: menus / menu groups / toolbars. /// </summary> public void Initialize(IPackageEnvironment env, IMenuCreator mc) { MenuCommand guidMenu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, PackageCmdIDList.toolAction_InsertGuid, ExecuteGuid, QueryExecuteGuid); MenuCommand prevGuidMenu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, PackageCmdIDList.toolAction_InsertPrevGuid, ExecutePrevGuid, QueryExecutePrevGuid); parent = env; // ------------------------------------------------------- mc.AddCommand(guidMenu, "InsertGuid", "Insert New &Guid", 9017, "Global::Ctrl+R, G", null, false); mc.AddCommand(prevGuidMenu, "InsertPrevGuid", "Insert &Previous Guid", 0, "Global::Ctrl+R, Q", null, false); mc.Customizator.AddInsertionItem(guidMenu, false, 1, null); mc.Customizator.AddInsertionItem(prevGuidMenu, false, 2, null); }
/// <summary> /// Removes all the list of popup menus for referenced projects. /// </summary> public void RemoveReferenceProjectPopups() { if (referenceProjects != null) { IMenuCreator menuCreator = manager.MenuCreator; foreach (CommandBarPopup vsPopup in referenceProjects) { menuCreator.DeletePopup(vsPopup); } referenceProjects = null; } }
/// <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> /// Create a set of identical popup menus attached to given parents. /// </summary> private IList <CommandBarPopup> InitializeReferenceProjectsPopups(string[] vsParentMenus, string caption, string captionNo1, string toolTip, params string[] afterItemCaption) { CommandBarPopup[] vsPopups = new CommandBarPopup[vsParentMenus.Length]; IMenuCreator menuCreator = manager.MenuCreator; // register number of popup-menus: for (int i = 0; i < vsParentMenus.Length; i++) { vsPopups[i] = menuCreator.AddPopup(manager.MenuCreator.GetCommandBar(vsParentMenus[i]), (i == 0 ? captionNo1 : caption), toolTip, false, -1, afterItemCaption); vsPopups[i].Visible = false; } return(vsPopups); }
/// <summary> /// Performs initialization of this action and /// also registers all the UI elements required by the action, e.g.: menus / menu groups / toolbars. /// </summary> public void Initialize(IPackageEnvironment env, IMenuCreator mc) { MenuCommand fileMenu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, PackageCmdIDList.toolAction_InsertFilePath, ExecuteFilePath, QueryExecute); MenuCommand contentMenu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, PackageCmdIDList.toolAction_InsertContentPath, ExecuteFileContent, QueryExecute); MenuCommand exportContentMenu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, PackageCmdIDList.toolAction_InsertExportContentPath, ExecuteFileExportContent, QueryExportExecute); MenuCommand folderMenu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, PackageCmdIDList.toolAction_InsertFolderPath, ExecuteFolderPath, QueryExecute); parent = env; // ------------------------------------------------------- mc.AddCommand(fileMenu, "InsertFilePath", "Insert &File Path...", 9019, null, null, false); mc.AddCommand(contentMenu, "InsertFileContent", "Insert File Content As &Binary...", 9020, null, null, false); mc.AddCommand(exportContentMenu, "InsertFileExportContent", "Export File C&ontent...", 0, null, null, false); mc.AddCommand(folderMenu, "InsertFolderPath", "Insert Folder &Location...", 9018, null, null, false); mc.Customizator.AddInsertionItem(folderMenu, false, -1, null); mc.Customizator.AddInsertionItem(fileMenu, false, -1, null); mc.Customizator.AddInsertionItem(contentMenu, false, -1, null); mc.Customizator.AddInsertionItem(exportContentMenu, false, -1, null); }
/// <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> /// Initialize customizator and associate with given manager. /// </summary> public void Initialize(CustomAddInManager m) { IMenuCreator mc = m.MenuCreator; // read the global settings for an add-in: config = ObjectFactory.LoadConfiguration(null); // configure the management objects: manager = m; tytanToolbar = mc.AddToolbar(ToolbarName); tytanAuxTools = mc.AddPopup(tytanToolbar, AuxiliaryToolsName, null, false, -1); tytanRefactors = mc.AddPopup(tytanToolbar, RefactorMenu, null, true, -1); refactors = new List <CommandBar>(); if (tytanRefactors != null) { refactors.Add(tytanRefactors.CommandBar); } refactors.Add(mc.GetMainMenuCommandBar(RefactorMenu)); refactors.Add(mc.GetCodeWindowCommandBar(RefactorMenu)); }
/// <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); } } }
/// <summary> /// Performs initialization of this action and /// also registers all the UI elements required by the action, e.g.: menus / menu groups / toolbars. /// </summary> public void Initialize(IPackageEnvironment env, IMenuCreator menuCreator) { parent = env; mc = menuCreator; tasks.Clear(); tasks.Initialize(); solutionListener = new SolutionEventsListener(env.DTE); solutionListener.SolutionOpened += Solution_Opened; solutionListener.SolutionClosed += Solution_Closed; solutionListener.ProjectAdded += ProjectListChanged_AddedOrRenamed; solutionListener.ProjectRemoved += ProjectListChanged_Removed; solutionListener.ProjectRenamed += ProjectListChanged_AddedOrRenamed; //shellListener = new ShellEventsListener(env.DTE); //shellListener.ModeChanged += ShellModeChanged; // ------------------------------------------------------- // append all existing projects in current solution, // in case AddIn was loaded after opening solution: LoadAndSortSystemAssemblies(); Solution_Opened(null, parent.DTE.Solution); }
private void InitializeOnceCheck(IPackageEnvironment env, IMenuCreator mc) { // check the number of Initialize() method calls: initializeOnceCounter++; }