/// <inheritdoc />
        protected override bool TryToManuallyUpdateCachedValueFromMember(int memberIndex, object memberValue, LinkedMemberInfo memberLinkedMemberInfo)
        {
                        #if DEV_MODE
            Debug.Log(ToString() + ".TryToManuallyUpdateCachedValueFromMember memberIndex=" + memberIndex + ", memberValue=" + StringUtils.ToColorizedString(memberValue));
                        #endif

            var currentValue = Value;

            if (currentValue == null)
            {
                if (memberIndex == 1)
                {
                    OnUnityObjectTargetChanged(memberValue as Object);
                }
            }
            else if (currentValue.Target is Object)
            {
                if (memberIndex == 0)
                {
                    OnUnityObjectTargetChanged(memberValue as Object);
                }
                else if (memberIndex == 1)
                {
                    OnSelectedMethodChanged((int)memberValue);
                }
            }
            else
            {
                if (memberIndex == 1)
                {
                    var target = currentValue.Target;
                    OnTargetTypeChanged(memberValue as Type, target != null, target);
                }
                else if (memberIndex == 2)
                {
                    OnSelectedMethodChanged((int)memberValue);
                }
            }

            return(true);
        }
 /// <inheritdoc />
 protected override void Setup(string setValue, Type setValueType, LinkedMemberInfo setMemberInfo, IParentDrawer setParent, GUIContent setLabel, bool setReadOnly)
 {
     base.Setup(setValue, setValueType, setMemberInfo, setParent, setLabel, true);
 }
 /// <inheritdoc />
 public override void SetupInterface(object setValue, Type setValueType, LinkedMemberInfo setMemberInfo, IParentDrawer setParent, GUIContent setLabel, bool setReadOnly)
 {
     Setup((LayerMask)setValue, setValueType, setMemberInfo, setParent, setLabel, setReadOnly);
 }
 /// <inheritdoc />
 protected override void Setup(int setValue, Type setValueType, LinkedMemberInfo setMemberInfo, IParentDrawer setParent, GUIContent setLabel, bool setReadOnly)
 {
     valueUnapplied = setValue;
     base.Setup(setValue, setValueType, setMemberInfo, setParent, setLabel, setReadOnly);
 }
