Beispiel #1
0
        public bool SetProperty(string valueName, string valueStr)
        {
            DesignerPropertyEditor propertyEditor = getPropertyEditor(valueName);

            if (propertyEditor == null)
            {
                return(false);
            }

            VariableDef var = propertyEditor.GetVariable();

            if (var.Value.ToString().ToLower() != valueStr.ToLower())
            {
                Plugin.InvokeTypeParser(null, var.GetValueType(), valueStr, (object value) => var.Value = value, null);

                propertyEditor.ValueWasnotAssigned();

                propertyEditor.SetVariable(var, null);

                propertyEditor.ValueWasAssigned();

                return(true);
            }

            return(false);
        }
Beispiel #2
0
        void item_Click(object sender, EventArgs e)
        {
            MenuItem item = (MenuItem)sender;

            Type  editorType = (Type)item.Tag;
            Label label      = (Label)item.Parent.Tag;
            DesignerPropertyEditor editor = (DesignerPropertyEditor)label.Tag;

            Debug.Check(_selectedObject == editor.SelectedObject);

            Nodes.Node node = _selectedObject as Nodes.Node;

            if (node != null)
            {
                node.OnPropertyValueChanged(true);
            }

            Attachments.Attachment attach = _selectedObject as Attachments.Attachment;

            if (attach != null)
            {
                attach.OnPropertyValueChanged(true);
            }

            SelectedObject = _selectedObject;
        }
        private DesignerPropertyEditor createValueEditor(int rowIndex, Type type)
        {
            Debug.Check(rowIndex > -1 && type != null);

            RowControl rowControl = _rowControls[rowIndex];
            Type       editorType = Plugin.InvokeEditorType(type);

            Debug.Check(editorType != null);

            DesignerPropertyEditor editor = (DesignerPropertyEditor)editorType.InvokeMember(string.Empty, BindingFlags.CreateInstance, null, null, new object[0]);

            editor.Dock             = System.Windows.Forms.DockStyle.Fill;
            editor.Margin           = new System.Windows.Forms.Padding(0);
            editor.ValueWasChanged += new DesignerPropertyEditor.ValueChanged(editor_ValueWasChanged);
            editor.SetPar(rowControl.Par, _rootNode);
            editor.ValueWasAssigned();

            if (rowControl.DefaultValueEditor != null)
            {
                this.tableLayoutPanel.Controls.Remove(rowControl.DefaultValueEditor);
            }
            rowControl.DefaultValueEditor = editor;
            this.tableLayoutPanel.Controls.Add(rowControl.DefaultValueEditor, 3, rowIndex + 1);

            return(editor);
        }
        void item_Click(object sender, EventArgs e)
        {
            MenuItem item = (MenuItem)sender;

            Type  editorType = (Type)item.Tag;
            Label label      = (Label)item.Parent.Tag;
            DesignerPropertyEditor editor = (DesignerPropertyEditor)label.Tag;

            Debug.Check(_selectedObject == editor.SelectedObject);

            FlexibleProperty flexProp = (FlexibleProperty)editor.Property.Property.GetValue(_selectedObject, null);

            flexProp.ChangeEditor(editorType);

            Nodes.Node node = _selectedObject as Nodes.Node;
            if (node != null)
            {
                node.OnPropertyValueChanged(true);
            }

            Events.Event evnt = _selectedObject as Events.Event;
            if (evnt != null)
            {
                evnt.OnPropertyValueChanged(true);
            }

            SelectedObject = _selectedObject;
        }
        private void createValueEditor(Type type)
        {
            Type editorType = Plugin.InvokeEditorType(type);

            Debug.Check(editorType != null);

            ParInfo par = this._property as ParInfo;

            if (_property.Variable == null || _property.Variable.GetValueType() != type)
            {
                _property.Variable = new VariableDef(Plugin.DefaultValue(type));
            }

            _valueEditor                  = (DesignerPropertyEditor)editorType.InvokeMember(string.Empty, System.Reflection.BindingFlags.CreateInstance, null, null, new object[0]);
            _valueEditor.Margin           = new System.Windows.Forms.Padding(0);
            _valueEditor.Anchor           = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            _valueEditor.Width            = this.dispTextBox.Width;
            _valueEditor.Location         = this.dispTextBox.Location;
            _valueEditor.Location         = new Point(_valueEditor.Location.X, _valueEditor.Location.Y - _valueEditor.Height - 6);
            _valueEditor.ValueWasChanged += new DesignerPropertyEditor.ValueChanged(editor_ValueWasChanged);

            if (par != null)
            {
                _valueEditor.SetPar(par, null);
            }
            else
            {
                _valueEditor.SetVariable(this._property.Variable, null);
            }

            _valueEditor.ValueWasAssigned();

            this.Controls.Add(_valueEditor);
            _valueEditor.BringToFront();
        }
