1 19 20 package org.netbeans.lib.cvsclient.commandLine.command; 21 22 import java.io.PrintStream ; 23 import java.text.MessageFormat ; 24 import java.util.ResourceBundle ; 25 26 import org.netbeans.lib.cvsclient.command.Command; 27 28 35 abstract class AbstractCommandProvider implements CommandProvider { 36 37 41 public String getName() { 42 String className = getClass().getName(); 43 int dot = className.lastIndexOf('.'); 44 if (dot > 0) { 45 return className.substring(dot + 1); 46 } else { 47 return className; 48 } 49 } 50 51 public String getUsage() { 52 return ResourceBundle.getBundle(CommandProvider.class.getPackage().getName()+".Bundle").getString(getName()+".usage"); } 54 55 public void printShortDescription(PrintStream out) { 56 String msg = ResourceBundle.getBundle(CommandProvider.class.getPackage().getName()+".Bundle").getString(getName()+".shortDescription"); out.print(msg); 58 } 59 60 public void printLongDescription(PrintStream out) { 61 String msg = ResourceBundle.getBundle(CommandProvider.class.getPackage().getName()+".Bundle").getString(getName()+".longDescription"); out.println(MessageFormat.format(msg, new Object [] { getUsage() })); 63 } 64 65 } 66 | Popular Tags |