//NameSupport.setName(newComponent, uiFieldName);
TypeDeclaration typeDeclaration = formEditor.getPrimaryType();
VariableDeclaration variableDeclaration =
NameSupport.getBinderField(typeDeclaration, uiFieldName);
if (variableDeclaration != null) {
formEditor.replaceVariableType(
variableDeclaration,
ReflectionUtils.getCanonicalName(newComponent.getDescription().getComponentClass()));
formEditor.saveChanges(true);
}
}