private void edit(IStructuredSelection selection) {
    IStructuredSelection sel = (IStructuredSelection) selection;
    EnvironmentVariable var = (EnvironmentVariable) sel.getFirstElement();
    if (var == null) {
      return;
    }
    String originalName = var.getName();
    String value = var.getValue();
    MultipleInputDialog dialog =
        new MultipleInputDialog(
            fDialog.getShell(),
            InterpretersMessages.AbstractInterpreterEnvironmentVariablesBlock_editVariable);
    dialog.addTextField(NAME_LABEL, originalName, false);
    dialog.addVariablesField(VALUE_LABEL, value, true);

    if (dialog.open() != Window.OK) {
      return;
    }
    String name = dialog.getStringValue(NAME_LABEL);
    value = dialog.getStringValue(VALUE_LABEL);
    if (!originalName.equals(name)) {
      fEnvironmentVariablesContentProvider.add(
          new EnvironmentVariable[] {new EnvironmentVariable(name, value)}, selection);
    } else {
      var.setValue(value);
      fVariablesViewer.refresh(true);
    }
  }
  private EnvironmentVariable[] add() {
    MultipleInputDialog dialog =
        new MultipleInputDialog(
            fDialog.getShell(),
            InterpretersMessages.AbstractInterpreterEnvironmentVariablesBlock_addVariable);
    dialog.addTextField(NAME_LABEL, null, false);
    dialog.addVariablesField(VALUE_LABEL, null, true);

    if (dialog.open() != Window.OK) {
      return null;
    }

    String name = dialog.getStringValue(NAME_LABEL);
    String value = dialog.getStringValue(VALUE_LABEL);

    if (name != null && value != null && name.length() > 0 && value.length() > 0) {
      return new EnvironmentVariable[] {new EnvironmentVariable(name.trim(), value.trim())};
    }
    return null;
  }