if (indexes[1] == 2) {
if (INPUT_VALUE.equals(combo.getText())) {
String oldUserInput = (String) combo.getData(DATA_USER_INPUT_KEY);
Variable variable1 = (Variable) comboBoxes[indexes[0]][0].getData(DATA_VARIABLE_KEY);
BSHTypeSupport typeSupport = BSHTypeSupport.getByFormat(variable1.getFormat());
UserInputDialog inputDialog = typeSupport.createUserInputDialog(INPUT_VALUE, oldUserInput);
if (OK == inputDialog.open()) {
String userInput = inputDialog.getUserInput();
if (oldUserInput != null) {
combo.remove(0);
}
combo.setData(DATA_USER_INPUT_KEY, userInput);
combo.add(userInput, 0);
combo.select(0);
} else {
combo.deselectAll();
}
} else {
Variable variable = getVariableByName(combo.getText());
if (variable != null) {
combo.setData(DATA_VARIABLE_KEY, variable);
}
}
return;
}
Combo targetCombo = comboBoxes[indexes[0]][indexes[1] + 1];
targetCombo.setItems(new String[0]);
if (indexes[1] == 0) {
// there was changed value in first (variable) combo in 'i' row
Variable variable = getVariableByName(combo.getText());
combo.setData(DATA_VARIABLE_KEY, variable);
if (variable != null) {
BSHTypeSupport typeSupport = BSHTypeSupport.getByFormat(variable.getFormat());
for (Operation operation : Operation.getAll(typeSupport)) {
targetCombo.add(operation.getVisibleName());
}
}
} else if (indexes[1] == 1) {
// there was changed value in second (operation) combo in 'i'
// row
Variable variable1 = (Variable) comboBoxes[indexes[0]][0].getData(DATA_VARIABLE_KEY);
if (variable1 != null) {
BSHTypeSupport typeSupport = BSHTypeSupport.getByFormat(variable1.getFormat());
Operation operation = Operation.getByName(combo.getText(), typeSupport);
combo.setData(DATA_OPERATION_KEY, operation);
for (String variableName : getCombo3VariableNames(variable1)) {
targetCombo.add(variableName);
}
for (String pv : typeSupport.getPredefinedValues(operation)) {
targetCombo.add(pv);
}
if (typeSupport.hasUserInputEditor()) {
targetCombo.add(INPUT_VALUE);
}
}
}
} catch (RuntimeException e) {