locked
How to remove "Export Data Tips", "Clear All data Tips","Import Data Tips", "Options & Settings" sub menus under "Debug" Menu from Isolated Shell vs2010 RRS feed

  • Question

  • Hi All,

    Currently I am working on adding sub Menus to "Debug" main menu of Visual Studio in Isolated Environment (My requirement is that I want to customize "Debug" main menu). I added few custom sub menus under "Debug" main menu. 

    I removed several sub menus of "Debug" Main Menu like StepInto, StepOver,ClearBreakpoints, ToggleBreakpoint i.e. 

                        case (uint)Microsoft.VisualStudio.VSConstants.VSStd97CmdID.StepInto:
                        case (uint)Microsoft.VisualStudio.VSConstants.VSStd97CmdID.StepOver:
                        case (uint)Microsoft.VisualStudio.VSConstants.VSStd97CmdID.ToggleBreakpoint:
                        case (uint)Microsoft.VisualStudio.VSConstants.VSStd97CmdID.ClearBreakpoints:
                            {
                                prgCmds[0].cmdf = (uint)OLECMDF.OLECMDF_SUPPORTED | (uint)OLECMDF.OLECMDF_INVISIBLE;
                                return VSConstants.S_OK;
                            }

    also I removed several sub menu's of "Window" sub menu (i.e. Debug - > Windows -> Call Stack ) by uncommenting commands from ApplicationCommands.vsct.

    After doing this, I am unable to remove "Export Data Tips", "Clear All data Tips","Import Data Tips", "Options & Settings", I want to remove these 4 commands from "Debug" main menu of Visual Studio.

    For removing these 4 commands I tried several things like - 

    1> Used EnableVsLogging - I found Guid & ID of these 4 commands and used in code like 

    if (pguidCmdGroup.ToString() == "C9DD4A58-47FB-11D2-83E7-00C04F9902C1" || pguidCmdGroup.ToString() == "1496a755-94de-11d0-8c3f-00c04fc2aae2" || pguidCmdGroup.ToString() == "c9dd4a59-47fb-11d2-83e7-00c04f9902c1")
                {
                    switch (prgCmds[0].cmdID)
                    {
                        case (uint)257:
                        case (uint)800:
                        case (uint)801:
                        case (uint)371:
                        case (uint)1603:
                        case (uint)1604:
                        case (uint)1605:
                        case (uint)333:
                            {
                                prgCmds[0].cmdf = (uint)OLECMDF.OLECMDF_SUPPORTED | (uint)OLECMDF.OLECMDF_INVISIBLE;
                                return VSConstants.S_OK;
                            }
                    }
                }


    Using this I only able to disable the "Options & setting command" (not hide), but "Import Data Tips" is still enable. (Above code is not executing in Isolated Mode for "Export Data Tips", "Clear All data Tips","Import Data Tips" etc)

    2> If I did not load Package for Debugger ( from .pkgundef file) then these 4 commands are not visible but If Visual studio didn't load Package for "Debug" then the standard commands under "Debug" Menu like Start Debugging & Output Window (Window -> Output) will be invisible (Because package for this commands aren't loaded) which I don't want.

    3> I can invisible these 4 commands in Package.cs using following code 


                    CommandID cmdidDebuggerStopDebugging = new CommandID(iBGuids.guidiBoltPackageCmdSet, iBPkgCmdIDList.cmdidStopDebuging);
                    OleMenuCommand oleDebuggerStopDebugging = new OleMenuCommand(DebuggerStopDebugging, cmdidDebuggerStopDebugging);
                    mcs.AddCommand(oleDebuggerStopDebugging);

             // Handler
            private void DebuggerStopDebugging(object sender, EventArgs e)
            {
               // Here we can set visiability
            }

    Here problem is that I didn't get command Id to create commands (in above code - iBPkgCmdIDList.cmdidStopDebuging). So I am unable to use this option.


    Can You Please help me to hide the "Export Data Tips", "Clear All data Tips","Import Data Tips", "Options & Settings" commands from "Debug" Main Menu ?

    Thanks in advance.
    • Moved by Carl Cai Tuesday, February 11, 2014 8:20 AM (from debug)More related
    Tuesday, February 11, 2014 5:36 AM