Beispiel #6
0
        void label_MouseEnter(object sender, EventArgs e)
        {
            Label label = (Label)sender;
            DesignerPropertyEditor editor = (DesignerPropertyEditor)label.Tag;

            propertyGrid.ShowDescription(editor.DisplayName, editor.Description);
        }
        public override void Update(object sender, DesignerPropertyInfo property)
        {
            if (_obj != null)
            {
                DesignerPropertyEditor statusPhaseEditor = GetEditor(_obj, "TransitionPhase");
                Debug.Check(statusPhaseEditor != null);

                PluginBehaviac.Events.AlwaysTransition at = this._obj as PluginBehaviac.Events.AlwaysTransition;

                if (at.Node is PluginBehaviac.Nodes.FSMReferencedBehavior)
                {
                    //
                }
                else
                {
                    if (statusPhaseEditor != null)
                    {
                        statusPhaseEditor.Enabled = false;
                    }

                    //ResultOption is set to be SUCCESS by default
                    SetProperty(_obj, "TransitionPhase", PluginBehaviac.Events.ETransitionPhase.ETP_Always);
                }
            }
        }
Beispiel #8
0
        public override void Update(object sender, DesignerPropertyInfo property)
        {
            if (_obj != null)
            {
                DesignerPropertyEditor oplEditor = GetEditor(_obj, "Opl");
                Debug.Check(oplEditor != null);
                if (oplEditor == sender)
                {
                    VariableDef opl = (VariableDef)GetProperty(_obj, "Opl");

                    if (opl != null)
                    {
                        RightValueDef opr = (RightValueDef)GetProperty(_obj, "Opr");

                        if (opr != null && opl.ValueType != opr.ValueType)
                        {
                            DesignerPropertyEditor oprEditor = GetEditor(_obj, "Opr");
                            Debug.Check(oprEditor != null);

                            oprEditor.Clear();
                        }
                    }
                }
            }
        }
Beispiel #9
0
        private void editor_ValueWasChanged(object sender, DesignerPropertyInfo property)
        {
            Debug.Check(_parTemp != null);

            DesignerPropertyEditor editor = sender as DesignerPropertyEditor;

            _parTemp.Variable = editor.GetVariable();
        }
Beispiel #10
0
        void createParamEditor(MethodDef method, bool enable, bool bReadonlyParent)
        {
            List <MethodDef.Param> parameters = method.Params;

            foreach (MethodDef.Param p in parameters)
            {
                Type   editorType    = typeof(DesignerParameterComboEnumEditor);
                string arugmentsName = "    " + p.DisplayName;
                bool   bReadonly     = bReadonlyParent | p.Attribute.HasFlags(DesignerProperty.DesignerFlags.ReadOnly);
                Label  label         = propertyGrid.AddProperty(arugmentsName, editorType, bReadonly);

                label.MouseEnter += new EventHandler(label_MouseEnter);

                DesignerPropertyEditor editor = (DesignerPropertyEditor)label.Tag;

                if (p.Type.Name == "IList")
                {
                    lastListParam = p;
                }

                if (p.Type.Name == "System_Object" && lastListParam != null)
                {
                    p.ListParam = lastListParam;
                }

                editor.Enabled = enable;
                editor.SetParameter(p, _selectedObject, bReadonly);

                editor.ValueWasAssigned();
                editor.MouseEnter            += editor_MouseEnter;
                editor.DescriptionWasChanged += editor_DescriptionWasChanged;
                editor.ValueWasChanged       += editor_ValueWasChanged;
                //editor.ValueType = p.Attribute.ValueType;

                MethodDef.Param arrayIndexElement = null;

                if (p.Value is VariableDef)
                {
                    VariableDef var = p.Value as VariableDef;
                    arrayIndexElement = var.ArrayIndexElement;
                }
                else if (p.Value is RightValueDef)
                {
                    RightValueDef varRV = p.Value as RightValueDef;

                    if (varRV.Var != null)
                    {
                        arrayIndexElement = varRV.Var.ArrayIndexElement;
                    }
                }

                if (arrayIndexElement != null)
                {
                    createArrayIndexEditor("        ", arrayIndexElement);
                }
            }
        }
