@Override public void widgetSelected(SelectionEvent e) { updateLaunchConfigurationDialog(); } });
/** * Removes the selected environment variable from the table. */ private void handleEnvRemoveButtonSelected() { IStructuredSelection sel = environmentTable.getStructuredSelection(); try { environmentTable.getControl().setRedraw(false); for (Iterator<?> i = sel.iterator(); i.hasNext();) { EnvironmentVariable var = (EnvironmentVariable) i.next(); environmentTable.remove(var); } } finally { environmentTable.getControl().setRedraw(true); } updateAppendReplace(); updateLaunchConfigurationDialog(); }
/** * Attempts to add the given variable. Returns whether the variable * was added or not (as when the user answers not to overwrite an * existing variable). * @param variable the variable to add * @return whether the variable was added */ protected boolean addVariable(EnvironmentVariable variable) { String name= variable.getName(); TableItem[] items = environmentTable.getTable().getItems(); for (int i = 0; i < items.length; i++) { EnvironmentVariable existingVariable = (EnvironmentVariable) items[i].getData(); if (existingVariable.getName().equals(name)) { boolean overWrite = MessageDialog.openQuestion(getShell(), LaunchConfigurationsMessages.EnvironmentTab_12, MessageFormat.format(LaunchConfigurationsMessages.EnvironmentTab_13, new Object[] { name })); // if (!overWrite) { return false; } environmentTable.remove(existingVariable); break; } } environmentTable.add(variable); updateLaunchConfigurationDialog(); return true; }
/** * Displays a dialog that allows user to select native environment variables * to add to the table. */ private void handleEnvSelectButtonSelected() { //get Environment Variables from the OS Map<String, EnvironmentVariable> envVariables = getNativeEnvironment(); //get Environment Variables from the table TableItem[] items = environmentTable.getTable().getItems(); for (int i = 0; i < items.length; i++) { EnvironmentVariable var = (EnvironmentVariable) items[i].getData(); envVariables.remove(var.getName()); } NativeEnvironmentSelectionDialog dialog = new NativeEnvironmentSelectionDialog(getShell(), envVariables); dialog.setTitle(LaunchConfigurationsMessages.EnvironmentTab_20); int button = dialog.open(); if (button == Window.OK) { Object[] selected = dialog.getResult(); for (int i = 0; i < selected.length; i++) { environmentTable.add(selected[i]); } } updateAppendReplace(); updateLaunchConfigurationDialog(); }
var.setValue(value); environmentTable.update(var, null); updateLaunchConfigurationDialog();