public Command getCommand(Object value) { if (value instanceof String) { String owner = (String) value; boolean isOwnedByAssociation = ASSOCIATION.equals(owner); Association association = memberEnd.getAssociation(); if (association.getMemberEnds().size() > 2) { Activator.log.warn("Cannot change End owner for n-ary associations"); // $NON-NLS-1$ return UnexecutableCommand.INSTANCE; } // Classifier classifier = memberEnd.getClass_(); // EStructuralFeature ownedEndFeature = // association.eClass().getEStructuralFeature(UMLPackage.ASSOCIATION__OWNED_END); Command command = null; if (isOwnedByAssociation) { // Owned by Association IElementEditService provider = ElementEditServiceUtils.getCommandProvider(association); if (provider != null) { EStructuralFeature feature = UMLPackage.eINSTANCE.getAssociation_OwnedEnd(); List<Property> attributeList = new ArrayList<Property>(); attributeList.addAll(association.getOwnedEnds()); attributeList.add(memberEnd); // association.eSet(feature, attributeList); SetRequest request = new SetRequest(association, feature, attributeList); ICommand createGMFCommand = provider.getEditCommand(request); command = new GMFtoEMFCommandWrapper(createGMFCommand); } } else { // Owned by Classifier Type ownerType; List<Type> ownerList = association.getEndTypes(); if (ownerList.get(0).equals(memberEnd.getType()) && ownerList.size() > 1) { ownerType = ownerList.get(1); } else { ownerType = ownerList.get(0); } EStructuralFeature ownedAttributeFeature = getFeatureForType(ownerType); if (ownedAttributeFeature != null) { List<Property> attributeList = new ArrayList<Property>(); attributeList.addAll((EList<Property>) ownerType.eGet(ownedAttributeFeature)); attributeList.add(memberEnd); IElementEditService provider = ElementEditServiceUtils.getCommandProvider(ownerType); if (provider != null) { SetRequest request = new SetRequest(ownerType, ownedAttributeFeature, memberEnd); ICommand createGMFCommand = provider.getEditCommand(request); command = new GMFtoEMFCommandWrapper(createGMFCommand); } } } if (command != null) { this.currentValue = owner; } else { Activator.log.warn("Cannot modify the memberEnd owner"); } return command; } return UnexecutableCommand.INSTANCE; }