@Override public Screen runDialog() throws IOException { getOut().println("Enter helper's user name: "); String helperUserName = getUi().readInput(getIn()); getOut().println("Enter helper's estimated number of work hours: "); double helper_estimated_no_hours; while (true) { try { helper_estimated_no_hours = Double.parseDouble(getUi().readInput(getIn())); } catch (NumberFormatException e) { getOut().println("Enter a valid number"); continue; } break; } try { getTask() .assignHelper(getApp().getEmployeeByUsername(helperUserName), helper_estimated_no_hours); } catch (OperationNotAllowedException e) { getOut().println(e.getErrorDescription()); return null; } getOut().println("Changes are saved."); return null; }
@Override public Screen runDialog() throws IOException { getOut().println("Enter new name: "); String newName = getUi().readInput(getIn()); try { getProject().setName(newName); } catch (OperationNotAllowedException e) { getOut().println(e.getErrorDescription()); return null; } getOut().println("Changes are saved."); return null; }