Exemplo n.º 1
0
        public PSMAttribute AddAttribute(Property representedAttribute, string name, string alias, uint?lower, UnlimitedNatural upper, DataType type, string @default, IEnumerable <string> names)
        {
            AddPSMClassAttributeCommand c = (AddPSMClassAttributeCommand)AddPSMClassAttributeCommandFactory.Factory().Create(DiagramController);

            c.PSMClass             = Class;
            c.Alias                = alias;
            c.Name                 = name;
            c.Lower                = lower;
            c.Upper                = upper;
            c.Type                 = type;
            c.Default              = @default;
            c.RepresentedAttribute = representedAttribute;
            c.UsedAliasesOrNames   = names;
            c.Execute();

            return(c.CreatedAttribute);
        }
Exemplo n.º 2
0
        public override void Execute(object parameter)
        {
            Element element;
            MacroCommand <DiagramController> command = MacroCommandFactory <DiagramController> .Factory().Create(ActiveDiagramView.Controller);

            command.Description = CommandDescription.ADD_PSM_ATTRIBUTE;
            foreach (ISelectable item in ActiveDiagramView.SelectedItems)
            {
                if (item is PSM_Class && (element = (item as PSM_Class).Controller.Element) is PSMClass)
                {
                    AddPSMClassAttributeCommand c = AddPSMClassAttributeCommandFactory.Factory().Create(ActiveDiagramView.Controller) as AddPSMClassAttributeCommand;
                    c.PSMClass = (PSMClass)element;
                    c.Name     = NameSuggestor <PSMAttribute> .SuggestUniqueName(((PSMClass)element).PSMAttributes, "FreeAttribute", property => property.AliasOrName);

                    command.Commands.Add(c);
                }
            }
            if (command.Commands.Count > 0)
            {
                command.Execute();
            }
        }