private void AttachTabContextMenu(ContentDocument document)
{
EventHandler onClick = new EventHandler(TreeContextMenuEventHandler);
ContextMenuStrip menu = new ContextMenuStrip();
menu.Tag = document;
menu.Items.Add(new ToolStripMenuItem("Close", null, onClick, MENU_ITEM_CLOSE));
menu.Items.Add(new ToolStripMenuItem("Close all", null, onClick, MENU_ITEM_CLOSE_ALL));
menu.Items.Add(new ToolStripMenuItem("Close all others", null, onClick, MENU_ITEM_CLOSE_ALL_BUT_THIS));
if (document.TreeNodeID != null)
{
menu.Items.Add(new ToolStripMenuItem("Navigate (In Tree)", null, onClick, MENU_ITEM_NAVIGATE));
}
document.Control.DockingContainer.TabPageContextMenuStrip = menu;
}