Extend TFS Source-Control-Explorer

随声附和 提交于 2020-01-30 03:56:07

问题


I already created a Visual Studio 2012 extension to place a ComboBox at Source Control Explorer.

I am using this guid at my vsct file:

  <!-- MyComboBox in Source Control Explorer -->
  <Combo guid="myMainguid" id="cmdSSEComboBox" priority="0x0700" type="DropDownCombo" defaultWidth="130" idCommandList="cmdSSEGetItemsComboBox">
    <Parent guid="guidSourceControlExplorer" id="SSEToolBar" />
    <CommandFlag>IconAndText</CommandFlag>
    <CommandFlag>CommandWellOnly</CommandFlag>
    <Strings>
      <ButtonText>MyComboBox:</ButtonText>
    </Strings>
  </Combo>

<!-- Source Control Explorer -->
<GuidSymbol name="guidSourceControlExplorer" value="{FFE1131C-8EA1-4D05-9728-34AD4611BDA9}">
  <IDSymbol name="SSEToolBar" value="0x1106"/>
</GuidSymbol>

I want to place "MyComboBox" in the group below, the same group where there is the label "Source location" with the navigator.

Is it possible? Thanks, William Sade


回答1:


It is very unlikely that the Source Control Explorer is a customizable element. Technically, it is not part of Visual Studio but an add-in/extension itself. Even if it is customizable, it most probably won't accept vsct stuff.

People have had to create their own Source Control Explorer clones to customize stuff.

At best, you may be able to add your own custom toolbar via vsct to the Source Control Explorer window, which is a VS ToolWindow anyways. However, you will need the GUID for the toolbar. It is not listed in the standard VS window guids.

Hope this gives you at least a direction to look in.

EDIT: You can explore the Source Control Explorer window using the code below. Essentially, enumerate all windows in DTE (in a VsPackage) and place a debug point when your window is found. Then you can explore it. In the screenshot you can see I drilled down to the CommandBar. You may be able to inject your combo there at runtime if not via VSCT.

 for (int i = 0; i < dte.Windows.Count; i++)
 {
     try
     {
         if (dte.Windows.Item(i).Caption.ToLower().Contains("source control"))
         {
             MessageBox.Show("");
         }
     }
     catch (Exception)
     {
     }
 }


来源:https://stackoverflow.com/questions/32879292/extend-tfs-source-control-explorer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!