public ICommand replace(IModelElement owner, String property, Object oldValue, Object newValue) { Collection replacement = new Vector(); replacement.add(EMFModel.getEMFObjectForModel(newValue)); return new EMFCommand( ReplaceCommand.create( fEditDomain, ((EMFModelElement) owner).getEMFObject(), ((EMFModelElement) owner).getEMFFeatureForProperty(property), EMFModel.getEMFObjectForModel(oldValue), replacement)); }
@Override public void doExecute() { super.doExecute(); SpecType theOneAndOnlySpecType = ((Content) this.owner).getSpecTypes().get(0); Collection<AttributeDefinition> affectedAttributeDefinitions = FinderUtil.helper_findAttributedefinitionsInSpectypeBasedonDatatypedefinition( (DatatypeDefinition) value, theOneAndOnlySpecType); // replace the old TYPE (=DataDefinition) with the new one, in each affected AttributeDefinition for (AttributeDefinition attributeDefinition : affectedAttributeDefinitions) { Command cmd = new SetCommand( this.domain, attributeDefinition, attributeDefinition .eClass() .getEStructuralFeature(ErfPackage.ATTRIBUTE_DEFINITION__TYPE), this.collection.toArray()[0]); this.domain.getCommandStack().execute(cmd); } }