Exemple #5
0
		/// <inheritdoc/>
		public override void OnSiblingValueChanged(int memberIndex, object memberValue, [CanBeNull] LinkedMemberInfo memberLinkedMemberInfo)
		{
			UpdateTargetDrawerShowInInspector();
			base.OnSiblingValueChanged(memberIndex, memberValue, memberLinkedMemberInfo);
		}
        /// <inheritdoc />
        public override void OnMemberValueChanged(int memberIndex, object memberValue, LinkedMemberInfo memberLinkedMemberInfo)
        {
                        #if DEV_MODE && PI_ASSERTATIONS
            Assert(members[memberIndex].GetType() != typeof(NullToggleDrawer), ToString(), ".OnMemberValueChanged: value of NullToggleDrawer changed somehow.");
                        #endif

            var referenceValue = memberValue as Object;
            if (referenceValue != null)
            {
                if (IsValidUnityObjectValue(referenceValue))
                {
                    InspectorUtility.ActiveInspector.OnNextLayout(() =>
                    {
                        Value = referenceValue;
                    });
                }
            }
            else
            {
                // don't apply to field, because should already be applied by the member if can be applied
                DoSetValue(memberValue, false, false);

                                #if DEV_MODE && PI_ASSERTATIONS
                Debug.Assert(memberLinkedMemberInfo != null || memberInfo == null);
                                #endif
            }

            if (parent != null)
            {
                parent.OnMemberValueChanged(Array.IndexOf(parent.Members, this), memberValue, memberLinkedMemberInfo);
            }
            UpdateDataValidity(true);
            HasUnappliedChanges = GetHasUnappliedChangesUpdated();
        }
        public string GetTooltip([NotNull] LinkedMemberInfo linkedInfo)
        {
            var memberInfo = linkedInfo.MemberInfo;

            string tooltip;

            if (memberInfo == null)
            {
                var parameterInfo = linkedInfo.ParameterInfo;
                if (parameterInfo != null)
                {
                    var parent = linkedInfo.Parent;
                    if (parent == null)
                    {
                                                #if DEV_MODE && DEBUG_GET_TOOLTIP
                        Debug.Log(linkedInfo + " can't have tooltip because had no parent.");
                                                #endif

                        return("");
                    }
                    return(GetTooltipFromParent(parameterInfo, parent, linkedInfo.DisplayName));
                }

                                #if DEV_MODE && DEBUG_GET_TOOLTIP
                Debug.Log(linkedInfo + " can't have tooltip because had no MemberInfo and was not a parameter.");
                                #endif

                return("");
            }

            if (memberTooltips.TryGetValue(memberInfo, out tooltip))
            {
                                #if DEV_MODE && DEBUG_GET_TOOLTIP
                Debug.Log(linkedInfo + " cached tooltip: \"" + tooltip + "\"");
                                #endif
                return(tooltip);
            }

            var tooltipAttribute = linkedInfo.GetAttribute <TooltipAttribute>();
            if (tooltipAttribute != null)
            {
                tooltip = tooltipAttribute.tooltip;
                memberTooltips.Add(memberInfo, tooltip);
                                #if DEV_MODE && DEBUG_GET_TOOLTIP
                Debug.Log(linkedInfo + " tooltip from TooltipAttribute: \"" + tooltip + "\"");
                                #endif
                return(tooltip);
            }

            Dictionary <string, string> tooltips;
            var memberName = memberInfo.Name;

            // Try finding tooltip via parent LinkedMemberInfos types
            for (var parent = linkedInfo.Parent; parent != null; parent = parent.Parent)
            {
                tooltips = GetMemberTooltips(parent.Type);
                if (TryGetTooltip(tooltips, memberName, out tooltip))
                {
                    memberTooltips.Add(memberInfo, tooltip);

                                        #if DEV_MODE && DEBUG_GET_TOOLTIP
                    if (tooltip.Length > 0)
                    {
                        Debug.Log(linkedInfo + " tooltip from xml docs via parent " + parent.Type + ": \"" + tooltip + "\"");
                    }
                    else
                    {
                        Debug.Log(linkedInfo + " no tooltip found.");
                    }
                                        #endif

                    return(tooltip);
                }
            }

            // Try finding tooltip via UnityEngine.Object target type.
            // NOTE: Doing this even if LinkedMemberInfo has parent LinkedMemberInfos, because it's possible that
            // there's another class defined inside a script file that also defines the target UnityEngine.Object class.
            var unityObject = linkedInfo.Hierarchy.Target;
            if (unityObject != null)
            {
                tooltips = GetMemberTooltips(unityObject);
                if (TryGetTooltip(tooltips, memberName, out tooltip))
                {
                    memberTooltips.Add(memberInfo, tooltip);

                                        #if DEV_MODE && DEBUG_GET_TOOLTIP
                    if (tooltip.Length > 0)
                    {
                        Debug.Log(linkedInfo + " tooltip from xml docs via UnityObject " + unityObject.GetType().Name + ": \"" + tooltip + "\"");
                    }
                    else
                    {
                        Debug.Log(linkedInfo + " no tooltip found.");
                    }
                                        #endif

                    return(tooltip);
                }
            }

                        #if DEV_MODE && PI_ASSERTATIONS
            Debug.Assert(string.IsNullOrEmpty(tooltip));
                        #endif

            memberTooltips.Add(memberInfo, "");

                        #if DEV_MODE && DEBUG_GET_TOOLTIP
            Debug.Log(linkedInfo + " no tooltip found.");
                        #endif

            return("");
        }
Exemple #8
0
        /// <inheritdoc/>
        protected override bool TryToManuallyUpdateCachedValueFromMember(int memberIndex, object memberValue, LinkedMemberInfo memberLinkedMemberInfo)
        {
            var setSize = Value;

            if (memberIndex == 0)
            {
                Size2D.SetHeight(ref setSize, (int)memberValue);
            }
            else
            {
                Size2D.SetWidth(ref setSize, (int)memberValue);
            }
            Value = setSize;

            return(true);
        }
 /// <inheritdoc/>
 protected sealed override void Setup(LinkedMemberInfo setMemberInfo, IParentDrawer setParent, GUIContent setPrefixLabel, GUIContent setButtonLabel, bool setReadOnly)
 {
     throw new NotSupportedException("Please use the other Setup method.");
 }
