internal override void CommandOperation() { oldType = PSMAttribute.Type; PSMAttribute.Type = Type; oldAlias = PSMAttribute.Alias; if (Alias != null) { PSMAttribute.Alias = Alias; } oldLower = PSMAttribute.Lower; oldUpper = PSMAttribute.Upper; if (customMultiplicity) { PSMAttribute.Lower = Lower; PSMAttribute.Upper = Upper; } oldDefault = PSMAttribute.Default; PSMAttribute.Default = Default; oldName = PSMAttribute.Name; PSMAttribute.Name = Name; AssociatedElements.Add(PSMAttribute.Class); }
internal override void CommandOperation() { if (CreatedContainer == null) { CreatedContainer = new Helpers.ElementHolder <PSMAttributeContainer>(); } PSMAttributeContainer psmAttributeContainer; if (PSMSuper != null) { psmAttributeContainer = (PSMAttributeContainer)PSMSuper.AddComponent(PSMAttributeContainerFactory.Instance); } else { psmAttributeContainer = (PSMAttributeContainer)PSMClass.AddComponent(PSMAttributeContainerFactory.Instance); } foreach (PSMAttribute attribute in psmAttributes) { //PSMAttribute containerAttribute = psmAttributeContainer.AddAttribute(attribute.RepresentedAttribute); //containerAttribute.Alias = attribute.Alias; PSMClass.PSMAttributes.Remove(attribute); psmAttributeContainer.PSMAttributes.Add(attribute); } CreatedContainer.Element = psmAttributeContainer; Debug.Assert(CreatedContainer.HasValue); Diagram.AddModelElement(psmAttributeContainer, ViewHelper); AssociatedElements.Add(psmAttributeContainer); }
/// <summary> /// Executive function of a command /// </summary> /// <seealso cref="UndoOperation"/> internal override void CommandOperation() { oldValue = AssociationViewHelper.UseDiamond; Diagram.RemoveModelElement(Association); oldPoints = new Dictionary <int, List <rPoint> >(); int i = 0; foreach (AssociationEndViewHelper endViewHelper in AssociationViewHelper.AssociationEndsViewHelpers) { oldPoints[i++] = new List <rPoint>(endViewHelper.Points); endViewHelper.Points.Clear(); } if (!AssociationViewHelper.UseDiamond) { AssociationViewHelper.X = 0; AssociationViewHelper.Y = 0; } AssociationViewHelper.UseDiamond = !AssociationViewHelper.UseDiamond; Diagram.AddModelElement(Association, AssociationViewHelper); AssociatedElements.Add(Association); }
public override void CommandsExecuted() { base.CommandsExecuted(); CreatedAssociation = c.CreatedAssociation.Element; ViewHelper = d.ViewHelper; AssociatedElements.Add(CreatedAssociation); }
internal override void CommandOperation() { associationViewHelper = Diagram.DiagramElements[PSMAssociation]; Diagram.RemoveModelElement(PSMAssociation); PSMAssociation.RemoveMeFromModel(); (Diagram as PSMDiagram).Roots.Add(PSMAssociation.Child as PSMClass); AssociatedElements.Add(PSMAssociation.Child); }
internal override void CommandOperation() { foreach (KeyValuePair <Element, ViewHelper> pair in IncludedElements) { Diagram.AddModelElement(pair.Key, pair.Value); AssociatedElements.Add(pair.Key); } }
internal override void CommandOperation() { foreach (Element element in DeletedElements) { element.RemoveMeFromModel(); AssociatedElements.Add(element); } }
internal override void CommandOperation() { CreatedNestingJoin = Association.Element.AddNestingJoin((Association.Element.Child as PSMClass).RepresentedClass); for (int i = 0; i < ParentPath.Count; i++) { CreatedNestingJoin.Parent.AddStep(ParentPath[i].End, ParentPath[i].Start, ParentPath[i].Association); } AssociatedElements.Add(Association.Element); }
internal override void CommandOperation() { Diagram.AddModelElement(IncludedElement.Element, ViewHelper); AssociatedElements.Add(IncludedElement.Element); if (IncludedElement.Element is PSMElement && Diagram is PSMDiagram) { (IncludedElement.Element as PSMElement).Diagram = Diagram as PSMDiagram; } }
internal override void CommandOperation() { if (Owner is Element) { AssociatedElements.Add((Element)Owner); } createdOperation = Owner.AddOperation(); createdOperation.Name = Name; createdOperation.Type = Type; }
internal override void CommandOperation() { if (CreatedGeneralization == null) { CreatedGeneralization = new ElementHolder <Generalization>(); } CreatedGeneralization.Element = Model.Schema.SetGeneralization(General, Specific); Debug.Assert(CreatedGeneralization.HasValue); AssociatedElements.Add(CreatedGeneralization.Element); }
internal override void CommandOperation() { parent = ((PSMSubordinateComponent)Container).Parent; int index = ((PSMSubordinateComponent)Container).ComponentIndex() + 1; foreach (PSMSubordinateComponent component in movedComponents) { oldIndexes[component] = component.ComponentIndex(); Container.Components.Remove(component); parent.Components.Insert(index++, component); AssociatedElements.Add(component); } }
internal override void CommandOperation() { if (CreatedComment == null) { CreatedComment = new ElementHolder <Comment>(); } CreatedComment.Element = AnnotatedElement.AddComment(NameSuggestor <Comment> .SuggestUniqueName(AnnotatedElement.Comments, "Comment", comment => comment.Body));; CreatedComment.Element.Body = Text; Debug.Assert(CreatedComment.HasValue); AssociatedElements.Add(CreatedComment.Element); }
internal override void CommandOperation() { AssociatedElements.Add(pSMClassHolder.Element); if (ViewHelper == null) { ViewHelper = new PSMElementViewHelper(DiagramHolder.Element) { X = 0, Y = 0, Height = double.NaN, Width = double.NaN } } ; DiagramHolder.Element.AddModelElement(pSMClassHolder.Element, ViewHelper); pSMClassHolder.Element.Diagram = DiagramHolder.Element; }
internal override void CommandOperation() { if (CreatedClass == null) { CreatedClass = new ElementHolder <PSMClass>(); } PSMClass psmClass = RepresentedClass.DerivePSMClass(); CreatedClass.Element = psmClass; Debug.Assert(CreatedClass.HasValue); AssociatedElements.Add(CreatedClass.Element); }
internal override void CommandOperation() { if (CreatedClass == null) { CreatedClass = new ElementHolder <PIMClass>(); } CreatedClass.Element = Package.AddClass(); if (!String.IsNullOrEmpty(ClassName)) { CreatedClass.Element.Name = ClassName; } Debug.Assert(CreatedClass.HasValue); AssociatedElements.Add(CreatedClass.Element); }
internal override void CommandOperation() { if (CreatedAssociation == null) { CreatedAssociation = new ElementHolder <Association>(); } CreatedAssociation.Element = Controller.Model.Schema.AssociateClasses(AssociatedClasses); if (!String.IsNullOrEmpty(Name)) { CreatedAssociation.Element.Name = Name; } Debug.Assert(CreatedAssociation.HasValue); AssociatedElements.Add(CreatedAssociation.Element); }
internal override void CommandOperation() { if (attributes.Count > 0) { parentClass = attributes.First().Class; movedAttributes = new List <PSMAttribute>(); foreach (PSMAttribute attribute in attributes) { parentClass.PSMAttributes.Remove(attribute); AttributeContainer.PSMAttributes.Add(attribute); movedAttributes.Add(attribute); } AssociatedElements.Add(AttributeContainer); } }
internal override void CommandOperation() { if (CreatedContainer == null) { CreatedContainer = new Helpers.ElementHolder <PSMContentContainer>(); } PSMSubordinateComponent first = Parent.Components.FirstOrDefault(component => containedComponents.Contains(component)); PSMContentContainer psmContainer; if (Parent != null) { if (first == null) { psmContainer = (PSMContentContainer)Parent.AddComponent(PSMContentContainerFactory.Instance); } else { psmContainer = (PSMContentContainer)Parent.AddComponent( PSMContentContainerFactory.Instance, Parent.Components.IndexOf(first)); } } else //add as root { PSMDiagram diagram = (PSMDiagram)Diagram; PSMContentContainer contentContainer = (PSMContentContainer)PSMContentContainerFactory.Instance.Create(null, diagram.Project.Schema); contentContainer.Diagram = diagram; psmContainer = contentContainer; diagram.Roots.Add(psmContainer); } psmContainer.Name = Name; CreatedContainer.Element = psmContainer; AssociatedElements.Add(psmContainer); foreach (PSMSubordinateComponent containedComponent in containedComponents) { oldIndexes[containedComponent] = containedComponent.ComponentIndex(); Parent.Components.Remove(containedComponent); psmContainer.Components.Add(containedComponent); } Debug.Assert(CreatedContainer.HasValue); Diagram.AddModelElement(psmContainer, ViewHelper = new PSMElementViewHelper(Diagram)); }
/// <summary> /// Executive function of a command /// </summary> /// <seealso cref="UndoOperation"/> internal override void CommandOperation() { foreach (Diagram diagram in Controller.Project.Diagrams) { if (diagram.DiagramElements.ContainsKey(Association)) { if (!diagram.DiagramElements.ContainsKey(Class)) { diagram.AddModelElement(Class, new ClassViewHelper(diagram)); addedClasses.Add(new KeyValuePair <Diagram, Element>(diagram, Class)); } } } AssociationEnd = Association.CreateEnd(Class); AssociatedElements.Add(Association); }
internal override void CommandOperation() { if (CreatedUnion == null) { CreatedUnion = new Helpers.ElementHolder <PSMClassUnion>(); } PSMClassUnion union = Parent.CreateClassUnion(); if (Parent is PSMClassUnion) { } CreatedUnion.Element = union; Diagram.AddModelElement(union, ViewHelper = new PSMElementViewHelper(Diagram)); AssociatedElements.Add(union); }
internal override void CommandOperation() { parent = ((PSMSubordinateComponent)ComponentLeftOut).Parent; movedComponents = new PSMSubordinateComponent[ComponentLeftOut.Components.Count]; ComponentLeftOut.Components.CopyTo(movedComponents, 0); int componentIndex = parent.Components.IndexOf(ComponentLeftOut as PSMSubordinateComponent); foreach (PSMSubordinateComponent component in movedComponents) { ComponentLeftOut.Components.Remove(component); parent.Components.Insert(componentIndex, component); ++componentIndex; } viewHelper = Diagram.DiagramElements[ComponentLeftOut]; Diagram.RemoveModelElement(ComponentLeftOut); ComponentLeftOut.RemoveMeFromModel(); AssociatedElements.Add(ComponentLeftOut); }
internal override void CommandOperation() { PSMAttribute psmAttribute; if (RepresentedAttribute != null) { psmAttribute = PSMClass.AddAttribute(RepresentedAttribute); psmAttribute.Lower = RepresentedAttribute.Lower; psmAttribute.Upper = RepresentedAttribute.Upper; } else { psmAttribute = PSMClass.AddAttribute((Property)null); if (!String.IsNullOrEmpty(Name)) { psmAttribute.Name = Name; } else if (!String.IsNullOrEmpty(Alias)) { psmAttribute.Name = Alias; } else { psmAttribute.Name = NameSuggestor <PSMAttribute> .SuggestUniqueName(PSMClass.PSMAttributes, "Attribute", a => a.AliasOrName); } psmAttribute.Type = Type; } psmAttribute.Alias = Alias; if (customMultiplicity) { psmAttribute.Lower = Lower; psmAttribute.Upper = Upper; } psmAttribute.Default = Default; AssociatedElements.Add(PSMClass); CreatedAttribute = psmAttribute; }
internal override void CommandOperation() { if (attributes.Count > 0) { parentClass = AttributeContainer.PSMClass; if (parentClass == null) { parentClass = Attributes.First().Class; } Debug.Assert(parentClass != null); returnedAttributes = new List <PSMAttribute>(); foreach (PSMAttribute attribute in attributes) { AttributeContainer.PSMAttributes.Remove(attribute); //PSMAttribute createdAttribute = parentClass.AddAttribute(attribute.RepresentedAttribute); parentClass.PSMAttributes.Add(attribute); returnedAttributes.Add(attribute); } AssociatedElements.Add(parentClass); } }
internal override void CommandOperation() { if (CreatedDiagramReference == null) { CreatedDiagramReference = new ElementHolder <PSMDiagramReference>(); } PSMDiagramReference reference = new PSMDiagramReference() { ReferencedDiagram = ReferencedDiagram, ReferencingDiagram = (PSMDiagram)this.Diagram, Name = ReferencedDiagram.Caption, Local = true, SchemaLocation = ReferencedDiagram.Caption + ".xsd" }; CreatedDiagramReference.Element = reference; Debug.Assert(CreatedDiagramReference.HasValue); Diagram.AddModelElement(reference, ViewHelper); AssociatedElements.Add(reference); }
internal override void CommandOperation() { if (Index == null) { CreatedAssociation.Element = (PSMAssociation)ParentHolder.Element.AddComponent(PSMAssociationFactory.Instance); } else { CreatedAssociation.Element = (PSMAssociation)ParentHolder.Element.AddComponent(PSMAssociationFactory.Instance, Index.Value); } CreatedAssociation.Element.Child = ChildHolder.Element; CreatedAssociation.Element.Upper = Upper; CreatedAssociation.Element.Lower = Lower; if (UsedGeneralizations != null) { foreach (Generalization G in UsedGeneralizations) { CreatedAssociation.Element.UsedGeneralizations.Add(G); G.ReferencingPSMAssociations.Add(CreatedAssociation.Element); } } AssociatedElements.Add(CreatedAssociation.Element); }
internal override void CommandOperation() { if (Owner is Model.Element) { AssociatedElements.Add((Model.Element)Owner); } createdAttribute = Owner.AddAttribute(); if (createdAttributeHolder != null) { createdAttributeHolder.Element = createdAttribute; } createdAttribute.Name = Name; createdAttribute.Lower = Lower; if (Type != null && Type.Element != null) { createdAttribute.Type = Type.Element; } if (Upper.HasValue) { createdAttribute.Upper = Upper.Value; } createdAttribute.Default = Default; }
internal override void CommandOperation() { if (CreatedChoice == null) { CreatedChoice = new Helpers.ElementHolder <PSMContentChoice>(); } PSMSubordinateComponent first = Parent.Components.FirstOrDefault(component => containedComponents.Contains(component)); PSMContentChoice psmChoice; if (first == null) { psmChoice = (PSMContentChoice)Parent.AddComponent(PSMContentChoiceFactory.Instance); } else { psmChoice = (PSMContentChoice)Parent.AddComponent(PSMContentChoiceFactory.Instance, first.ComponentIndex()); } psmChoice.Name = Name; CreatedChoice.Element = psmChoice; AssociatedElements.Add(psmChoice); foreach (PSMSubordinateComponent containedComponent in containedComponents) { oldIndexes[containedComponent] = containedComponent.ComponentIndex(); Parent.Components.Remove(containedComponent); psmChoice.Components.Add(containedComponent); } Debug.Assert(CreatedChoice.HasValue); Diagram.AddModelElement(psmChoice, ViewHelper = new PSMElementViewHelper(Diagram)); }
internal override void CommandOperation() { AssociatedElements.Add(DeletedOperation.Class); DeletedOperation.RemoveMeFromModel(); }
internal override void CommandOperation() { oldName = RenamedElement.Name; RenamedElement.Name = NewName; AssociatedElements.Add(RenamedElement); }