1
Vote

Delete Key is not supported for Project FileNode and FolderNodes

description

Requirement:
  Pressing Del key when the focus is in FileNode/FolderNode at Solution Explorer shall remove the selected item from the project and delete the item from physical disk.
 
Modifications done to MPF source to accomplish the above behavior:
 
Uncomment the following line in the QueryStatusOnNode override of FileNode
//case VsCommands.Delete: goto case VsCommands.OpenWith;
 
Note: IVsHierarchyDeleteHandler is implemented in HierarchyNode
 
Added the following piece of code in ExecCommandOnNode implementation of FileNode.cs
 
if(cmdGroup == VsMenus.guidStandardCommandSet97)
{
     case VsCommands.Delete:
            MessageBox.Show("Del Key Pressed");
            return VsConstants.S_OK;
}
 
After building the solution, I can see the delete context menu with 'Del' key bonded with the Delete command [possibly cmdiddelete] when i right click the filenode. But pressing the Del key doesn't show the message box.
 
Expected result:
  If Del key is pressed when the focus is at FileNode of Solution Explorer, the message "Del Key Pressed" should popup.
 
Actual result:
 The message box "Del key pressed" is not poped up. 
 
It seems like del key binding has some issues with MPF with respect to FileNode and FolderNode.
 
Following are some of the support threads raised in vsx forum,
http://social.msdn.microsoft.com/Forums/en/vsx/thread/1931a5b0-094f-4060-a247-946fb9cda8d8

comments

lesta wrote Apr 11, 2011 at 8:28 AM

Simply add in the constructor of your ProjectNode derived class:
this.CanProjectDeleteItems = true;

tsgd84 wrote Apr 14, 2011 at 8:48 AM

Yes, that works!!

wrote Feb 14, 2013 at 2:58 AM