public DefaultEdit(T receiver, EditHandle <T> redo, DefaultEditParams redoParams, EditHandle <T> undo, DefaultEditParams undoParams)
 {
     this.receiver   = receiver;
     this.RedoParams = redoParams;
     this.UndoParams = undoParams;
     this.undo       = undo;
     this.redo       = redo;
 }
示例#2
0
        private static void ChangeRiskLevel(Object receiver, DefaultEditParams editParams)
        {
            PropertyEditParameters parm = editParams as PropertyEditParameters;

            if (parm != null)
            {
                ((IRiskLevelObject)receiver).RiskLevel = (int)parm.Value;
            }
        }
示例#3
0
        private static void ChangeState(object receiver, DefaultEditParams editParams)
        {
            PropertyEditParameters parm = editParams as PropertyEditParameters;

            if (parm != null)
            {
                ((IStateObject)receiver).CurrentState = (State)parm.Value;
            }
        }
示例#4
0
        private static void RemoveStdCombination(IStdCombinationsBean receiver, DefaultEditParams editParams)
        {
            RelationEditParameters rep = editParams as RelationEditParameters;

            if (rep == null)
            {
                return;
            }
            receiver.RemoveStdCombination((StdCombination)rep.Related);
        }
示例#5
0
        private static void RemoveTestCase(ITestCasesBean receiver, DefaultEditParams editParams)
        {
            RelationEditParameters rep = editParams as RelationEditParameters;

            if (rep == null)
            {
                return;
            }
            receiver.RemoveTestCase((TestCase)rep.Related);
        }
示例#6
0
        private static void RemoveDependency(IDependencyBean receiver, DefaultEditParams editParams)
        {
            RelationEditParameters rep = editParams as RelationEditParameters;

            if (rep == null)
            {
                return;
            }
            receiver.RemoveDependency((Dependency)rep.Related);
        }
示例#7
0
        private static void RemoveExpectedResult(Effect receiver, DefaultEditParams editParams)
        {
            RelationEditParameters rep = editParams as RelationEditParameters;

            if (rep == null)
            {
                return;
            }
            receiver.RemoveExpectedResult((ExpectedResult)rep.Related);
        }
示例#8
0
        private static void RemoveRequirement(IRequirementsBean receiver, DefaultEditParams editParams)
        {
            RelationEditParameters rep = editParams as RelationEditParameters;

            if (rep == null)
            {
                return;
            }
            receiver.RemoveRequirement((Requirement)rep.Related);
        }
示例#9
0
        private static void AddEffect(IEffectsBean receiver, DefaultEditParams editParams)
        {
            RelationEditParameters rep = editParams as RelationEditParameters;

            if (rep == null)
            {
                return;
            }
            receiver.AddEffect((Effect)rep.Related);
        }
示例#10
0
        private static void RemoveEquivalenceClass(IEquivalenceClassesBean receiver, DefaultEditParams editParams)
        {
            RelationEditParameters rep = editParams as RelationEditParameters;

            if (rep == null)
            {
                return;
            }
            receiver.RemoveEquivalenceClass((EquivalenceClass)rep.Related);
        }
示例#11
0
        private static void ChangeProperty(object receiver, DefaultEditParams editParams)
        {
            PropertyEditParameters dep = editParams as PropertyEditParameters;

            if (dep == null)
            {
                return;
            }
            Type         type  = receiver.GetType();
            PropertyInfo pinfo = type.GetProperty(dep.PropertyName);

            pinfo.SetValue(receiver, dep.Value, null);
        }
示例#12
0
        private static void AddObject(object receiver, DefaultEditParams editParams)
        {
            RelationEditParameters rep = editParams as RelationEditParameters;

            if (rep == null)
            {
                return;
            }
            // the method works only if the relation of the related is defined by a method called "Add[related.Type]"
            Type       type        = receiver.GetType();
            Type       relatedType = rep.Related.GetType();
            MethodInfo minfo       = type.GetMethod("Add" + relatedType.Name);

            if (minfo == null)
            {
                return;
            }
            object[] param = new object[1];
            param[0] = rep.Related;
            minfo.Invoke(receiver, param);
        }
 public void SetRelatedObject(object related)
 {
     UndoParams = new RelationEditParameters(related);
     RedoParams = new RelationEditParameters(related);
 }