Esempio n. 1
0
        /// <summary>
        ///     Performs a refactor
        /// </summary>
        /// <param name="element"></param>
        /// <param name="target"></param>
        protected void MoveToNameSpace(ModelElement element, NameSpace target)
        {
            Compiler.Compile_Synchronous(true);

            target.AddModelElement(element);
            Compiler.RefactorAndRelocate(element);
        }
Esempio n. 2
0
        /// <summary>
        ///     Brings the model element from an update dictionary to the updated dictionary
        /// </summary>
        public virtual void Merge()
        {
            ModelElement target = Updates;

            if (target == null)
            {
                // Copy element to parent
                ModelElement parent = Enclosing as ModelElement;
                if (parent != null)
                {
                    NameSpace parentNameSpace = parent.Updates as NameSpace;
                    if (parentNameSpace != null)
                    {
                        parentNameSpace.AddModelElement(Duplicate());
                    }

                    Paragraph parentParagraph = parent.Updates as Paragraph;
                    if (parentParagraph != null)
                    {
                        parentParagraph.AddModelElement(Duplicate());
                    }

                    Structure parentStructure = parent.Updates as Structure;
                    if (parentStructure != null)
                    {
                        parentStructure.AddModelElement(Duplicate());
                    }

                    StateMachine parentStateMachine = parent.Updates as StateMachine;
                    if (parentStateMachine != null)
                    {
                        parentStateMachine.AddModelElement(Duplicate());
                    }
                }
            }
            else
            {
                if (!IsRemoved)
                {
                    target.UpdateModelElementAccordingToSource(this);
                }
                else
                {
                    target.Delete();
                }
            }
        }
        /// <summary>
        ///     Performs a refactor
        /// </summary>
        /// <param name="element"></param>
        /// <param name="target"></param>
        protected void MoveToNameSpace(ModelElement element, NameSpace target)
        {
            Compiler.Compile_Synchronous(true);

            target.AddModelElement(element);
            Compiler.RefactorAndRelocate(element);
        }