/// <summary> /// The menu items for this tree node /// </summary> /// <returns></returns> protected override List <MenuItem> GetMenuItems() { List <MenuItem> retVal = base.GetMenuItems(); retVal.Add(new MenuItem("-")); retVal.Add(new MenuItem("Add parameter", new EventHandler(AddParameterHandler))); retVal.Add(new MenuItem("Add case", new EventHandler(AddCaseHandler))); retVal.Add(new MenuItem("-")); DataDictionary.Interpreter.InterpretationContext context = new DataDictionary.Interpreter.InterpretationContext(Item); if (Item.FormalParameters.Count == 1) { Parameter parameter = (Parameter)Item.FormalParameters[0]; DataDictionary.Functions.Graph graph = Item.createGraph(context, parameter); if (graph != null && graph.Segments.Count != 0) { retVal.Add(new MenuItem("Display", new EventHandler(DisplayHandler))); retVal.Add(new MenuItem("-")); } } else if (Item.FormalParameters.Count == 2) { DataDictionary.Functions.Surface surface = Item.createSurface(context); if (surface != null && surface.Segments.Count != 0) { retVal.Add(new MenuItem("Display", new EventHandler(DisplayHandler))); retVal.Add(new MenuItem("-")); } } retVal.Add(new MenuItem("Delete", new EventHandler(DeleteHandler))); return(retVal); }
/// <summary> /// The menu items for this tree node /// </summary> /// <returns></returns> protected override List <MenuItem> GetMenuItems() { List <MenuItem> retVal; if (!IsASubVariable) { retVal = base.GetMenuItems(); retVal.Add(new MenuItem("Delete", new EventHandler(DeleteHandler))); } else { retVal = new List <MenuItem>(); retVal.Add(new MenuItem("Refresh", new EventHandler(RefreshNodeHandler))); } DataDictionary.Functions.Function function = Item.Value as DataDictionary.Functions.Function; if (function != null) { DataDictionary.Interpreter.InterpretationContext context = new DataDictionary.Interpreter.InterpretationContext(Item); if (function.FormalParameters.Count == 1) { Parameter parameter = (Parameter)function.FormalParameters[0]; DataDictionary.Functions.Graph graph = function.createGraph(context, parameter); if (graph != null && graph.Segments.Count != 0) { retVal.Add(new MenuItem("-")); retVal.Add(new MenuItem("Display", new EventHandler(DisplayHandler))); } } else if (function.FormalParameters.Count == 2) { DataDictionary.Functions.Surface surface = function.createSurface(context); if (surface != null && surface.Segments.Count != 0) { retVal.Add(new MenuItem("-")); retVal.Add(new MenuItem("Display", new EventHandler(DisplayHandler))); } } } if (Item.Type is StateMachine) { retVal.Add(new MenuItem("-")); retVal.Add(new MenuItem("View state diagram", new EventHandler(ViewStateDiagramHandler))); } return(retVal); }