Beispiel #11
0
 public override void Update(object sender, DesignerPropertyInfo property)
 {
     if (_obj != null)
     {
         DesignerPropertyEditor statusEditor = GetEditor(_obj, "EndStatus");
         if (statusEditor != null)
         {
             statusEditor.FilterType = typeof(XMLPluginBehaviac.behaviac_EBTStatus);
         }
     }
 }
Beispiel #12
0
        private void editor_ValueWasChanged(object sender, DesignerPropertyInfo property)
        {
            if (_initialized)
            {
                DesignerPropertyEditor editor = sender as DesignerPropertyEditor;

                _property.Variable = editor.GetVariable();

                this.IsModified = true;
            }
        }
Beispiel #13
0
        public override void Update(object sender, DesignerPropertyInfo property)
        {
            if (_obj != null)
            {
                BaseNode p = _obj as BaseNode;

                if (p != null)
                {
                    bool bHTN = false;

                    while (p != null)
                    {
                        if (p.Parent != null && p.Parent.ToString() == "Branch")
                        {
                            bHTN = true;
                            break;
                        }

                        p = p.Parent;
                    }

                    //hide policy configs if for HTN
                    {
                        DesignerPropertyEditor FailurePolicyEditor = GetEditor(_obj, "FailurePolicy");
                        Debug.Check(FailurePolicyEditor != null);
                        if (FailurePolicyEditor != null)
                        {
                            FailurePolicyEditor.Visible = !bHTN;
                        }

                        DesignerPropertyEditor SuccessPolicyEditor = GetEditor(_obj, "SuccessPolicy");
                        Debug.Check(SuccessPolicyEditor != null);
                        if (SuccessPolicyEditor != null)
                        {
                            SuccessPolicyEditor.Visible = !bHTN;
                        }

                        DesignerPropertyEditor ExitPolicyEditor = GetEditor(_obj, "ExitPolicy");
                        Debug.Check(ExitPolicyEditor != null);
                        if (ExitPolicyEditor != null)
                        {
                            ExitPolicyEditor.Visible = !bHTN;
                        }

                        DesignerPropertyEditor ChildFinishPolicyEditor = GetEditor(_obj, "ChildFinishPolicy");
                        Debug.Check(ChildFinishPolicyEditor != null);
                        if (ChildFinishPolicyEditor != null)
                        {
                            ChildFinishPolicyEditor.Visible = !bHTN;
                        }
                    }
                }
            }
        }
Beispiel #14
0
        private int getRowIndex(DesignerPropertyEditor valueEditor)
        {
            for (int i = 0; i < _rowControls.Count; ++i)
            {
                if (_rowControls[i].ValueEditor == valueEditor)
                {
                    return(i);
                }
            }

            return(-1);
        }
        public override void Update()
        {
            if (_obj != null)
            {
                DesignerPropertyEditor enterActionEditor = GetEditor(_obj, "EnterAction");
                DesignerPropertyEditor exitActionEditor  = GetEditor(_obj, "ExitAction");
                Debug.Check(enterActionEditor != null && exitActionEditor != null);

                enterActionEditor.Enabled = false;
                exitActionEditor.Enabled  = false;
            }
        }
Beispiel #16
0
        void createParEditor(List <ParInfo> pars, Type editorType)
        {
            foreach (ParInfo par in pars)
            {
                Label label = propertyGrid.AddProperty(par.Name, editorType, false);
                label.MouseEnter += new EventHandler(label_MouseEnter);

                DesignerPropertyEditor editor = (DesignerPropertyEditor)label.Tag;
                editor.SetPar(par, SelectedObject);
                editor.MouseEnter      += editor_MouseEnter;
                editor.ValueWasChanged += editor_ValueWasChanged;
            }
        }
