public override object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (Controller != null && selectedOperation != null) { // No renaming if (selectedOperation.Name.Equals((string)value)) { return(value); } RenameElementCommand <Operation> renameElementCommand = (RenameElementCommand <Operation>) RenameElementCommandFactory <Operation> .Factory().Create(Controller); renameElementCommand.NewName = (string)value; renameElementCommand.RenamedElement = selectedOperation; renameElementCommand.ContainingCollection = selectedOperation.Class.Operations; renameElementCommand.AssociatedElements.Add(selectedOperation.Class); renameElementCommand.Execute(); // ((ClassController)Controller).RenameOperation(selectedOperation, (string)value); } return(value); }
public void RenameOperation(Operation operation, string newName) { RenameElementCommand <Operation> renameElementCommand = (RenameElementCommand <Operation>) RenameElementCommandFactory <Operation> .Factory().Create(DiagramController.ModelController); renameElementCommand.NewName = newName; renameElementCommand.RenamedElement = operation; renameElementCommand.ContainingCollection = Class.Operations; renameElementCommand.AssociatedElements.Add(Class); renameElementCommand.Execute(); }
public void ChangeRole(AssociationEnd end, string role) { RenameElementCommand <AssociationEnd> command = (RenameElementCommand <AssociationEnd>) RenameElementCommandFactory <AssociationEnd> .Factory().Create(DiagramController.ModelController); command.NewName = role; command.RenamedElement = end; command.AssociatedElements.Add(Association); command.Execute(); }
public void RenameElement(string newName) { RenameElementCommand <Association> command = (RenameElementCommand <Association>) RenameElementCommandFactory <Association> .Factory().Create(DiagramController.ModelController); command.RenamedElement = Association; command.NewName = newName; command.Execute(); }
private void bOk_Click(object sender, RoutedEventArgs e) { MacroCommand <ModelController> command = MacroCommandFactory <ModelController> .Factory().Create(controller); command.Description = CommandDescription.UPDATE_PACKAGE_MACRO; if (tbName.Text != oldName) { RenameElementCommand <Package> renameElementCommand = (RenameElementCommand <Package>) RenameElementCommandFactory <Package> .Factory().Create(controller); renameElementCommand.NewName = tbName.Text; renameElementCommand.RenamedElement = package; renameElementCommand.ContainingCollection = package.NestingPackage.NestedPackages; command.Commands.Add(renameElementCommand); } if (cbPackages.SelectedItem != package.NestingPackage) { MovePackageCommand movePackageCommand = (MovePackageCommand)MovePackageCommandFactory.Factory().Create(controller); movePackageCommand.OldPackage = package.NestingPackage; movePackageCommand.NewPackage = (Package)cbPackages.SelectedItem; movePackageCommand.MovedPackage = package; command.Commands.Add(movePackageCommand); } if (command.Commands.Count > 0) { command.Execute(); } DialogResult = true; Close(); }
public override object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (Controller != null && value != null) { IEnumerable <Class> containingCollection; containingCollection = selectedClass.Package != null?selectedClass.Package.Classes.Cast <Class>() : null; // No renaming if (selectedClass.Name.Equals((string)value)) { return(value); } RenameElementCommand <Class> command = (RenameElementCommand <Class>) RenameElementCommandFactory <Class> .Factory().Create(Controller); command.RenamedElement = selectedClass; command.ContainingCollection = containingCollection; command.NewName = (string)value; command.Execute(); //Controller.RenameElement((string)value, containingCollection); } return(value); }
public override object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (selectedAssociationEnd != null && modelController != null && value != null) { // No renaming if (selectedAssociationEnd.Name != null && selectedAssociationEnd.Name.Equals((string)value)) { return(value); } RenameElementCommand <AssociationEnd> command = (RenameElementCommand <AssociationEnd>) RenameElementCommandFactory <AssociationEnd> .Factory().Create(modelController); command.NewName = (string)value; command.RenamedElement = selectedAssociationEnd; command.AssociatedElements.Add(selectedAssociationEnd.Association); command.Execute(); } return(value); }
/// <summary> /// Renames the class /// </summary> /// <param name="newName">new name for the class</param> public void RenameElementWithDiagramController(string newName) { RenameElementCommandDiagram <PSMClass> command = (RenameElementCommandDiagram <PSMClass>) RenameElementCommandFactory <PSMClass> .Factory().Create(DiagramController); command.RenamedElement = Class; command.NewName = newName; command.Execute(); }
public void RenameAttribute(PSMAttribute attribute, string newName) { RenameElementCommand <PSMAttribute> renameElementCommand = (RenameElementCommand <PSMAttribute>) RenameElementCommandFactory <PSMAttribute> .Factory().Create(DiagramController.ModelController); renameElementCommand.NewName = newName; renameElementCommand.RenamedElement = attribute; renameElementCommand.ContainingCollection = Class.PSMAttributes; renameElementCommand.Execute(); }
/// <summary> /// Renames controller's associated element /// </summary> /// <typeparam name="ElementType">The type of the element.</typeparam> /// <param name="element">The element.</param> /// <param name="newName">new name for the element</param> /// <param name="controller">The controller that will issue renaming command.</param> /// <param name="containingCollection">Collection of elements of which element is a member. /// Can be left to null. If not null, it is checked, whether <paramref name="newName"/> is unique /// in the collection.</param> public static void RenameElement <ElementType>(ElementType element, string newName, ModelController controller, IEnumerable <ElementType> containingCollection) where ElementType : NamedElement { RenameElementCommand <ElementType> command = (RenameElementCommand <ElementType>) RenameElementCommandFactory <ElementType> .Factory().Create(controller); command.RenamedElement = element; command.ContainingCollection = containingCollection; command.NewName = newName; command.Execute(); }
public void RenameAttribute(Property attribute, string newName) { RenameElementCommand <Property> renameElementCommand = (RenameElementCommand <Property>) RenameElementCommandFactory <Property> .Factory().Create(DiagramController.ModelController); renameElementCommand.NewName = newName; renameElementCommand.AssociatedElements.Add(Class); renameElementCommand.RenamedElement = attribute; renameElementCommand.ContainingCollection = Class.Attributes; renameElementCommand.Execute(); }
private void bOk_Click(object sender, RoutedEventArgs e) { MacroCommand <ModelController> command = MacroCommandFactory <ModelController> .Factory().Create(controller); command.Description = CommandDescription.UPDATE_OPERATION_MACRO; if (tbName.Text != oldName) { RenameElementCommand <Operation> renameElementCommand = (RenameElementCommand <Operation>) RenameElementCommandFactory <Operation> .Factory().Create(controller); renameElementCommand.NewName = tbName.Text; renameElementCommand.RenamedElement = operation; renameElementCommand.ContainingCollection = operation.Class.Operations; command.Commands.Add(renameElementCommand); } if (command.Commands.Count > 0) { command.Execute(); } DialogResult = true; Close(); }