/// <summary> /// Removes selected elements from the active diagram. /// </summary> /// <seealso cref="IDeletable"/> /// <param name="parameter"></param> public override void Execute(object parameter) { LeaveOutStructuralElementsMacroCommand command = (LeaveOutStructuralElementsMacroCommand)LeaveOutStructuralElementsMacroCommandFactory.Factory().Create(ActiveDiagramView.Controller); List <PSMSuperordinateComponent> superordinateComponents = new List <PSMSuperordinateComponent>(); List <PSMClassUnion> unions = new List <PSMClassUnion>(); List <PSMAttributeContainer> attributeContainers = new List <PSMAttributeContainer>(); foreach (ISelectable item in ActiveDiagramView.SelectedItems) { IPSMSuperordinateComponentRepresentant super = item as IPSMSuperordinateComponentRepresentant; if (super != null) { superordinateComponents.Add(super.ModelSuperordinateComponent); } PSM_ClassUnion union = item as PSM_ClassUnion; if (union != null) { unions.Add(union.ClassUnion); } PSM_AttributeContainer attributeContainer = item as PSM_AttributeContainer; if (attributeContainer != null) { attributeContainers.Add(attributeContainer.AttributeContainer); } } command.InitializeCommand(superordinateComponents, unions, attributeContainers); command.Execute(); }
/// <summary> /// Updates the components connectors for each component in <paramref name="parent"/>'s /// <see cref="PSMSuperordinateComponent.Components"/>. /// </summary> /// <param name="parent">The superordinate component.</param> public static void UpdateComponentsConnectors(this IPSMSuperordinateComponentRepresentant parent) { foreach (PSMSubordinateComponent component in parent.ModelSuperordinateComponent.Components) { if (parent.XCaseCanvas.ElementRepresentations.IsElementPresent(component)) { PSMElementViewBase componentView = parent.XCaseCanvas.ElementRepresentations[component] as PSMElementViewBase; if (componentView != null) { ((PSMElementViewHelper)componentView.ViewHelper).ConnectorViewHelper.Points.Clear(); componentView.InitializeConnector(parent); } PSM_Association associationView = parent.XCaseCanvas.ElementRepresentations[component] as PSM_Association; if (associationView != null) { associationView.UpdateConnection(parent); } } } }