Exemple #10
0
 /// <inheritdoc cref="IFieldDrawer.SetupInterface" />
 public override void SetupInterface(object setValue, Type setValueType, LinkedMemberInfo setMemberInfo, IParentDrawer setParent, GUIContent setLabel, bool setReadOnly)
 {
     Setup(setValue as string, setMemberInfo, setParent, setLabel, setReadOnly, setMemberInfo != null && setMemberInfo.GetAttribute <TextAreaAttribute>() != null, setMemberInfo != null && setMemberInfo.GetAttribute <DelayedAttribute>() != null);
 }
Exemple #11
0
        protected virtual void Setup(string setValue, LinkedMemberInfo setMemberInfo, IParentDrawer setParent, GUIContent setLabel, bool setReadOnly, bool setTextArea, bool setDelayed)
        {
                        #if DEV_MODE
            if (setValue == null)
            {
                Debug.LogWarning(ToString(setLabel, setMemberInfo) + ".Setup called with null value");
            }
                        #endif

            base.Setup(setValue, typeof(string), setMemberInfo, setParent, setLabel, setReadOnly);

            delayed = setDelayed;

            PrefixResizeUtility.OnPrefixResizingFinished += OnPrefixResizingFinished;

            var inspector = InspectorUtility.ActiveInspector;
            inspector.State.OnWidthChanged += UpdateDynamicHeight;

            parentDrawnInSingleRow = setParent != null && setParent.DrawInSingleRow;

                        #if DEV_MODE && PI_ASSERTATIONS
            inspector.OnNextLayout(() => Debug.Assert(parentDrawnInSingleRow == (setParent != null && setParent.DrawInSingleRow), ToString() + ".parentDrawnInSingleRow was " + parentDrawnInSingleRow + " but now is " + (setParent == null ? "null" : setParent.DrawInSingleRow.ToString())));
                        #endif

            if (parentDrawnInSingleRow)
            {
                textArea            = false;
                forceAlwaysTextArea = false;

                textFieldHeight = TextFieldHeightDeterminant.Constant;
            }
            else
            {
                // if parent is a collection and has the TextArea attribute, then set this as text area
                var parentCollection = setParent as ICollectionDrawer;
                if (parentCollection != null)
                {
                    var parentMemberInfo = parent.MemberInfo;
                    if (parentMemberInfo != null)
                    {
                        var parentTextAreaAttribute = parentMemberInfo.GetAttribute <TextAreaAttribute>();
                        if (parentTextAreaAttribute != null)
                        {
                            setTextArea = true;
                        }
                    }
                }
                forceAlwaysTextArea = setTextArea;
                textArea            = setTextArea;

                textFieldHeight = inspector.Preferences.textFieldHeight;
            }

            if (textFieldHeight == TextFieldHeightDeterminant.Constant)
            {
                alwaysSingleLineHeight = !textArea;
                height = MinHeight;
            }
            else
            {
                alwaysSingleLineHeight = false;
                if (textFieldHeight == TextFieldHeightDeterminant.WordWrapping)
                {
                    height = MinHeight;
                }
                UpdateDynamicHeightWhenReady();
            }
        }
Exemple #12
0
        /// <inheritdoc />
        public void SetupInterface(PropertyAttribute propertyAttribute, Type decoratorDrawerType, IParentDrawer setParent, LinkedMemberInfo attributeTarget)
        {
            var header = (HeaderAttribute)propertyAttribute;

            Setup(header.header, setParent);
        }
 /// <inheritdoc />
 protected override void Setup([CanBeNull] Delegate setValue, [NotNull] Type setValueType, [CanBeNull] LinkedMemberInfo setMemberInfo, [CanBeNull] IParentDrawer setParent, [CanBeNull] GUIContent setLabel, bool setReadOnly)
 {
     delegateType = setValueType;
     OnDelegateValueChanged(setValue);
     base.Setup(setValue, setValueType, setMemberInfo, setParent, setLabel, setReadOnly);
 }
        /// <inheritdoc />
        public override void SetupInterface(object setValue, Type setValueType, LinkedMemberInfo setMemberInfo, IParentDrawer setParent, GUIContent setLabel, bool setReadOnly)
        {
            var delegateValue = (Delegate)setValue;

            Setup(delegateValue, setValueType, null, setParent, setLabel, setReadOnly);
        }
 /// <inheritdoc/>
 protected override void Setup(TimeSpan setValue, Type setValueType, LinkedMemberInfo setMemberInfo, IParentDrawer setParent, GUIContent setLabel, bool setReadOnly)
 {
     base.Setup(setValue, setValueType, setMemberInfo, setParent, setLabel, setReadOnly);
     asString = StringUtils.ToString(Value);
 }
