how to get the selected connection node object of VS Server Explorer window DDEX

后端 未结 1 711
孤街浪徒
孤街浪徒 2021-01-23 07:15

I\'m adding some options for the Connection Node in the server explorer for my VS extension. For one of the menu options that I have added I need to get the connection string of

相关标签:
1条回答
  • 2021-01-23 07:46

    Marking my question as answered since the code that I posted did the trick.

    EnvDTE80.DTE2 _applicationObject = GetDTE2();
    UIHierarchy uih = _applicationObject.ToolWindows.GetToolWindow("Server Explorer") as UIHierarchy;
    Array selectedItems = (Array)uih.SelectedItems;
    if (null != selectedItems)
    {
        foreach (UIHierarchyItem selItem in selectedItems)
        {
            SelectedItem prjItem = selItem.Object as EnvDTE.SelectedItem;
            string name = prjItem.Name;
        }
    }
    
    0 讨论(0)
提交回复
热议问题