Hi Demian,
I use my ServiceTask with my CustomWorkItemEditor to pass the parameters to the node (reduced to one parameter for this code example):
public class MyDialog extends EditBeanDialog implements WorkEditor{
Text myText;
public MyDialog(Shell parentShell) {
super (parentShell, "title");
setBlockOnOpen(true);
}
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(composite);
Work work = (Work) getValue();
Label label = new Label(composite, SWT.NONE);
label.setText("labelOne:");
GridDataFactory.fillDefaults().applyTo(label);
myText = new Text(composite, SWT.NONE);
//get current value from node
MyDomainClass mdc = (MyDomainClass) work.getParameter("myParameter");
if(mdc != null){
Value value = mdc.getValue();
myText.setText(value == null ? "" : value.toString());
} else {
myText.setText("");
}
GridDataFactory.fillDefaults().applyTo(myText);
}
protected Object updateValue(Object value) {
Work work = new WorkImpl();
work.setName(((Work) value).getName());
MyDomainClass mdc = new MyDomainClass();
mdc.setValue(myText.getText());
work.setParameter("myParameter", mdc);
work.setParameterDefinitions(((Work) value).getParameterDefinitions());
return work;
}
public Work getWork() {
return (Work) getValue();
}
public void setWork(Work work) {
setValue(work);
}
public void setWorkDefinition(WorkDefinition workDefinition) {
}
public boolean show() {
int result = open();
return result == OK;
}
}
WorkItemDefinition (reduced to one parameter for this code example):
[
[
"name" : "MyServiceTask",
"parameters" : [
"myParameter" : new ObjectDataType("my.package.MyDomainClass"),
],
"displayName" : "do fancy stuff",
"customEditor" : "my.package.MyDialog"
],
]