Beispiel #17
0
        private void resetType(Type type, bool reset)
        {
            Debug.Check(_property != null);

            if (type == null)
            {
                if (this.typeComboBox.SelectedItem != null)
                {
                    type = Plugin.GetMemberValueType(this.typeComboBox.SelectedItem.ToString());
                    Debug.Check(type != null);

                    if (_isArray)
                    {
                        type = typeof(List <>).MakeGenericType(type);
                    }
                }
            }
            else
            {
                if (_isArray)
                {
                    type = typeof(List <>).MakeGenericType(type);
                }
            }

            if (type != null)
            {
                if (reset)
                {
                    _property.Type       = type;
                    _property.NativeType = Plugin.GetMemberValueTypeName(type);
                }

                if (_valueEditor != null)
                {
                    this.Controls.Remove(_valueEditor);
                    _valueEditor = null;
                }

                if ((_agent != null) && ((_property.IsPar && _property is ParInfo) || _property.IsCustomized))
                {
                    createValueEditor(type);

                    this.valueLabel.Visible = true;
                }
                else
                {
                    this.valueLabel.Visible = false;
                }
            }
        }
        public override void Update()
        {
            if (_obj != null)
            {
                DesignerPropertyEditor binaryOperatorEditor = GetEditor(_obj, "BinaryOperator");
                Debug.Check(binaryOperatorEditor != null);

                Attachments.Attachment attach = _obj as Attachments.Attachment;
                if (attach != null && attach.Node != null && attach.Node.Attachments != null &&
                    attach.Node.Attachments.Count > 0 && attach.Node.Attachments[0] == attach)
                {
                    binaryOperatorEditor.Visible = false;
                }
            }
        }
Beispiel #19
0
        public override void Update(object sender, DesignerPropertyInfo property)
        {
            if (_obj != null)
            {
                DesignerPropertyEditor resultOptionEditor  = GetEditor(_obj, "ResultOption");
                DesignerPropertyEditor resultFunctorEditor = GetEditor(_obj, "ResultFunctor");
                Debug.Check(resultOptionEditor != null && resultFunctorEditor != null);
                if (resultOptionEditor != null && resultFunctorEditor != null)
                {
                    MethodDef method      = GetProperty(_obj, "Method") as MethodDef;
                    MethodDef checkMethod = GetProperty(_obj, "ResultFunctor") as MethodDef;

                    if (method == null || method.NativeReturnType == "behaviac::EBTStatus")
                    {
                        resultOptionEditor.Enabled  = false;
                        resultFunctorEditor.Enabled = false;

                        //ResultOption is set to be SUCCESS by default
                        SetProperty(_obj, "ResultOption", EBTStatus.BT_INVALID);
                    }
                    else
                    {
                        bool   enableMethod = true;
                        object prop         = GetProperty(_obj, "ResultOption");

                        if (prop is EBTStatus)
                        {
                            EBTStatus checkStatusdProp = (EBTStatus)prop;

                            if (EBTStatus.BT_INVALID != checkStatusdProp)
                            {
                                enableMethod = false;
                            }
                        }

                        resultOptionEditor.Enabled  = true;
                        resultFunctorEditor.Enabled = enableMethod;
                    }

                    if (!resultFunctorEditor.Enabled)
                    {
                        SetProperty(_obj, "ResultFunctor", null);
                        resultFunctorEditor.Clear();
                    }
                }
            }
        }
