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 void addExisted(IStructuredSelection selection) { EnvironmentVariable[] libs = addExisted(); if (libs == null) return; EnvironmentVariable[] old = this.fEnvironmentVariablesContentProvider.getVariables(); fEnvironmentVariablesContentProvider.add(libs, selection); fDialog.updateLibraries(this.fEnvironmentVariablesContentProvider.getVariables(), old); update(); }