1 24 25 package org.objectweb.cjdbc.console.text.commands; 26 27 import java.util.LinkedList ; 28 import java.util.StringTokenizer ; 29 30 import org.objectweb.cjdbc.common.i18n.ConsoleTranslate; 31 import org.objectweb.cjdbc.console.text.module.AbstractConsoleModule; 32 33 39 public class History extends ConsoleCommand 40 { 41 42 47 public History(AbstractConsoleModule module) 48 { 49 super(module); 50 } 51 52 55 public void parse(String commandText) throws Exception 56 { 57 LinkedList list = module.getHistory(); 58 StringTokenizer st = new StringTokenizer (commandText); 59 if (st.countTokens() == 0) 60 { 61 for (int i = 0; i < list.size(); i++) 62 { 63 Object o = list.get(i); 64 console.println("[" + i + "]\t" + o); 65 } 66 } 67 else 68 { 69 int line = Integer.parseInt(st.nextToken()); 70 module.handleCommandLine((String ) list.get(line), module 71 .getHashCommands()); 72 } 73 } 74 75 78 public String getCommandName() 79 { 80 return "history"; 81 } 82 83 86 public String getCommandDescription() 87 { 88 return ConsoleTranslate.get("console.command.history"); 89 } 90 91 94 public String getCommandParameters() 95 { 96 return "[<commandIndex>]"; 97 } 98 } | Popular Tags |