Beispiel #20
0
        void createArrayIndexEditor(string preBlank, MethodDef.Param arrayIndex)
        {
            Type   editorType    = typeof(DesignerParameterComboEnumEditor);
            string arugmentsName = preBlank + "Index";
            bool   bReadonly     = false;
            Label  label         = propertyGrid.AddProperty(arugmentsName, editorType, bReadonly);

            label.MouseEnter += new EventHandler(label_MouseEnter);

            DesignerPropertyEditor editor = (DesignerPropertyEditor)label.Tag;

            editor.Enabled = true;
            editor.SetParameter(arrayIndex, _selectedObject, bReadonly);
            editor.ValueWasAssigned();
            editor.MouseEnter            += editor_MouseEnter;
            editor.DescriptionWasChanged += editor_DescriptionWasChanged;
            editor.ValueWasChanged       += editor_ValueWasChanged;
        }
        public Label AddProperty(string name, Type editorType, bool isReadOnly)
        {
            Label label = new Label();

            label.AutoSize  = false;
            label.Text      = name;
            label.ForeColor = Color.LightGray;
            label.TextAlign = ContentAlignment.MiddleLeft;
            label.Location  = new Point(0, _location);
            propertiesSplitContainer.Panel1.Controls.Add(label);

            Control ctrl = null;

            if (editorType == null)
            {
                ctrl           = new Panel();
                ctrl.Height    = 20;
                ctrl.BackColor = Color.Red;
            }
            else
            {
                DesignerPropertyEditor editor = (DesignerPropertyEditor)editorType.InvokeMember(string.Empty, BindingFlags.CreateInstance, null, null, new object[0]);

                if (isReadOnly)
                {
                    editor.ReadOnly();
                }

                ctrl = editor;
            }

            label.Height  = ctrl.Height;
            label.Tag     = ctrl;
            ctrl.Location = new Point(0, _location);

            propertiesSplitContainer.Panel2.Controls.Add(ctrl);

            _location += ctrl.Height + _padding;
            propertiesSplitContainer.Height = _location - _padding;

            return(label);
        }
Beispiel #22
0
        public override void Update(object sender, DesignerPropertyInfo property)
        {
            if (_obj != null)
            {
                RightValueDef opl     = (RightValueDef)GetProperty(_obj, "Opl");
                bool          bEnable = (opl != null && (opl.Var != null || opl.Method != null));

                DesignerPropertyEditor opEditor = GetEditor(_obj, "Operator");
                if (opEditor != null)
                {
                    opEditor.Enabled = bEnable;
                }

                DesignerPropertyEditor oprEditor = GetEditor(_obj, "Opr");
                if (oprEditor != null)
                {
                    oprEditor.Enabled = bEnable;
                }
            }
        }
Beispiel #23
0
        private void editor_ValueWasChanged(object sender, DesignerPropertyInfo property)
        {
            if (!_isParReady)
            {
                return;
            }

            UndoManager.PreSave();

            DesignerPropertyEditor editor = sender as DesignerPropertyEditor;
            int rowIndex = getRowIndex(null, null, null, editor, null);

            _rootNode.Pars[rowIndex].Variable = editor.GetVariable();

            _rootNode.OnPropertyValueChanged(true);

            UndoManager.Save((Nodes.Behavior)_rootNode);

            UndoManager.PostSave();
        }
Beispiel #24
0
        private DesignerPropertyEditor createValueEditor(Type type)
        {
            Debug.Check(type != null);

            Type editorType = Plugin.InvokeEditorType(type);

            Debug.Check(editorType != null);

            DesignerPropertyEditor editor = (DesignerPropertyEditor)Plugin.CreateInstance(editorType);

            editor.AutoSize         = true;
            editor.Dock             = System.Windows.Forms.DockStyle.Fill;
            editor.Margin           = new System.Windows.Forms.Padding(0);
            editor.Name             = "propertyEditor";
            editor.TabIndex         = 4;
            editor.ValueWasChanged += new DesignerPropertyEditor.ValueChanged(editor_ValueWasChanged);
            editor.SetPar(_parTemp, _rootNode);
            editor.ValueWasAssigned();

            return(editor);
        }
Beispiel #25
0
        void createParamEditor(MethodDef method, bool enable)
        {
            List <MethodDef.Param> parameters = method.Params;

            foreach (MethodDef.Param p in parameters)
            {
                Type   editorType    = typeof(DesignerParameterComboEnumEditor);
                string arugmentsName = "    " + p.DisplayName;
                Label  label         = propertyGrid.AddProperty(arugmentsName, editorType, p.Attribute.HasFlags(DesignerProperty.DesignerFlags.ReadOnly));

                label.MouseEnter += new EventHandler(label_MouseEnter);

                DesignerPropertyEditor editor = (DesignerPropertyEditor)label.Tag;
                editor.Enabled = enable;
                editor.SetParameter(p, _selectedObject);
                editor.ValueWasAssigned();
                editor.MouseEnter            += editor_MouseEnter;
                editor.DescriptionWasChanged += editor_DescriptionWasChanged;
                editor.ValueWasChanged       += editor_ValueWasChanged;
            }
        }
