예제 #1
0
        public Unit Execute(ModelEntity e)
        {
            var selectedInCurrentDiagram = Repo.GetCurrentDiagram()
                                           .SelectMany(currentDiagram => currentDiagram.SelectedEntities(Repo))
                                           .ToList();

            if (selectedInCurrentDiagram.IsEmpty())
            {
                Clipboard.Val.PasteInto(e);
                Repo.PropagateChanges(e);
            }
            else
            {
                selectedInCurrentDiagram.ForEach(selected =>
                {
                    Clipboard.Val.PasteInto(selected);
                    Repo.PropagateChanges(selected);
                });
            }

            return(Unit.Instance);
        }
 private Option <ModelEntity.Diagram> GetCurrentDiagramContaining(ModelEntity.Element element)
 {
     return(from diagram in Repo.GetCurrentDiagram()
            where diagram.GetObject(element).IsDefined
            select diagram);
 }