private String generatePrompt() { StringBuffer prompt = new StringBuffer(); CMOption opt; prompt.append(itsTitle); for (int i = 0; i < itsOptions.size(); i++) { opt = (CMOption) itsOptions.get(i); prompt.append(LINE_SEP); prompt.append(i + 1).append(": ").append(opt.getName()); } prompt.append(LINE_SEP); prompt.append("You may enter multiple choices, separated by commas."); return prompt.toString(); }
public void execute() throws BuildException { validateAttributes(); Project project = getProject(); InputHandler in = project.getInputHandler(); CMInputRequest inputRequest = new CMInputRequest(generatePrompt(), itsOptions.size()); in.handleInput(inputRequest); List choices = inputRequest.getChoicesMade(); Integer idx; CMOption opt; for (int i = 0; i < choices.size(); i++) { idx = (Integer) choices.get(i); opt = (CMOption) itsOptions.get(idx.intValue() - 1); opt.perform(); } }