Beispiel #26
0
        public bool SetProperty(BehaviorNode behavior, string valueName, string valueStr)
        {
            DesignerPropertyEditor propertyEditor = getPropertyEditor(valueName);

            if (propertyEditor == null && behavior != null)
            {
                Node root = behavior as Node;

                foreach (PropertyDef p in root.LocalVars)
                {
                    if (!p.IsArrayElement && p.BasicName == valueName)
                    {
                        propertyEditor = addRowControl(p);
                        break;
                    }
                }
            }

            if (propertyEditor == null)
            {
                return(false);
            }

            VariableDef var = propertyEditor.GetVariable();

            if (var.Value.ToString().ToLower() != valueStr.ToLower())
            {
                Plugin.InvokeTypeParser(null, var.ValueType, valueStr, (object value) => var.Value = value, null);

                propertyEditor.ValueWasnotAssigned();

                propertyEditor.SetVariable(var, null);

                propertyEditor.ValueWasAssigned();

                return(true);
            }

            return(false);
        }
Beispiel #27
0
        private DesignerPropertyEditor createPropertyEditor(PropertyDef property)
        {
            Type type       = property.Type;
            Type editorType = Plugin.InvokeEditorType(type);

            Debug.Check(editorType != null);

            DesignerPropertyEditor editor = (DesignerPropertyEditor)editorType.InvokeMember(string.Empty, BindingFlags.CreateInstance, null, null, new object[0]);

            editor.TabStop          = false;
            editor.Dock             = System.Windows.Forms.DockStyle.Fill;
            editor.Margin           = new System.Windows.Forms.Padding(0);
            editor.ValueWasChanged += new DesignerPropertyEditor.ValueChanged(editor_ValueWasChanged);

            VariableDef var = new VariableDef(Plugin.DefaultValue(type));

            editor.SetVariable(var, null);

            editor.ValueWasAssigned();

            return(editor);
        }
Beispiel #28
0
        public override void Update(object sender, DesignerPropertyInfo property)
        {
            if (_obj != null)
            {
                DesignerPropertyEditor oplEditor = GetEditor(_obj, "Opl");
                Debug.Check(oplEditor != null);

                if (oplEditor == sender)
                {
                    VariableDef opl = (VariableDef)GetProperty(_obj, "Opl");

                    if (opl != null)
                    {
                        RightValueDef opr = (RightValueDef)GetProperty(_obj, "Opr");

                        if (opr != null)
                        {
                            if (opl.ValueType != opr.ValueType)
                            {
                                DesignerPropertyEditor oprEditor = GetEditor(_obj, "Opr");
                                Debug.Check(oprEditor != null);
                                if (oprEditor != null)
                                {
                                    oprEditor.Clear();
                                }
                            }
                        }
                    }
                }
                else
                {
                    DesignerPropertyEditor oplEditorCast = GetEditor(_obj, "CastRight");
                    Debug.Check(oplEditorCast != null);

                    if (oplEditorCast == sender)
                    {
                        PluginBehaviac.Nodes.Assignment assignNode = _obj as PluginBehaviac.Nodes.Assignment;

                        if (assignNode != null)
                        {
                            RightValueDef opr = (RightValueDef)GetProperty(_obj, "Opr");

                            if (opr != null)
                            {
                                DesignerPropertyEditor oprEditor = GetEditor(_obj, "Opr");
                                Debug.Check(oprEditor != null);

                                // oprEditor.ValueType might be overwritten in SetupCastSettings if casting
                                // so that here to backup it first so that it can be restored later if not casting
                                if (assignNode.IsCasting)
                                {
                                    _valueTypesBackup = oprEditor.ValueType;
                                }
                                else
                                {
                                    oprEditor.ValueType = _valueTypesBackup;
                                }

                                oprEditor.Clear();
                                oprEditor.FilterType = null;
                            }
                        }
                    }
                }
            }
        }
Beispiel #29
0
        void editor_MouseEnter(object sender, EventArgs e)
        {
            DesignerPropertyEditor editor = (DesignerPropertyEditor)sender;

            propertyGrid.ShowDescription(editor.DisplayName, editor.Description);
        }