Answers

  • Hi Sunny,

    Thanks for your efforts. I got solution for my problem. i.e.

     public void HandleVisibility()
            {
                DTE dte = GetService(typeof(SDTE)) as DTE;
                if (dte != null)
                {
                    CommandBars commandBars = dte.CommandBars as CommandBars;
                    CommandBar menuBarCommandBar = commandBars["MenuBar"];
                    
                    CommandBarControls menuBarControls = menuBarCommandBar.Controls;
                    foreach (CommandBarControl commandBarControl in menuBarControls)
                    {
                        if (commandBarControl.Type == MsoControlType.msoControlPopup)
                        {
                            CommandBarPopup commandBarPopup = commandBarControl as CommandBarPopup;
                            if (commandBarPopup.CommandBar.Name == "Debug")
                            {
                                foreach (CommandBarControl child in commandBarPopup.CommandBar.Controls)
                                {
                                    try
                                    {
                                        switch (child.Caption)
                                        {
                                            case "Clear &All DataTips":
                                            case "E&xport DataTips ...":
                                            case "Im&port DataTips ...":
                                            case "Options and Settin&gs...":
                                                {
                                                    commandBarPopup.CommandBar.Controls[child.Caption].Enabled = true;
                                                    commandBarPopup.CommandBar.Controls[child.Caption].Delete();
                                                }
                                                break;
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        MessageBox.Show(ex.Message);
                                    }
                                }
                            }
                        }
                    }
                }

    It's working for me. Thanks Buddy !!!

    Regards,

    Sudarshan

    • Marked as answer by Sud Gujar Monday, February 17, 2014 10:21 AM
    Monday, February 17, 2014 10:20 AM

All replies

  • Hi,

    I have moved this thread to Visual Studio Extensibility forum for more dedicated support.

    Thanks for your understanding.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, February 11, 2014 8:23 AM
  • Hi,

    I will try to involve some senior engineer into this case. Thanks for the patience!

    Best regards,

    Sunny

    Thursday, February 13, 2014 11:34 AM
  • Hi Sunny,

    Thanks for your efforts. I got solution for my problem. i.e.

     public void HandleVisibility()
            {
                DTE dte = GetService(typeof(SDTE)) as DTE;
                if (dte != null)
                {
                    CommandBars commandBars = dte.CommandBars as CommandBars;
                    CommandBar menuBarCommandBar = commandBars["MenuBar"];
                    
                    CommandBarControls menuBarControls = menuBarCommandBar.Controls;
                    foreach (CommandBarControl commandBarControl in menuBarControls)
                    {
                        if (commandBarControl.Type == MsoControlType.msoControlPopup)
                        {
                            CommandBarPopup commandBarPopup = commandBarControl as CommandBarPopup;
                            if (commandBarPopup.CommandBar.Name == "Debug")
                            {
                                foreach (CommandBarControl child in commandBarPopup.CommandBar.Controls)
                                {
                                    try
                                    {
                                        switch (child.Caption)
                                        {
                                            case "Clear &All DataTips":
                                            case "E&xport DataTips ...":
                                            case "Im&port DataTips ...":
                                            case "Options and Settin&gs...":
                                                {
                                                    commandBarPopup.CommandBar.Controls[child.Caption].Enabled = true;
                                                    commandBarPopup.CommandBar.Controls[child.Caption].Delete();
                                                }
                                                break;
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        MessageBox.Show(ex.Message);
                                    }
                                }
                            }
                        }
                    }
                }

    It's working for me. Thanks Buddy !!!

    Regards,

    Sudarshan

    • Marked as answer by Sud Gujar Monday, February 17, 2014 10:21 AM
    Monday, February 17, 2014 10:20 AM
  • Hi Sudarshan,

    I'm glad to hear that you got it working.

    Thank you for sharing your solutions & experience here. It will be very beneficial for other community members who have similar questions.

    Best regards,

    Sunny

    Monday, February 17, 2014 10:23 AM