public static void CreateNodeEditor(CommandTreeNode node, object editedObject, Control container, PackageBody body, PropertyHelpCallback helpCallback) { container.Controls.Clear(); FlowLayoutPanel flowPanel; if (container is FlowLayoutPanel) { flowPanel = (FlowLayoutPanel)container; } else { flowPanel = new FlowLayoutPanel(); container.Controls.Add(flowPanel); flowPanel.FlowDirection = FlowDirection.TopDown; flowPanel.Dock = DockStyle.Fill; } Type type = editedObject.GetType(); var properties = type.GetProperties(); foreach (var currentProperty in properties) { GinArgumentAttribute argumentAttr = (GinArgumentAttribute)currentProperty.GetCustomAttributes(typeof(GinArgumentAttribute), false).FirstOrDefault(); bool isArgument = argumentAttr != null; if (isArgument) { object value = currentProperty.GetValue(editedObject, null); Control control = null; control = argumentAttr.GetEditor(value, currentProperty.Name, body, new PropertyChangedDelegate( (propertyName, propertyValue) => { PropertyInfo changedProperty = type.GetProperty(propertyName); if (changedProperty != null) { changedProperty.SetValue(editedObject, propertyValue, null); if (editedObject is Command) { string name = ((Command)editedObject).GetHumanReadableName(); if (name != node.NodeName) { node.NodeName = name; } } } }), new PropertyActivatedDelegate(propertyName => { if (helpCallback != null) { helpCallback(propertyName, argumentAttr.Name, argumentAttr.Description, argumentAttr.AllowTemplates, control as ITemplatedEditor); } })); if (control != null) { control.Tag = currentProperty; flowPanel.Controls.Add(control); } } } }