Ejemplo n.º 1
0
 /// <summary>
 /// Checks whether selected elements can be moved to a Content Choice.
 /// </summary>
 /// <returns>
 /// true if this command can be executed; otherwise, false.
 /// </returns>
 /// <param name="parameter">ignored</param>
 public override bool CanExecute(object parameter)
 {
     if (ActiveDiagramView != null && ActiveDiagramView.SelectedItems.Count > 1)
     {
         PSMSuperordinateComponent       parent;
         IList <PSMSubordinateComponent> components;
         if (PSMDiagramHelper.AreComponentsOfCommonParent(ActiveDiagramView.SelectedRepresentants, out parent, out components))
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 2
0
 public override void Execute(object parameter)
 {
     if (ActiveDiagramView != null && ActiveDiagramView.SelectedItems.Count > 1)
     {
         PSMSuperordinateComponent       parent;
         IList <PSMSubordinateComponent> components;
         if (PSMDiagramHelper.AreComponentsOfCommonParent(ActiveDiagramView.SelectedRepresentants, out parent, out components))
         {
             NewPSMContentChoiceCommand command = (NewPSMContentChoiceCommand)NewPSMContentChoiceCommandFactory.Factory().Create(ActiveDiagramView.Controller);
             command.Parent = parent;
             command.ContainedComponents.AddRange(components);
             command.Execute();
         }
     }
 }
Ejemplo n.º 3
0
 public override void Execute(object parameter)
 {
     if (ActiveDiagramView != null && ActiveDiagramView.SelectedItems.Count > 0)
     {
         PSMSuperordinateComponent       parent;
         IList <PSMSubordinateComponent> components;
         if (PSMDiagramHelper.AreComponentsOfCommonParent(ActiveDiagramView.SelectedRepresentants, out parent, out components))
         {
             if (components.All(component => component is PSMAssociation))
             {
                 JoinAssociationsToClassUnionMacroCommand command = (JoinAssociationsToClassUnionMacroCommand)JoinAssociationsToClassUnionMacroCommandFactory.Factory().Create(ActiveDiagramView.Controller);
                 command.Set(parent, components.Cast <PSMAssociation>().OrderBy(a => a.ComponentIndex()));
                 command.Execute();
             }
         }
     }
 }