Normally you would write:
addVariablePropertyDescriptors(list,
new PropDescData(FlowItem.PROP_RESULT_VAR, "Result Variable","The variable that receives the result."),
new PropDescData(FlowItem.PROP_RESULT_VARFIELD, "Result Variable Field", "The variable field that receives the result."),
null);
Which ends up calling
protected final void addVariablePropertyDescriptors(List<IPropertyDescriptor> list, PropDescData var, PropDescData field,
PropDescData constant, boolean constLast) {
if (var == null || field == null) {
throw new IllegalArgumentException("Variable descriptor data is not valid.");
}
// add constant if it is supposed to be first.
if (constant != null && !constLast) {
addTextPropertyDescriptor(list, constant.propId, constant.display, constant.description);
}
// store the data for the variable/field/constant so we can handle get/set property later on
addVarPropIdHolder(new VarPropIdHolder(var, field, constant));
// add variable
String[] variables = getProjectVariables();
addEnumPropertyDescriptor(list, var.propId, variables, var.display, var.description);
// add field for complex variables
String varName = getFlowItem().getProperty(var.propId);
String[] fields = getVariableFields(varName);
addEnumPropertyDescriptor(list, field.propId, fields, field.display, field.description);
// add const
if (constant != null && constLast) {
addTextPropertyDescriptor(list, constant.propId, constant.display, constant.description);
}
}
You would need to copy the above and instead of using getProjectVariables, substuite your own method. As an example, the following method return variables that match the input field list.
protected String[] getVariableWithMatchingFields(String[] fields) {
CallFlowEditor cfe = (CallFlowEditor) getMultiPageEditor();
Collection c = cfe.getProjectVariables();
ArrayList<String> vars = new ArrayList<String>();
for (Iterator iter = c.iterator(); iter.hasNext();) {
IVariableInfo var = (IVariableInfo) iter.next();
if (var.isComplex() == true) {
String[] temp = ((IComplexVariableInfo) var).getFieldNames();
boolean match = true;
if (temp.length == fields.length) {
for (int i = 0; i < temp.length; i++) {
if (temp[i].equalsIgnoreCase(fields[i]) == false) {
match = false;
break;
}
}
} else {
match = false;
}
if (match == true) {
vars.add(var.getName());
}
}
}
return (vars.toArray(new String[0]));
}