}
enable();
}
private void addOrEditOverride(TreeItem parent, int overrideIndex) {
ConfigurationParameter cp = getCorrespondingModelParm(parent);
Map delegateMap1 = editor.getResolvedDelegates();
Map delegateMap = null;
if (null != delegateMap1) {
delegateMap = new HashMap(delegateMap1.size());
delegateMap.putAll(delegateMap1);
FlowControllerDeclaration fcd = editor.getResolvedFlowControllerDeclaration();
if (null != fcd) {
delegateMap.put(fcd.getKey(), fcd.getSpecifier());
}
}
// only picks one override key - but code is from earlier design where multiple keys were
// possible
PickOverrideKeysAndParmName dialog = new PickOverrideKeysAndParmName(this, delegateMap,
"Override Keys and Parameter Name Selection", cp, cpd, overrideIndex == -1);
dialog.setTitle("Delegate Keys and Parameter Name Selection");
dialog
.setMessage("Select the override key path from the left panel, and the overridden parameter from the right panel.\nOnly valid parameters will be shown.");
if (dialog.open() == Window.CANCEL)
return;
String delegateKeyName = dialog.delegateKeyName;
String delegateParameterName = dialog.delegateParameterName;
// update the existing item
// have to do a 3 step update because the getOverrides returns a
// cloned array
valueChanged = false;
String overrideSpec = delegateKeyName + '/' + delegateParameterName;
// updateOneOverride(cp, overrideIndex, dialog.overrideSpec);
if (overrideIndex < 0) {
addOverride(cp, overrideSpec);
valueChanged = true;
} else {
String[] overrides = cp.getOverrides();
overrides[overrideIndex] = setValueChanged(overrideSpec, overrides[overrideIndex]);
cp.setOverrides(overrides);
parent.getItems()[overrideIndex].setText(OVERRIDE_HEADER + overrideSpec);
}
// TODO consequences of changes in rest of model?
commonActionFinishDirtyIfChange();
}