Exemple #16
0
 /// <inheritdoc/>
 public sealed override void SetupInterface(object setValue, Type setValueType, LinkedMemberInfo setMemberInfo, IParentDrawer setParent, GUIContent setLabel, bool setReadOnly)
 {
     throw new NotSupportedException("Please use Create method.");
 }
 /// <inheritdoc/>
 protected override bool TryToManuallyUpdateCachedValueFromMember(int memberIndex, object memberValue, LinkedMemberInfo memberLinkedMemberInfo)
 {
     // updating value from changing member is already handled by onValueChanged callbacks
     return(true);
 }
Exemple #18
0
        /// <inheritdoc />
        public sealed override void OnMemberValueChanged(int memberIndex, object memberValue, LinkedMemberInfo memberLinkedMemberInfo)
        {
            base.OnMemberValueChanged(memberIndex, memberValue, memberLinkedMemberInfo);

            if (Mouseovered)
            {
                UpdateTooltips();
            }
        }
        /// <summary>
        /// Given a non-abstract explicitly chosen type, returns the drawer for the value of the drawer using said type.
        /// </summary>
        /// <param name="setType"> Type of value. </param>
        /// <param name="setValue"> Initial value. Can be null. </param>
        /// <param name="setMemberInfo"> Linked member info for class member which the drawer represents. </param>
        /// <param name="setParent"> Parent for the drawer. </param>
        /// <param name="setLabel"> Label for the drawer. </param>
        /// <param name="setReadOnly"> If true drawer should be greted out and its value should not be editable. </param>
        /// <returns> Drawer instance to use for the value. </returns>
        protected virtual IDrawer BuildDrawerForValue(Type setType, [CanBeNull] object setValue, [CanBeNull] LinkedMemberInfo setMemberInfo, [NotNull] IParentDrawer setParent, [CanBeNull] GUIContent setLabel, bool setReadOnly)
        {
                        #if DEV_MODE && PI_ASSERTATIONS
            Debug.Assert(setType != null || setValue != null || setMemberInfo != null);
            Debug.Assert(setMemberInfo == memberInfo);
            Debug.Assert(setParent == this);
            Debug.Assert(setType != base.Type, ToString() + " - setType " + StringUtils.ToString(setType) + " equals base.Type " + StringUtils.ToString(base.Type));
                        #endif

            return(DrawerProvider.GetForField(setValue, setType, setMemberInfo, setParent, setLabel, setReadOnly));
        }
