コード例 #1
0
 public void Add(ContextAction action)
 {
     this.AddControls(action.Controls);
     this.actions.Add(action);
 }
コード例 #2
0
        private ToolStripMenuItem CreateMenuItem(ContextAction action, NodeInfo node)
        {
            string text;

            if (action.FormattedText)
            {
                string name, fullname;
                fullname = node.AnalysisObject.FullName;
                if (node.AnalysisObject.IsMethodContainer)
                {
                    name = ((MethodContainer)node.AnalysisObject).Name;
                }
                else
                {
                    name = node.Node.Text;
                }

                text = string.Format(action.Text, node.Node.Text, name, fullname);
            }
            else
            {
                text = action.Text;
            }

            ToolStripMenuItem item = new ToolStripMenuItem(text);
            action.MenuItem = item;
            item.Click += new EventHandler(MenuItem_Click);
            return item;
        }