示例#1
0
 public void removeCommands()
 {
     // Remove all commands we've registered...
     foreach (Command cmdDel in cmds)
     {
         // All our commands starts with "Qt4VSAddin", so we
         // simply remove them. Just looking for the
         // CommandFullName (e.g. NewQtProjectFullCommand)
         // will give use problems if we decide to rename
         // our commands...
         try
         {
             if (cmdDel.Name.StartsWith(Res.CommandBarName))
             {
                 cmdDel.Delete();
             }
         }
         catch { }
     }
     if (qtPopup != null)
     {
         qtPopup.Visible = false;
         qtPopup.Delete(false);
     }
 }
示例#2
0
 private void RemoveCommandBarPopup(CommandBarPopup commandBarPopup)
 {
     if (commandBarPopup != null)
     {
         commandBarPopup.Delete(true);
     }
 }
示例#3
0
        public void RecreateMenu(VBProject project)
        {
            int windowMenuId    = 30038;
            var menuBarControls = _app.IDE.CommandBars[1].Controls;
            var beforeIndex     = FindMenuInsertionIndex(menuBarControls, windowMenuId);

            if (_menu != null)
            {
                UnsubsribeCommandBarButtonClickEvents();
                beforeIndex = _menu.Index;
                _menu.Delete();
            }

            _menu         = menuBarControls.Add(MsoControlType.msoControlPopup, Before: beforeIndex, Temporary: true) as CommandBarPopup;
            _menu.Tag     = "VBAGit";
            _menu.Caption = VBAGitUI.VBAGitMenu;

            if (_app.GetVBProjectRepository(project) != null)
            {
                _gitSync   = AddButton(_menu, VBAGitUI.VBAGitMenu_Sync, false, OnGitSync, "git_sync");
                _gitCommit = AddButton(_menu, VBAGitUI.VBAGitMenu_Commit, false, OnGitCommit, "git_commit");
                _gitPull   = AddButton(_menu, VBAGitUI.VBAGitMenu_Pull, true, OnGitPull, "git_pull");
                _gitFetch  = AddButton(_menu, VBAGitUI.VBAGitMenu_Fecth, false, OnGitFetch, "git_pull");
                _gitPush   = AddButton(_menu, VBAGitUI.VBAGitMenu_Push, false, OnGitPush, "git_push");

                AddVBAGitMenu(true);
            }
            else
            {
                _gitCreate = AddButton(_menu, VBAGitUI.VBAGitMenu_Create, false, OnGitCreate, "create_repo");

                AddVBAGitMenu(false);
            }
        }
