public void AddParameterHandler(object sender, EventArgs args) { DataDictionaryTreeView treeView = BaseTreeView as DataDictionaryTreeView; if (treeView != null) { DataDictionary.Parameter parameter = (DataDictionary.Parameter)DataDictionary.Generated.acceptor.getFactory().createParameter(); parameter.Name = "Parameter" + (Item.FormalParameters.Count + 1); Parameters.AddParameter(parameter); } }
/// <summary> /// The menu items for this tree node /// </summary> /// <returns></returns> protected override List <MenuItem> GetMenuItems() { List <MenuItem> retVal = new List <MenuItem>(); MenuItem updateItem = new MenuItem("Update..."); updateItem.MenuItems.Add(new MenuItem("Update", AddUpdate)); updateItem.MenuItems.Add(new MenuItem("Remove", RemoveInUpdate)); retVal.Add(updateItem); retVal.Add(new MenuItem("Delete", DeleteHandler)); retVal.AddRange(base.GetMenuItems()); Function function = Item.Value as Function; if (function != null) { InterpretationContext context = new InterpretationContext(Item); if (function.FormalParameters.Count == 1) { Parameter parameter = (Parameter)function.FormalParameters[0]; Graph graph = function.CreateGraph(context, parameter, null); if (graph != null && graph.Segments.Count != 0) { retVal.Insert(6, new MenuItem("Display", DisplayHandler)); } } else if (function.FormalParameters.Count == 2) { Surface surface = function.CreateSurface(context, null); if (surface != null && surface.Segments.Count != 0) { retVal.Insert(6, new MenuItem("Display", DisplayHandler)); } } } else { retVal.Insert(5, new MenuItem("-")); retVal.Insert(6, new MenuItem("Display", DisplayHandler)); } if (Item.Type is StateMachine) { retVal.Insert(5, new MenuItem("-")); retVal.Insert(6, new MenuItem("View state diagram", ViewStateDiagramHandler)); } return(retVal); }
/// <summary> /// Constructor /// </summary> /// <param name="panel"></param> /// <param name="model"></param> public ParameterModelControl(ModelDiagramPanel panel, Parameter model) : base(panel, model) { }