Example #1
0
        /// <summary>
        /// Init constructor.
        /// </summary>
        public CustomAddInMenuManager(DTE2 appObject, AddIn addInInstance, IMenuCustomizator menuCustomizator)
        {
            this.appObject        = appObject;
            this.addInInstance    = addInInstance;
            this.menuCustomizator = menuCustomizator;
            isSetupUI             = true;

            try
            {
                if (resourceManager == null)
                {
                    resourceManager = new ResourceManager("Pretorianie.Tytan.Core.CustomAddIn.CommandBar", Assembly.GetExecutingAssembly());
                }
                if (cultureInfo == null)
                {
                    cultureInfo = new CultureInfo(this.appObject.LocaleID);
                }

                // get instances of default command and tool bars:
                vsCommandBars = appObject.CommandBars as CommandBars;
                if (vsCommandBars != null)
                {
                    mainMenu        = vsCommandBars["MenuBar"];
                    codeWindowMenu  = vsCommandBars["Code Window"];
                    standardToolbar = vsCommandBars["Standard"];
                }
            }
            catch (Exception e)
            {
                Trace.TraceError(e.ToString());
                throw;
            }
        }
Example #2
0
        private void RemoveAllProjects()
        {
            if (vsParentPopups != null)
            {
                IMenuCustomizator customizator = mc.Customizator;

                // hide menus:
                foreach (CommandBarPopup p in vsParentPopups)
                {
                    p.Visible = false;
                }

                // remove all items:
                foreach (MenuCommand i in vsCommands.Values)
                {
                    customizator.RemoveReferenceProject(i);
                }
                foreach (MenuCommand j in vsNames.Values)
                {
                    customizator.RemoveReferenceProject(j);
                }

                // remove popup menus:
                vsParentPopups = null;
                vsCommands.Clear();
                vsNames.Clear();
                customizator.RemoveReferenceProjectPopups();
            }
        }
Example #3
0
        /// <summary>
        /// Init constructor.
        /// </summary>
        public CustomAddInManager(DTE2 applicationObject, AddIn addInInst, IMenuCustomizator menuCustomizator, Assembly assemblyForSatellites)
        {
            appObject     = applicationObject;
            addInInstance = addInInst;
            actions       = new CustomAddInActionDictionary();
            menuManager   = new CustomAddInMenuManager(applicationObject, addInInst, menuCustomizator);
            assist        = new PackageAssist(this);
            mainAssembly  = assemblyForSatellites;

            selectionContainer = new Microsoft.VisualStudio.Shell.SelectionContainer();
            selectedItems      = new System.Collections.ArrayList();
            selectedElements   = new object[1];

            // all settings read/writes will be pefrom according current version of Visual Studio IDE:
            PersistentStorageHelper.Attach(applicationObject);
            BaseOptionPage.ConfigProvider = this;
        }