示例#4
0
        private void RemoveMenuItems()
        {
            // remove the RoundTable menu items
            try
            {
                // get the main menu bar
                CommandBar menuBar = projectApp.CommandBars["Menu Bar"];

                //if(menuBar == null)
                //	menuBar = appOutlook.ActiveExplorer().CommandBars["Menu Bar"];

                if (menuBar == null)
                {
                    return;
                }

                // check for the Dommoni popup menu item
                foreach (CommandBarControl menuItem in menuBar.Controls)
                {
                    if (menuItem.Caption == "&RoundTable")                     //Utils.MENU_ITEM_ROUNDTABLE)
                    {
                        try
                        {
                            CommandBarPopup popup = (CommandBarPopup)menuItem;

                            try
                            {
                                foreach (CommandBarControl item in popup.Controls)
                                {
                                    item.Delete(false);
                                }
                            }
                            catch (System.Exception)
                            {
                                // ignore. just means there are no sub items, perhaps
                                // due to a previously failed cleanup
                            }

                            popup.Delete(false);
                        }
                        catch (System.Exception ex)
                        {
                            //ErrorHandler.PublishError(ex,logger);
                            // TODO: Put back when this is solved

                            //ErrorHandler.PublishError(ex);
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                //ErrorHandler.PublishError(ex, logger);
                // TODO: Put back when this is solved

                // TODO: Make one of these...
                //ErrorHandler.PublishError(ex);
            }
        }
示例#5
0
        private void RemoveMenuItems()
        {
            // remove the RoundTable menu items
            try
            {
                // get the main menu bar
                if (menuBar == null)
                {
                    menuBar = wordApp.CommandBars["Menu Bar"];
                }

                if (menuBar == null)
                {
                    return;
                }

                // check for the Dommoni popup menu item
                foreach (CommandBarControl menuItem in menuBar.Controls)
                {
                    if (menuItem.Caption == MENU_ITEM_ROUNDTABLE)
                    {
                        try
                        {
                            CommandBarPopup popup = (CommandBarPopup)menuItem;

                            try
                            {
                                foreach (CommandBarControl item in popup.Controls)
                                {
                                    item.Delete(false);
                                }
                            }
                            catch (System.Exception)
                            {
                                // ignore. just means there are no sub items, perhaps
                                // due to a previously failed cleanup
                            }

                            popup.Delete(false);
                        }
                        catch (System.Exception ex)
                        {
                            //ErrorHandler.PublishError(ex,logger);
                            // TODO: Put back when this is solved
                            //ErrorHandler.PublishError(ex);
                            MessageBox.Show(ex.Message);
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                //ErrorHandler.PublishError(ex, logger);
                // TODO: Put back when this is solved
                //ErrorHandler.PublishError(ex);
                MessageBox.Show(ex.Message);
            }
        }
示例#6
0
        private void RemoveMenuItems()
        {
            // remove the RoundTable menu items
            try
            {
                // get the main menu bar
                //CommandBar menuBar = Utils.menuBar; //appOutlook.ActiveExplorer().CommandBars["Menu Bar"];

                if (menuBar == null)
                {
                    menuBar = excelApp.CommandBars["Worksheet Menu Bar"];
                }

                if (menuBar == null)
                {
                    return;
                }

                // check for the Dommoni popup menu item
                foreach (CommandBarControl menuItem in menuBar.Controls)
                {
                    if (menuItem.Caption == Utils.MENU_ITEM_DMNISALES)
                    {
                        try
                        {
                            CommandBarPopup popup = (CommandBarPopup)menuItem;

                            try
                            {
                                foreach (CommandBarControl item in popup.Controls)
                                {
                                    item.Delete(false);
                                }
                            }
                            catch (System.Exception)
                            {
                                // ignore. just means there are no sub items, perhaps
                                // due to a previously failed cleanup
                            }

                            popup.Delete(false);
                        }
                        catch (System.Exception ex)
                        {
                            //ErrorHandler.PublishError(ex,logger);
                            // TODO: Put back when this is solved
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                //ErrorHandler.PublishError(ex, logger);
                // TODO: Put back when this is solved
            }
        }
示例#7
0
        public void OnDisconnection(ext_DisconnectMode disconnectMode, ref Array custom)
        {
            try
            {
                switch (disconnectMode)
                {
                case ext_DisconnectMode.ext_dm_HostShutdown:
                case ext_DisconnectMode.ext_dm_UserClosed:

                    // Delete buttons on built-in commandbars
                    if ((_myStandardCommandBarButton != null))
                    {
                        _myStandardCommandBarButton.Delete();
                    }

                    if ((_myCodeWindowCommandBarButton != null))
                    {
                        _myCodeWindowCommandBarButton.Delete();
                    }

                    if ((_myToolsCommandBarButton != null))
                    {
                        _myToolsCommandBarButton.Delete();
                    }

                    // Disconnect event handlers
                    _myToolBarButton          = null;
                    _myCommandBarPopup1Button = null;
                    _myCommandBarPopup2Button = null;

                    // Delete commandbars created by the add-in
                    if ((_myToolbar != null))
                    {
                        _myToolbar.Delete();
                    }

                    if ((_myCommandBarPopup1 != null))
                    {
                        _myCommandBarPopup1.Delete();
                    }

                    if ((_myCommandBarPopup2 != null))
                    {
                        _myCommandBarPopup2.Delete();
                    }

                    break;
                }
            }
            catch (System.Exception e)
            {
                System.Windows.Forms.MessageBox.Show(e.Message);
            }
        }
示例#8
0
        private void RemoveRefactorContextMenu()
        {
            _extractMethodContextButton.Delete();
            _renameContextButton.Delete();
            _reorderParametersContextButton.Delete();
            _removeParametersContextButton.Delete();
            _refactorCodePaneContextMenu.Delete();

            _findAllReferencesContextMenu.Delete();
            _findAllImplementationsContextMenu.Delete();
            _findSymbolContextMenu.Delete();
        }
示例#9
0
 /// <summary>
 ///
 /// </summary>
 private void RemoveSCSPopup()
 {
     // If the menu already exists, remove it.
     try
     {
         CommandBarPopup foundMenu = (CommandBarPopup)
                                     _OutlookApplication.ActiveExplorer().CommandBars["Tools"].
                                     FindControl(MsoControlType.msoControlPopup,
                                                 System.Type.Missing, Constants.TAG_SCS_CONFIG_BUTTON_IN_TOOLS, true, true);
         if (foundMenu != null)
         {
             foundMenu.Delete(true);
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#10
0
        public void AutoClose()
        {
            IntelliSenseServer.Uninstall();
            Java.Dispose();
            WDSJniPMMLMenuToDelete.Delete(true);
            ExcelCommandBarUtil.UnloadCommandBars();

            __JniPMML            = null;
            Java                 = null;
            pair                 = null;
            java_class_path      = null;
            java_init_classid    = IntPtr.Zero;
            java_init_class_name = null;

            GC.Collect();
            GC.WaitForPendingFinalizers();
            GC.Collect();
            GC.WaitForPendingFinalizers();
        }
        private void RemoveMenubar()
        {
            // If the menu already exists, remove it.
            try
            {
                CommandBarPopup foundMenu = (CommandBarPopup)
                                            this.Application.ActiveExplorer().CommandBars.ActiveMenuBar.
                                            FindControl(MsoControlType.msoControlPopup,
                                                        missing, menuTag, true, true);

                if (foundMenu != null)
                {
                    foundMenu.Delete(true);
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 /// <summary>
 /// Deletes the plugin command
 /// </summary>
 public void DeleteCommand()
 {
     try
     {
         if ((pluginCmd != null))
         {
             pluginCmd.Delete();
         }
         if (toolsCommandBarPopup != null)
         {
             if (toolsCommandBarPopup.Controls.Count == 0)
             {
                 toolsCommandBarPopup.Delete(true);
             }
         }
     }
     catch
     {
         // we are exiting here so we just swallow any exception, because most likely VS.Net is shutting down too.
     }
 }
示例#13
0
        /// <summary>
        /// Removes given popup menu.
        /// All the child controls (MenuCommands) should be removed separately before call of this function.
        /// </summary>
        public void DeletePopup(CommandBarPopup popupMenu)
        {
            if (popupMenu == null)
            {
                throw new ArgumentNullException("popupMenu");
            }

            // remove from stored collection:
            if (!popups.Remove(popupMenu))
            {
                throw new ArgumentException("popupMenu");
            }

            try
            {
                // release the instance:
                popupMenu.Delete(null);
            }
            catch (Exception ex)
            {
                Trace.Write(ex.Message);
            }
        }
		private void RemoveCommandBarPopup(CommandBarPopup commandBarPopup)
		{
			if (commandBarPopup != null)
			{
				commandBarPopup.Delete(true);
			}
		}
 public void Delete(object Temporary)
 {
     _popup.Delete(Temporary);
 }