1 22 23 package org.continuent.sequoia.console.text.commands; 24 25 import java.util.List ; 26 import java.util.StringTokenizer ; 27 28 import org.continuent.sequoia.common.i18n.ConsoleTranslate; 29 import org.continuent.sequoia.console.text.module.AbstractConsoleModule; 30 31 37 public class History extends ConsoleCommand 38 { 39 40 45 public History(AbstractConsoleModule module) 46 { 47 super(module); 48 } 49 50 53 public void parse(String commandText) throws Exception 54 { 55 List list = module.getConsole().getHistory(); 56 StringTokenizer st = new StringTokenizer (commandText); 57 if (st.countTokens() == 0) 58 { 59 for (int i = 0; i < list.size(); i++) 60 { 61 Object o = list.get(i); 62 console.println("" + i + "\t" + o); } 64 } 65 else 66 { 67 int line = Integer.parseInt(st.nextToken()); 68 console.printInfo((String ) list.get(line)); 69 module.handleCommandLine((String ) list.get(line), 70 module.getHashCommands()); 71 } 72 } 73 74 77 public String getCommandName() 78 { 79 return "history"; } 81 82 85 public String getCommandDescription() 86 { 87 return ConsoleTranslate.get("console.command.history"); } 89 90 93 public String getCommandParameters() 94 { 95 return "[<command index>]"; } 97 } | Popular Tags |