Ejemplo n.º 1
0
        internal override MacroCommand PrePropagation()
        {
            IEnumerable <CommandBase> deleteFromDiagrams =
                acmdRemoveComponentFromDiagram.CreateCommandsToRemoveFromAllDiagrams(Controller, deletedClassGuid);

            List <PSMClass> list = Project.TranslateComponent <PIMClass>(deletedClassGuid).GetInterpretedComponents().Cast <PSMClass>().ToList <PSMClass>();

            if (list.Count == 0 && deleteFromDiagrams.Count() == 0)
            {
                return(null);
            }

            MacroCommand command = new MacroCommand(Controller);

            command.Report = new CommandReport("Pre-propagation (delete PIM class)");

            command.Commands.AddRange(deleteFromDiagrams);

            if (list.Count > 0)
            {
                List <PSMClass> list2 = new List <PSMClass>(list);
                foreach (PSMClass c1 in list2)
                {
                    foreach (PSMClass c2 in list2)
                    {
                        if (c1.IsDescendantFrom(c2))
                        {
                            list.Remove(c1);
                        }
                    }
                }

                foreach (PSMClass c in list)
                {
                    cmdDeletePSMClassAndParent d = new cmdDeletePSMClassAndParent(Controller)
                    {
                        Propagate = false
                    };
                    d.Set(c);
                    command.Commands.Add(d);
                }
            }
            return(command);
        }
Ejemplo n.º 2
0
        internal override PropagationMacroCommand PrePropagation()
        {
            List <PSMClass> list = Project.TranslateComponent <PIMClass>(deletedClassGuid).GetInterpretedComponents().Cast <PSMClass>().ToList <PSMClass>();

            if (list.Count == 0)
            {
                return(null);
            }

            PropagationMacroCommand command = new PropagationMacroCommand(Controller);

            command.Report = new CommandReport("Pre-propagation (delete PIM class)");

            if (list.Count > 0)
            {
                List <PSMClass> list2 = new List <PSMClass>(list);
                foreach (PSMClass c1 in list2)
                {
                    foreach (PSMClass c2 in list2)
                    {
                        if (c1.IsDescendantFrom(c2))
                        {
                            list.Remove(c1);
                        }
                    }
                }

                foreach (PSMClass c in list)
                {
                    cmdDeletePSMClassAndParent d = new cmdDeletePSMClassAndParent(Controller)
                    {
                        Propagate = false
                    };
                    d.Set(c);
                    command.Commands.Add(d);
                }
            }
            return(command);
        }