コード例 #1
0
        void IPackage.Load(IServiceProvider serviceProvider)
        {
            // Set this early so it is easily referenced
            myServiceProvider = serviceProvider;

            IAssemblyBrowser assemblyBrowser = (IAssemblyBrowser)serviceProvider.GetService(typeof(IAssemblyBrowser));

            assemblyBrowser.ActiveItemChanged += new EventHandler(OnActiveItemChanged);
            myLastActiveItem  = assemblyBrowser.ActiveItem;
            myAssemblyBrowser = assemblyBrowser;
            ILanguageManager languageManager = (ILanguageManager)serviceProvider.GetService(typeof(ILanguageManager));

            myLanguageManager = languageManager;
            myConfiguration   = new PLiXConfiguration(this);
            languageManager.ActiveLanguageChanged += new EventHandler(OnActiveLanguageChanged);
            ILanguage language = new PLiXLanguage((ITranslatorManager)serviceProvider.GetService(typeof(ITranslatorManager)), myConfiguration);

            languageManager.RegisterLanguage(language);
            myLanguage = language;

            // Add our PLiX menu item, activated when the plix language is active
            ICommandBarManager commandBarManager = (ICommandBarManager)serviceProvider.GetService(typeof(ICommandBarManager));
            ICommandBar        menuBar           = commandBarManager.CommandBars["MenuBar"];
            ICommandBarMenu    topMenu           = menuBar.Items.InsertMenu(menuBar.Items.Count - 1, "PLiXLanguageOptions", "PLi&X");

            topMenu.Visible   = false;
            topMenu.DropDown += new EventHandler(OnOpenTopMenu);

            ICommandBarItemCollection menuItems = topMenu.Items;

            myExampleLanguageMenu = menuItems.AddMenu("PLiXExampleLanguage", "&Example Language");
            menuItems.AddSeparator();
            myExpandCurrentNamespaceDeclarationButton = menuItems.AddButton("E&xpand Current Namespace Declaration", new EventHandler(OnExpandCurrentNamespaceDeclaration));
            myExpandCurrentTypeDeclarationButton      = menuItems.AddButton("E&xpand Current Type Declaration", new EventHandler(OnExpandCurrentTypeDeclaration));
            (myFullyExpandTypeDeclarationsCheckBox = menuItems.AddCheckBox("Ex&pand All Type Declarations")).Click += new EventHandler(OnFullyExpandTypeDeclarationsChanged);
            menuItems.AddSeparator();
            (myDisplayContextDataTypeQualifierCheckBox = menuItems.AddCheckBox("Display Context Type &Qualifier")).Click += new EventHandler(OnDisplayContextDataTypeQualifierChanged);
            ICommandBarMenu callStaticOptionsMenu = menuItems.AddMenu("PLiXStaticCallOptions", "&Static Call Options");

            menuItems = callStaticOptionsMenu.Items;
            (myExplicitStaticCallCheckBox = menuItems.AddCheckBox("&Explicit")).Click += new EventHandler(OnExplicitStaticCallCheckBoxChanged);
            (myImplicitCurrentTypeStaticCallCheckBox = menuItems.AddCheckBox("Implicit (&Current Type)")).Click += new EventHandler(OnImplicitCurrentTypeStaticCallCheckBoxChanged);
            (myImplicitBaseTypesStaticCallCheckBox = menuItems.AddCheckBox("Implicit (&Base Types)")).Click     += new EventHandler(OnImplicitBaseTypesStaticCallCheckBoxChanged);
            myTopMenu = topMenu;

            ICommandBarControl appRefresh1 = GetCommandbarControl(commandBarManager, "ToolBar", "Application.Refresh");

            if (appRefresh1 != null)
            {
                appRefresh1.Click += new EventHandler(OnApplicationRefresh);
            }
            ICommandBarControl appRefresh2 = GetCommandbarControl(commandBarManager, "View", "Application.Refresh");

            if (appRefresh2 != null && appRefresh2 != appRefresh1)
            {
                appRefresh2.Click += new EventHandler(OnApplicationRefresh);
            }
            //DumpMenus(commandBarManager);
        }
コード例 #2
0
 public void AddSourceControlDebugMenuItems(ICommandBarItemCollection commandItems)
 {
     commandItems.AddButton("DebugSCC_NewWorkspaces", "Open Project");
     commandItems.AddButton("DebugSCC_GetAll", "Sync All");
     commandItems.AddButton("DebugSCC_Checkout", "Checkout all files");
     commandItems.AddButton("DebugSCC_Diff", "Diff All Files");
     commandItems.AddButton("DebugSCC_Checkin", "Checkin all edited files");
     commandItems.AddButton("DebugSCC_Undo", "Revert all checked out files");
     commandItems.AddButton("DebugSCC_History", "File History");
     commandItems.AddButton("DebugSCC_Add", "Add files");
     commandItems.AddButton("DebugSCC_Delete", "Delete files");
     commandItems.AddButton("DebugSCC_QueryInfo", "Query Info");
     commandItems.AddButton("DebugSCC_GoOnline", "Attempt to go online");
     commandItems.AddButton("DebugSCC_GoOffline", "Attempt to go offline");
 }