Beispiel #1
0
        public virtual int Exec(ref Guid cmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            if (cmdGroup == VSConstants.VSStd2K)
            {
                switch ((VSConstants.VSStd2KCmdID)nCmdID)
                {
                case VSConstants.VSStd2KCmdID.SHOWCONTEXTMENU:
                    AnkhCommandMenu menu = Language.DefaultContextMenu;

                    if (menu != 0)
                    {
                        ShowContextMenu(AnkhId.CommandSetGuid, (int)menu, this);
                    }
                    else
                    {
                        ShowContextMenu(VsMenus.guidSHLMainMenu, VsMenus.IDM_VS_CTXT_CODEWIN, this);
                    }
                    return(VSErr.S_OK);
                }
            }
            if (_fallThrough != null)
            {
                return(_fallThrough.Exec(ref cmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut));
            }
            else
            {
                return(VSErr.E_FAIL); // delegate to next command target.
            }
        }
Beispiel #2
0
        public void ShowContextMenu(AnkhCommandMenu menu, int x, int y)
        {
            IMenuCommandService mcs = GetService <IMenuCommandService>();

            IVsUIShell shell = GetService <IVsUIShell>();

            if (mcs != null)
            {
                try
                {
                    mcs.ShowContextMenu(new CommandID(AnkhId.CommandSetGuid, (int)menu), x, y);
                }
                catch (COMException)
                {
                    /* Menu is not declared correctly (no items) */
                }
            }
        }
Beispiel #3
0
 public void ShowContextMenu(AnkhCommandMenu menu, System.Drawing.Point location)
 {
     ShowContextMenu(menu, location.X, location.Y);
 }
Beispiel #4
0
 public void ShowContextMenu(AnkhCommandMenu menu, System.Drawing.Point location)
 {
     ShowContextMenu(menu, location.X, location.Y);
 }
Beispiel #5
0
        public void ShowContextMenu(AnkhCommandMenu menu, int x, int y)
        {
            IMenuCommandService mcs = GetService<IMenuCommandService>();

            IVsUIShell shell = GetService<IVsUIShell>();
            if (mcs != null)
            {
                try
                {
                    mcs.ShowContextMenu(new CommandID(AnkhId.CommandSetGuid, (int)menu), x, y);
                }
                catch (COMException)
                {
                    /* Menu is not declared correctly (no items) */
                }
            }
        }