示例#1
0
        /// <summary>
        /// Sets this command for execution
        /// </summary>
        /// <param name="c">PIMClass to be derived from</param>
        /// <param name="d">Diagram to which to add the PSM Class as one of roots</param>
        /// <param name="h">Optional Element holder where the final PSMClass will be placed</param>
        public void Set(PIMClass c, PSMDiagram d, ElementHolder <PSMClass> h)
        {
            Class = c;
            HolderBase <PSMDiagram> DiagramHolder = new HolderBase <PSMDiagram>()
            {
                Element = d
            };

            if (h != null)
            {
                pSMClassHolder = h;
            }
            else
            {
                pSMClassHolder = new ElementHolder <PSMClass>();
            }

            NewPSMClassCommand c1 = NewPSMClassCommandFactory.Factory().Create(Controller) as NewPSMClassCommand;

            c1.RepresentedClass = Class;
            c1.CreatedClass     = pSMClassHolder;
            Commands.Add(c1);

            PSMClassToDiagram_ModelCommand c3 = PSMClassToDiagram_ModelCommandFactory.Factory().Create(Controller) as PSMClassToDiagram_ModelCommand;

            c3.Set(pSMClassHolder, DiagramHolder);
            Commands.Add(c3);

            AddPSMClassToRoots_ModelCommand c4 = AddPSMClassToRoots_ModelCommandFactory.Factory().Create(Controller) as AddPSMClassToRoots_ModelCommand;

            c4.Set(pSMClassHolder, DiagramHolder);
            Commands.Add(c4);

            ActivateDiagramCommand c5 = ActivateDiagramCommandFactory.Factory().Create(Controller) as ActivateDiagramCommand;

            c5.Set(d);
            Commands.Add(c5);
        }
        /// <summary>
        /// Sets this command for execution
        /// </summary>
        /// <param name="c">PIMClass to be derived from</param>
        /// <param name="h">Optional Element holder where the final PSMClass will be placed</param>
        public void Set(PIMClass c, ElementHolder <PSMClass> h)
        {
            Class = c;
            if (h != null)
            {
                pSMClassHolder = h;
            }
            else
            {
                pSMClassHolder = new ElementHolder <PSMClass>();
            }

            NewPSMClassCommand c1 = NewPSMClassCommandFactory.Factory().Create(Controller) as NewPSMClassCommand;

            c1.RepresentedClass = Class;
            c1.CreatedClass     = pSMClassHolder;
            Commands.Add(c1);

            AddPSMDiagramCommand c2 = AddPSMDiagramCommandFactory.Factory().Create(Controller) as AddPSMDiagramCommand;

            if (DiagramHolder == null)
            {
                DiagramHolder = new HolderBase <PSMDiagram>();
            }
            c2.Set(Controller.Project, DiagramHolder);
            Commands.Add(c2);

            PSMClassToDiagram_ModelCommand c3 = PSMClassToDiagram_ModelCommandFactory.Factory().Create(Controller) as PSMClassToDiagram_ModelCommand;

            c3.Set(pSMClassHolder, DiagramHolder);
            Commands.Add(c3);

            AddPSMClassToRoots_ModelCommand c4 = AddPSMClassToRoots_ModelCommandFactory.Factory().Create(Controller) as AddPSMClassToRoots_ModelCommand;

            c4.Set(pSMClassHolder, DiagramHolder);
            Commands.Add(c4);
        }