示例#1
0
        /// <summary>
        ///     Returns the update of the enclosing state in the dictionary.
        ///     If it cannot be found, it is created.
        /// </summary>
        /// <param name="dictionary"></param>
        /// <returns></returns>
        private State EnclosingStateUpdate(Dictionary dictionary)
        {
            State retVal = null;

            if (EnclosingState != null && dictionary.Updates == Dictionary)
            {
                State updatedState = dictionary.FindByFullName(EnclosingState.FullName) as State;
                if (updatedState == null)
                {
                    retVal = EnclosingState.CreateStateUpdate(dictionary);
                }
            }

            return(retVal);
        }
示例#2
0
        /// <summary>
        ///     Finds or creates an update for the current element
        /// </summary>
        /// <returns></returns>
        protected override ModelElement FindOrCreateUpdate()
        {
            ModelElement retVal = null;

            Dictionary dictionary = GetPatchDictionary();

            if (dictionary != null)
            {
                ModelElement model = dictionary.FindByFullName(Item.Model.FullName) as ModelElement;
                if (model != null)
                {
                    retVal = Item.CreateReqRefUpdate(model);
                }
                // Navigate to the element, whether it was created or not
                EfsSystem.Instance.Context.SelectElement(retVal, this, Context.SelectionCriteria.DoubleClick);
            }

            return(retVal);
        }
示例#3
0
        protected override ModelElement FindOrCreateUpdate()
        {
            ModelElement retVal = null;

            Dictionary dictionary = GetPatchDictionary();

            if (dictionary != null)
            {
                retVal = dictionary.FindByFullName(Item.FullName) as ModelElement;
                if (retVal == null)
                {
                    // If the element does not already exist in the patch, add a copy to it
                    retVal = Item.CreateStateUpdate(dictionary);
                }
                // Navigate to the element, whether it was created or not
                EfsSystem.Instance.Context.SelectElement(retVal, this, Context.SelectionCriteria.DoubleClick);
            }

            return(retVal);
        }
示例#4
0
        /// <summary>
        ///     Looks through enclosing elements for the enumeration that is at the name space level
        /// </summary>
        /// <returns></returns>
        private Enum GetTopLevelEnum()
        {
            Enum retVal = this;

            String[] names    = FullName.Split('.');
            string   fullName = names[0];
            int      i        = 0;

            while (!(Dictionary.FindByFullName(fullName) is Enum))
            {
                i++;
                fullName += "." + names[i];
            }

            if (fullName != FullName)
            {
                retVal = Dictionary.FindByFullName(fullName) as Enum;
            }

            return(retVal);
        }
        /// <summary>
        ///     Finds or creates an update for the current element.
        /// </summary>
        /// <returns></returns>
        protected override ModelElement FindOrCreateUpdate()
        {
            ModelElement retVal = null;

            Dictionary dictionary = GetPatchDictionary();

            if (dictionary != null)
            {
                retVal = dictionary.FindByFullName(Item.FullName) as ModelElement;
                if (retVal == null)
                {
                    // If the element does not already exist in the patch, add a copy of the enumeration to it
                    // Get the enclosing namespace (by splitting the fullname and asking a recursive function to provide or make it)
                    retVal = Item.CreateEnumUpdate(dictionary);
                }
                // Navigate to the element, whether it was created or not
                EfsSystem.Instance.Context.SelectElement(retVal, this, Context.SelectionCriteria.DoubleClick);
            }

            return(retVal);
        }
示例#6
0
        /// <summary>
        ///     Provides the update of the state machine enclosing a rule or state.
        /// </summary>
        /// <param name="dictionary"></param>
        /// <returns></returns>
        public StateMachine CreateSubStateMachineUpdate(Dictionary dictionary)
        {
            StateMachine retVal = null;

            if (this != FindTopLevelStateMachine())
            {
                State refState = EnclosingStateUpdate(dictionary);
                retVal = refState.StateMachine;
            }
            else
            {
                StateMachine updateSm = dictionary.FindByFullName(FullName) as StateMachine;
                if (updateSm == null)
                {
                    // If the element does not already exist in the patch, add a copy to it
                    updateSm = CreateStateMachineUpdate(dictionary);
                }

                retVal = updateSm;
            }

            return(retVal);
        }
        /// <summary>
        ///     Returns the update of the enclosing state in the dictionary.
        ///     If it cannot be found, it is created.
        /// </summary>
        /// <param name="dictionary"></param>
        /// <returns></returns>
        private State EnclosingStateUpdate(Dictionary dictionary)
        {
            State retVal = null;

            if (EnclosingState != null && dictionary.Updates == Dictionary)
            {
                State updatedState = dictionary.FindByFullName(EnclosingState.FullName) as State;
                if (updatedState == null)
                {
                    retVal = EnclosingState.CreateStateUpdate(dictionary);
                }
            }

            return retVal;
        }
        /// <summary>
        ///     Provides the update of the state machine enclosing a rule or state.
        /// </summary>
        /// <param name="dictionary"></param>
        /// <returns></returns>
        public StateMachine CreateSubStateMachineUpdate(Dictionary dictionary)
        {
            StateMachine retVal = null;
            if (this != FindTopLevelStateMachine())
            {
                State refState = EnclosingStateUpdate(dictionary);
                retVal = refState.StateMachine;
            }
            else
            {
                StateMachine updateSm = dictionary.FindByFullName(FullName) as StateMachine;
                if (updateSm == null)
                {
                    // If the element does not already exist in the patch, add a copy to it
                    updateSm = CreateStateMachineUpdate(dictionary);
                }

                retVal = updateSm;
            }

            return retVal;
        }