How to add my right click menus in SSMS 2008R2\2012 Object Explorer? I researched this topic.
I do this way:
private void Provider_SelectionChanged(object sender, NodesChangedEventArgs args)
{
INodeInformation[] nodes;
int nodeCount;
objectExplorer.GetSelectedNodes(out nodeCount, out nodes);
INodeInformation node = (nodeCount > 0 ? nodes[0] : null);
if (_databaseMenu == null &&
_databaseRegex.IsMatch(node.Context))
{
_databaseMenu = (HierarchyObject)node.GetService(typeof(IMenuHandler));
_databaseMenu.AddChild(string.Empty, new MenuItem());
}
}
BUT the problem is: if I do left click on database and then right click - I see my menu, ok. If I expand the object tree via (+) and then immediately right click on database - I do not see my menu. I understand why it is but how to solve this problem?