* selected command. False will ONLY edit an existing command, if one is
* currently selected. Otherwise it will add a new command.
*/
protected void addOrEditCommand(boolean add) {
ServerService service = getSelectedService();
if (service != null) {
ServiceCommand serviceCommandToEdit = !add ? getSelectedCommand() : null;
ServiceCommandWizard wizard = new ServiceCommandWizard(serviceCommands, service, serviceCommandToEdit);
Shell shell = getShell();
if (shell != null) {
WizardDialog dialog = new WizardDialog(shell, wizard);
if (dialog.open() == Window.OK) {
ServiceCommand editedCommand = wizard.getEditedServiceCommand();
if (editedCommand != null) {
// Add the new one
boolean added = new ServiceCommandManager(serviceCommands).addCommand(service.getServiceInfo(),
editedCommand);
if (!added) {
notifyStatusChange(CloudFoundryPlugin.getErrorStatus(Messages.ServiceTunnelCommandPart_ERROR_FAIL_TO_ADD
+ editedCommand.getDisplayName()));