public void updateAttributeFields( FormContainer formContainer, FormElement formElement, Attribute att) { FormElement fieldForAttribute = null; if (formContainer instanceof FormSearch) { fieldForAttribute = SearchInitialization.getSearchFieldForAttribute(att); } else if (formContainer instanceof FormClass || formContainer instanceof FormWorkflow) { fieldForAttribute = ClassDiagramUtils.getFieldForAttribute(att); } if (!fieldForAttribute.getClass().isInstance(formElement)) { // mismatch so we replace the Field FormGroup eContainer = (FormGroup) formElement.eContainer(); boolean contains = eContainer.getChildren().contains(formElement); if (headless) { EList<FormElement> children = null; if (contains) { children = eContainer.getChildren(); } else { children = eContainer.getDisabled(); } // add the new Field children.add(fieldForAttribute); // remove children.remove(formElement); } else { if (contains) { cc.append( AddCommand.create( domain, eContainer, FormPackage.eINSTANCE.getFormGroup_Children(), fieldForAttribute)); } else { cc.append( AddCommand.create( domain, eContainer, FormPackage.eINSTANCE.getFormGroup_Disabled(), fieldForAttribute)); } Command rmCmd = RemoveCommand.create(domain, formElement); cc.append(rmCmd); } } }