Example #1
0
        /// <summary>
        /// Generuj Menu
        /// </summary>
        private void treeView_MouseUp_1(object sender, MouseEventArgs e)
        {
            simpleDebug.dump();
            if (Browser == null)
            {
                return;
            }

            // Display a context menu if the browser has an action list for the selected node
            if (e.Button == MouseButtons.Right && treeView.SelectedNode != null)
            {
                System.Windows.Forms.ContextMenu cm = new ContextMenu();

                //Dodanie zwyklych akcji
                StringCollection actions = browser.GetActionList(treeView.SelectedNode, "simple");
                if (actions != null)
                {
                    foreach (string action in actions)
                    {
                        cm.MenuItems.Add(action, new EventHandler(DoBrowserAction));
                    }
                }


                MenuItem a;
                a          = new MenuItem();
                a.BarBreak = true;
                cm.MenuItems.Add(a);

                //Dodanie Snippetow
                actions = browser.GetActionList(treeView.SelectedNode, "actions");
                if (actions != null)
                {
                    a = cm.MenuItems.Add("Snippets");
                    foreach (string action in actions)
                    {
                        a.MenuItems.Add(action, new EventHandler(DoBrowserAction));
                    }
                }

                //Dodanie Historii
                actions = browser.GetActionList(treeView.SelectedNode, "history");
                if (actions != null)
                {
                    a = cm.MenuItems.Add("History for this item");
                    foreach (string action in actions)
                    {
                        a.MenuItems.Add(action, new EventHandler(DoBrowserAction));
                    }
                }

                cm.Show(treeView, new Point(e.X, e.Y));
            }
        }