private void setEditor(DesignerPropertyEditor editor, string valueType)
        {
            if (editor == null)
            {
                return;
            }

            if (valueType == VariableDef.kConst)
            {
                if (_param.Value != null && (_param.Value is VariableDef || _param.Value is PropertyDef || _param.Value is ParInfo))
                {
                    if (!(_param.IsFromStruct))
                    {
                        _param.Value = Plugin.DefaultValue(_param.Type);
                    }
                    else
                    {
                        if (_param.Value is VariableDef)
                        {
                            VariableDef v = _param.Value as VariableDef;
                            _param.Value = Plugin.DefaultValue(v.GetValueType());
                        }
                        else if (_param.Value is ParInfo)
                        {
                            ParInfo v = _param.Value as ParInfo;
                            _param.Value = Plugin.DefaultValue(v.Variable.GetValueType());
                        }
                    }
                }
            }
            else
            {
                DesignerPropertyEnumEditor propertyEnumEditor = editor as DesignerPropertyEnumEditor;

                if (_param.Value is VariableDef)
                {
                    VariableDef v = _param.Value as VariableDef;

                    if (v.ValueClass != valueType)
                    {
                        Type t1 = v.GetValueType() != null?v.GetValueType() : _param.Type;

                        object dv = Plugin.DefaultValue(t1);
                        _param.Value = new VariableDef(dv, valueType);
                    }

                    propertyEnumEditor.FilterType = (v.GetValueType() != null ? v.GetValueType() : _param.Type);
                }
                else if (_param.Value is ParInfo)
                {
                    ParInfo v = _param.Value as ParInfo;

                    if (v.Variable.ValueClass != valueType)
                    {
                        object dv = Plugin.DefaultValue(v.Variable.GetValueType());
                        _param.Value = new VariableDef(dv, valueType);
                    }

                    propertyEnumEditor.FilterType = v.Variable.GetValueType();
                }
                else
                {
                    _param.Value = new VariableDef(_param.Value, valueType);
                    propertyEnumEditor.FilterType = _param.Type;
                }
            }

            editor.SetParameter(_param, _object, false);

            editor.ValueWasAssigned();
            editor.ValueWasChanged += editor_ValueWasChanged;
        }
        private void setEditor(DesignerPropertyEditor editor, string valueType)
        {
            if (editor == null)
            {
                return;
            }

            if (valueType == VariableDef.kConst)
            {
                if (_param.Value != null && (_param.Value is VariableDef || _param.Value is PropertyDef || _param.Value is ParInfo))
                {
                    if (!(_param.IsFromStruct))
                    {
                        _param.Value = Plugin.DefaultValue(_param.Type);
                    }
                    else
                    {
                        if (_param.Value is VariableDef)
                        {
                            VariableDef v = _param.Value as VariableDef;

                            _param.Value = Plugin.DefaultValue(v.GetValueType());
                        }
                        else if (_param.Value is ParInfo)
                        {
                            ParInfo v = _param.Value as ParInfo;

                            _param.Value = Plugin.DefaultValue(v.Variable.GetValueType());
                        }
                    }
                }
            }
            else if (valueType == VariableDef.kPar)
            {
                if (_param.IsFromStruct)
                {
                    if (!(_param.Value is ParInfo) && !(_param.Value is VariableDef))
                    {
                        ParInfo par = new ParInfo(this._root);

                        par.Name     = _param.Attribute.DisplayName;
                        par.TypeName = _param.Type.FullName;

                        par.Variable = new VariableDef(_param.Value, VariableDef.kPar);

                        _param.Value = par;
                    }
                    else
                    {
                        if (_param.Value is VariableDef)
                        {
                            VariableDef v = _param.Value as VariableDef;
                            if (v.ValueClass != valueType)
                            {
                                Type t1 = v.GetValueType() != null?v.GetValueType() : _param.Type;

                                object dv = Plugin.DefaultValue(t1);
                                _param.Value = new VariableDef(dv, valueType);
                            }
                        }
                    }
                }
            }
            else
            {
                if (!_param.IsFromStruct)
                {
                    if (valueType == VariableDef.kSelf)
                    {
                        DesignerPropertyEnumEditor propertyEnumEditor = editor as DesignerPropertyEnumEditor;
                        propertyEnumEditor.GlobalType = null;
                        propertyEnumEditor.FilterType = _param.Type;
                    }
                    else
                    {
                        DesignerPropertyEnumEditor propertyEnumEditor = editor as DesignerPropertyEnumEditor;
                        propertyEnumEditor.GlobalType = valueType;
                        propertyEnumEditor.FilterType = _param.Type;
                    }
                }
                else
                {
                    DesignerPropertyEnumEditor propertyEnumEditor = editor as DesignerPropertyEnumEditor;

                    if (valueType == VariableDef.kSelf)
                    {
                        propertyEnumEditor.GlobalType = null;
                    }
                    else
                    {
                        propertyEnumEditor.GlobalType = valueType;
                    }

                    if (_param.Value is VariableDef)
                    {
                        VariableDef v = _param.Value as VariableDef;
                        if (v.ValueClass != valueType)
                        {
                            Type t1 = v.GetValueType() != null?v.GetValueType() : _param.Type;

                            object dv = Plugin.DefaultValue(t1);
                            _param.Value = new VariableDef(dv, valueType);
                        }

                        propertyEnumEditor.FilterType = (v.GetValueType() != null ? v.GetValueType() : _param.Type);
                    }
                    else if (_param.Value is ParInfo)
                    {
                        ParInfo v = _param.Value as ParInfo;
                        if (v.Variable.ValueClass != valueType)
                        {
                            object dv = Plugin.DefaultValue(v.Variable.GetValueType());
                            _param.Value = new VariableDef(dv, valueType);
                        }

                        propertyEnumEditor.FilterType = v.Variable.GetValueType();
                    }
                    else
                    {
                        _param.Value = new VariableDef(_param.Value, valueType);
                        propertyEnumEditor.FilterType = _param.Type;
                    }
                }
            }

            editor.SetParameter(_param, _object);

            editor.ValueWasAssigned();
            editor.ValueWasChanged += editor_ValueWasChanged;
        }