/**
* Creates an editor for the value of the selected environment variable.
*/
private void handleEditButton() {
IStructuredSelection sel= (IStructuredSelection) envTableViewer.getSelection();
NameValue var= (NameValue) sel.getFirstElement();
if (var == null) {
return;
}
String oldName = var.getName();
EditParamWizard wizard = new EditParamWizard(Messages.DDE_EnvVariable_Wizard_EDIT_Title,
Messages.DDE_EnvVariable_Wizard_EDIT_Description, var.getName(), var.getValue());
WizardDialog dialog = new WizardDialog(form.getShell(), wizard);
if (dialog.open() != Window.OK) {
return;
}
String name = wizard.getName();
String value = wizard.getValue();
// Delete OLD name/value from Map
envName2NameValueMap.remove(oldName);
if (name.length() == 0) {
// Delete OLD name/value from Table
envTableViewer.remove(var);
envTableViewer.refresh();
updateEnvironmentVariables ();
return;
}
if (!oldName.equals(name)) {
envTableViewer.remove(var);
var = new NameValue(name, value);
addAndCheckVariable(var);
} else {
var.setValue(value);
envTableViewer.update(var, null);
}
envName2NameValueMap.put(name, var);
updateEnvironmentVariables ();
}