How to control the contex menu over the FileNode

May 20, 2009 at 8:15 AM

Hi all,

I have been trying to modify the context menu that opens when you right-click on a file node.

Specifically I am trying to remove the rename command from that menu. My cusrom project should not enable changing the name of some of the files.

I was able to remove the command from the context menu with changing the function in HierarchyNode called:

protected virtual QueryStatusResult QueryStatusCommandFromOleCommandTarget(Guid cmdGroup, uint cmd, out bool handled)

I've removed the line

case VsCommands.Rename:

This function is being called if the call has originated from QueryStatus of the IOleCommandTarget interface. but there is anothen similar function called QueryStatusCommand of the IVsUIHierarchy interface.

My question is: how can I know when these functions are being called and what commands should be blocked in what function?

Thanks in advnace

Eyal