Exemple #20
0
        /// <inheritdoc/>
        protected override bool TryToManuallyUpdateCachedValueFromMember(int memberIndex, object memberValue, LinkedMemberInfo memberLinkedMemberInfo)
        {
                        #if DEV_MODE && DEBUG_UPDATE_CACHED_VALUES
            Debug.Log(ToString() + ".TryToManuallyUpdateCachedValueFromMember(" + memberIndex + ", " + StringUtils.ToString((float)memberValue) + ") with Value=" + StringUtils.ToString(Value) + ", GetValue(0)=" + StringUtils.ToString(GetValue(0)));
                        #endif

            var setValue = Value;
            try
            {
                setValue[memberIndex] = (float)memberValue;
            }
                        #if DEV_MODE
            catch (IndexOutOfRangeException e)
            {
                Debug.LogError(e);
                        #else
            catch (IndexOutOfRangeException)
            {
                        #endif
                return(false);
            }
                        #if DEV_MODE
            catch (InvalidCastException e)
            {
                Debug.LogError(e);
                        #else
            catch (InvalidCastException)
            {
                        #endif
                return(false);
            }
            DoSetValue(setValue, false, false);
            return(true);
        }
 /// <inheritdoc />
 public void SetupInterface(object attribute, object setValue, LinkedMemberInfo setMemberInfo, IParentDrawer setParent, GUIContent setLabel, bool setReadOnly)
 {
     Setup((int)setValue, typeof(int), setMemberInfo, setParent, setLabel, setReadOnly);
 }
Exemple #22
0
        public static PropertyDrawerDrawer Create(object value, UnityEditor.PropertyDrawer drawerInstance, Type drawerType, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool setReadOnly)
        {
            if (memberInfo == null)
            {
                                #if DEV_MODE
                Debug.LogError("PropertyDrawerDrawer.Create(drawerType=" + drawerType.Name + ", parent=" + StringUtils.ToString(parent) + ", label=" + (label == null ? "null" : label.text) + "), returning null because fieldInfo was null");
                                #endif
                return(null);
            }

            if (memberInfo.SerializedProperty == null)
            {
                                #if DEV_MODE
                Debug.LogError("PropertyDrawerDrawer.Create(drawerType=" + drawerType.Name + ", parent=" + StringUtils.ToString(parent) + ", label=" + (label == null ? "null" : label.text) + "), returning null because fieldInfo.SerializedProperty was null");
                                #endif
                return(null);
            }

            PropertyDrawerDrawer result;
            if (!DrawerPool.TryGet(out result))
            {
                result = new PropertyDrawerDrawer();
            }
            result.Setup(value, drawerInstance, drawerType, memberInfo, parent, label, setReadOnly);
            result.LateSetup();
            return(result);
        }
Exemple #23
0
 /// <inheritdoc/>
 protected sealed override void Setup(TValue setValue, Type setValueType, LinkedMemberInfo setMemberInfo, IParentDrawer setParent, GUIContent setLabel, bool setReadOnly)
 {
     throw new NotSupportedException("Please use the other Setup method");
 }
Exemple #24
0
 /// <inheritdoc cref="IFieldDrawer.SetupInterface" />
 public override void SetupInterface(object setValue, Type setValueType, LinkedMemberInfo setMemberInfo, IParentDrawer setParent, GUIContent setLabel, bool setReadOnly)
 {
     SetupInterface(setMemberInfo.GetAttribute <PropertyAttribute>(), setValue, setMemberInfo, setParent, setLabel, setReadOnly);
 }
Exemple #25
0
		/// <inheritdoc />
		public void SetupInterface(PropertyAttribute propertyAttribute, Type decoratorDrawerType, IParentDrawer setParent, LinkedMemberInfo attributeTarget)
		{
			if(decoratorDrawerType == null)
			{
				throw new NotSupportedException(GetType().Name + " requires a decoratorDrawerType to be provided.");
			}
			Setup(propertyAttribute, decoratorDrawerType, null, setParent);
		}
Exemple #26
0
        private void Setup(object setValue, [CanBeNull] UnityEditor.PropertyDrawer setDrawerInstance, [NotNull] Type drawerType, LinkedMemberInfo setMemberInfo, IParentDrawer setParent, GUIContent setLabel, bool setReadOnly)
        {
                        #if DEV_MODE && PI_ASSERTATIONS
            Debug.Assert(drawerType != null);
                        #endif

            if (setDrawerInstance == null)
            {
                setDrawerInstance = (UnityEditor.PropertyDrawer)drawerType.CreateInstance();
            }
            drawerInstance = setDrawerInstance;

                        #if DEV_MODE && PI_ASSERTATIONS
            Debug.Assert(drawerInstance != null, "Failed to create PropertyDrawer instance of type " + StringUtils.ToString(drawerType) + " for field of type " + StringUtils.ToString(DrawerUtility.GetType(setMemberInfo, setValue)) + " and attribute " + StringUtils.TypeToString(setMemberInfo == null ? null : setMemberInfo.GetAttribute <PropertyAttribute>()));
                        #endif

            memberInfo = setMemberInfo;

            var serializedProperty = SerializedProperty;
            if (serializedProperty != null)
            {
                // This is not fool-proof, because e.g. a custom property might use a foldout drawer
                // but could not figure out a better solution yet
                usesFoldout = serializedProperty.isArray;
            }
            else
            {
                usesFoldout = false;
            }

            var attField = drawerType.GetField("m_Attribute", BindingFlags.Instance | BindingFlags.NonPublic);

            if (setMemberInfo != null)
            {
                var atts = setMemberInfo.GetAttributes(Types.PropertyAttribute);
                if (atts.Length > 0)
                {
                    attField.SetValue(drawerInstance, atts[0]);
                }

                attField = drawerType.GetField("m_FieldInfo", BindingFlags.Instance | BindingFlags.NonPublic);
                attField.SetValue(drawerInstance, setMemberInfo.FieldInfo);
            }
            else
            {
                Debug.LogError("PropertyDrawerDrawer(\"" + (setLabel != null ? setLabel.text : "") + "\").Setup(" + drawerType.Name + ") - fieldInfo was null (parent=" + StringUtils.ToString(setParent) + ")");
            }

            base.Setup(setValue, DrawerUtility.GetType(setMemberInfo, setValue), setMemberInfo, setParent, setLabel, setReadOnly);
        }
 public static IntRangeDrawer Create(int value, RangeAttribute range, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool setReadOnly)
 {
     return(Create(value, Mathf.Ceil(range.min), Mathf.Floor(range.max), memberInfo, parent, label, setReadOnly));
 }
        /// <inheritdoc/>
        public override IDrawer GetForField([CanBeNull] object value, [NotNull] Type fieldType, [CanBeNull] LinkedMemberInfo memberInfo, [CanBeNull] IParentDrawer parent, [CanBeNull] GUIContent label, bool readOnly)
        {
            if (fieldType == Types.Float)
            {
                if (parent != null && typeof(TransformMemberBaseDrawer).IsAssignableFrom(parent.GetType()))
                {
                    return(base.GetForField(typeof(TransformFloatDrawer), value, fieldType, memberInfo, parent, label, readOnly));
                }
            }
            else if (fieldType == Types.Vector3)
            {
                                #if DEV_MODE && PI_ASSERTATIONS
                Debug.Assert(typeof(ITransformDrawer).IsAssignableFrom(typeof(TransformDrawer)));
                                #endif

                if (parent != null && typeof(ITransformDrawer).IsAssignableFrom(parent.GetType()) && memberInfo != null)
                {
                    switch (memberInfo.Name)
                    {
                    case "position":
                        return(base.GetForField(typeof(PositionDrawer), value, fieldType, memberInfo, parent, label, readOnly));

                    case "rotation":
                        return(base.GetForField(typeof(RotationDrawer), value, fieldType, memberInfo, parent, label, readOnly));

                    case "scale":
                        return(base.GetForField(typeof(ScaleDrawer), value, fieldType, memberInfo, parent, label, readOnly));
                    }
                                        #if DEV_MODE
                    Debug.LogError("TransformDrawerProvider failed to figure out proper drawer type for TransformDrawer member");
                                        #endif
                }
            }

            return(base.GetForField(value, fieldType, memberInfo, parent, label, readOnly));
        }
Exemple #29
0
        /// <inheritdoc />
        public virtual void OnMemberValueChanged(int memberIndex, object memberValue, LinkedMemberInfo memberLinkedMemberInfo)
        {
                        #if DEV_MODE && DEBUG_ON_MEMBER_VALUE_CHANGED
            Debug.Log(StringUtils.ToColorizedString(ToString(), ".OnMemberValueChanged(index=", StringUtils.ToString(memberIndex), ", value=", memberValue, ") with inactive=", inactive, ", memberLinkedMemberInfo.CanRead = " + (memberLinkedMemberInfo == null ? StringUtils.Null : StringUtils.ToColorizedString(memberLinkedMemberInfo.CanRead))));
                        #endif

            UpdateDataValidity();

            if (OnValueChanged != null)
            {
                OnValueChanged(this, ReadOnly ? null : GetValue(0));
            }

            for (int n = members.Length - 1; n >= 0; n--)
            {
                if (n != memberIndex)
                {
                    members[n].OnSiblingValueChanged(memberIndex, memberValue, memberLinkedMemberInfo);
                }
            }

            if (parent != null)
            {
                parent.OnMemberValueChanged(Array.IndexOf(parent.Members, this), GetValue(0), memberLinkedMemberInfo);
            }
        }
 /// <inheritdoc/>
 protected override void Setup(object setValue, Type setValueType, LinkedMemberInfo setMemberInfo, IParentDrawer setParent, GUIContent setLabel, bool setReadOnly)
 {
     throw new InvalidOperationException("Please use the other Setup method.");
 }