final Object bo = ModelHandler.getModel(EcoreUtil.getURI(diagram)).getFeatureProvider().getBusinessObjectForPictogramElement(pictogramElement);
if (bo instanceof ServiceTask) {
TransactionalEditingDomain editingDomain = diagramEditor.getEditingDomain();
ActivitiUiUtil.runModelChange(new Runnable() {
public void run() {
ServiceTask serviceTask = (ServiceTask) bo;
for (TableItem item : getItems()) {
String fieldName = item.getText(0);
String fieldStringValue = item.getText(1);
String fieldExpression = item.getText(2);
if(StringUtils.isNotEmpty(fieldName) &&
(StringUtils.isNotEmpty(fieldStringValue) || StringUtils.isNotEmpty(fieldExpression))) {
FieldExtension fieldExtension = fieldExtensionExists(serviceTask, fieldName);
if(fieldExtension != null) {
fieldExtension.setStringValue(fieldStringValue);
fieldExtension.setExpression(fieldExpression);
} else {
FieldExtension newFieldExtension = new FieldExtension();
newFieldExtension.setFieldName(fieldName);
newFieldExtension.setStringValue(fieldStringValue);
newFieldExtension.setExpression(fieldExpression);
serviceTask.getFieldExtensions().add(newFieldExtension);
}
}
}
removeFieldExtensionsNotInList(getItems(), serviceTask);
}