Beispiel #30
0
        //private void UpdateProperties(IList<DesignerPropertyInfo> properties, List<MethodDef.Param> parameters, string parametersCategory)
        private void UpdateProperties(IList <DesignerPropertyInfo> properties)
        {
            //Console.WriteLine("UpdateProperties");
            //this.SuspendLayout();

            List <string> categories = new List <string>();

            foreach (DesignerPropertyInfo property in properties)
            {
                if (!property.Attribute.HasFlags(DesignerProperty.DesignerFlags.NoDisplay) &&
                    (property.Attribute.CategoryResourceString != "CategoryVersion" || Settings.Default.ShowVersionInfo) &&
                    !categories.Contains(property.Attribute.CategoryResourceString))
                {
                    categories.Add(property.Attribute.CategoryResourceString);
                }
            }

            categories.Sort();

            Nodes.Node     node           = SelectedObject as Nodes.Node;
            List <ParInfo> pars           = new List <ParInfo>();
            bool           referrencedPar = false;
            NodeUIPolicy   uiPolicy       = null;

            if (node != null)
            {
                node.GetAllPars(ref pars);

                uiPolicy = NodeUIPolicy.CreateUIPolicy(node);
                uiPolicy.Initialize(SelectedObject);
            }
            else
            {
                Attachments.Attach attachment = SelectedObject as Behaviac.Design.Attachments.Attach;
                if (attachment != null)
                {
                    node           = attachment.Node;
                    referrencedPar = true;
                    attachment.GetAllPars(ref pars);

                    uiPolicy = NodeUIPolicy.CreateUIPolicy(attachment);
                    uiPolicy.Initialize(SelectedObject);
                }
            }

            if (pars.Count > 0 && !categories.Contains("CategoryPar"))
            {
                categories.Add("CategoryPar");
            }

            foreach (string category in categories)
            {
                propertyGrid.AddCategory(Plugin.GetResourceString(category), true);

                foreach (DesignerPropertyInfo property in properties)
                {
                    if (!property.Attribute.HasFlags(DesignerProperty.DesignerFlags.NoDisplay) &&
                        property.Attribute.CategoryResourceString == category)
                    {
                        Type  type  = property.Attribute.GetEditorType(property.Property.GetValue(_selectedObject, null));
                        Label label = propertyGrid.AddProperty(property.Attribute.DisplayName, type, property.Attribute.HasFlags(DesignerProperty.DesignerFlags.ReadOnly));

                        // register description showing
                        label.MouseEnter += new EventHandler(label_MouseEnter);

                        // when we found an editor we connect it to the object
                        if (type != null)
                        {
                            DesignerPropertyEditor editor = (DesignerPropertyEditor)label.Tag;
                            editor.SetRootNode((Nodes.Node) this._rootBehavior);
                            editor.SetProperty(property, _selectedObject);
                            editor.ValueWasAssigned();
                            editor.MouseEnter            += editor_MouseEnter;
                            editor.DescriptionWasChanged += editor_DescriptionWasChanged;
                            editor.ValueWasChanged       += editor_ValueWasChanged;

                            if (uiPolicy != null)
                            {
                                uiPolicy.AddEditor(editor);
                            }
                        }

                        MethodDef          method             = null;
                        bool               methodEditorEnable = true;
                        DesignerMethodEnum propertyMethod     = property.Attribute as DesignerMethodEnum;
                        if (propertyMethod != null)
                        {
                            if (propertyMethod.MethodType != MethodType.Status)
                            {
                                method             = property.Property.GetValue(_selectedObject, null) as MethodDef;
                                methodEditorEnable = (propertyMethod.MethodType != MethodType.Event);
                            }
                        }
                        else
                        {
                            DesignerRightValueEnum propertyRV = property.Attribute as DesignerRightValueEnum;
                            if (propertyRV != null)
                            {
                                RightValueDef rv = property.Property.GetValue(_selectedObject, null) as RightValueDef;
                                if (rv != null && rv.IsMethod)
                                {
                                    method = rv.Method;
                                }
                            }
                        }

                        if (method != null)
                        {
                            createParamEditor(method, methodEditorEnable);
                        }
                    }
                }

                if (pars.Count > 0 && "CategoryPar" == category)
                {
                    createParEditor(pars, referrencedPar ? typeof(DesignerParComboEnumEditor) : typeof(DesignerParEditor));
                }
            }

            if (uiPolicy != null)
            {
                uiPolicy.Update();
            }

            //this.ResumeLayout(false);
        }