use of org.jboss.tools.openshift.internal.common.ui.wizard.KeyValueWizard in project jbosstools-openshift by jbosstools.
the class EnvironmentVariablePage method onAdd.
private SelectionListener onAdd() {
return new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Set<String> usedKeys = model.getEnvironmentVariables().stream().filter(v -> !model.isEnvironmentVariableDeleted(v)).map(v -> v.getKey()).collect(Collectors.toSet());
IKeyValueWizardModel<KeyValueItem> dialogModel = new KeyValueWizardModelBuilder<KeyValueItem>().windowTitle(ENVIRONMENT_VARIABLE_LABEL).title("Add " + ENVIRONMENT_VARIABLE_LABEL).description(NLS.bind("Add an {0}.", ENVIRONMENT_VARIABLE_LABEL.toLowerCase())).keyLabel(ENVIRONMENT_VARIABLE_KEY_LABEL).groupLabel(ENVIRONMENT_VARIABLE_LABEL).keyAfterConvertValidator(new EnvironmentVarKeyValidator(usedKeys)).build();
OkCancelButtonWizardDialog dialog = new OkCancelButtonWizardDialog(getShell(), new KeyValueWizard<>(dialogModel));
if (OkCancelButtonWizardDialog.OK == dialog.open()) {
model.addEnvironmentVariable(dialogModel.getKey(), dialogModel.getValue());
selectEnvVarByKey(dialogModel.getKey());
}
}
};
}
Aggregations