1 2 24 package org.enhydra.tool.codegen; 25 26 import org.enhydra.tool.ToolBoxInfo; 28 import org.enhydra.tool.common.ResUtil; 29 import org.enhydra.tool.common.SwingUtil; 30 31 import java.util.ResourceBundle ; 33 34 public class Main { 36 static ResourceBundle res = ResourceBundle.getBundle("org.enhydra.tool.codegen.Res"); static private final String PARAM_DEBUG = "-debug"; static private final String PARAM_LIST = "-list"; static private final String PARAM_HELP = "-help"; 63 public static void main(String [] args) { 64 System.out.println("Kelp Application Wizard " + 65 ToolBoxInfo.getToolBoxVersion()); 66 System.out.println(ToolBoxInfo.getCopyright()); 67 for (int i = 0; i < args.length; i++) { 68 if (args[i].trim().equalsIgnoreCase(Main.PARAM_DEBUG)) { 69 CodeGen.debug = true; 70 if (args.length == 1) { 71 args = new String [0]; 72 } 73 break; 74 } 75 } 76 try { 77 if ((args.length != 2) && (args.length >= 1) 78 && (args[0].length() > 0 && args[0].charAt(0) == '-') 79 && (!args[0].equalsIgnoreCase(Main.PARAM_LIST))) { 80 Main.showHelp(); 81 } else { 82 CodeGen codeGen; 83 84 if (args.length < 1) { 85 codeGen = new CodeGen(true); 86 SwingUtil.setLookAndFeelToSystem(); 87 codeGen.invokeWizard(null); 88 } else if ((args.length >= 2) 89 && args[0].trim().equalsIgnoreCase(Main.PARAM_HELP)) { 90 codeGen = new CodeGen(); 91 codeGen.showGeneratorOptionHelp(args[1]); 92 } else if (args[0].trim().equalsIgnoreCase(Main.PARAM_LIST)) { 93 codeGen = new CodeGen(); 94 codeGen.list(); 95 } else { 96 codeGen = new CodeGen(); 97 codeGen.invokeGenerator(args); 98 } 99 } 100 } catch (GeneratorException e) { 101 if (CodeGen.debug) { 102 e.printStackTrace(); 103 } else { 104 System.out.println(e.getMessage()); 105 } 106 } 107 System.exit(0); 108 } 109 110 114 private static void showHelp() { 115 System.out.println(new String ()); 116 System.out.println(res.getString("Usage01")); 117 System.out.println(res.getString("Usage02")); 118 System.out.println(res.getString("Usage03")); 119 System.out.println(new String ()); 120 System.out.println(res.getString("Usage04")); 121 System.out.println(new String ()); 122 System.out.println(res.getString("Usage05")); 123 System.out.println(res.getString("Usage06")); 124 System.out.println(res.getString("Usage07")); 125 System.out.println(res.getString("Usage08")); 126 System.out.println(ResUtil.format(res.getString("Usage09"), ToolBoxInfo.getPropertyFilename())); 127 System.out.println(res.getString("Usage10")); 128 System.out.println(res.getString("Usage11")); 129 } 130 131 132 } | Popular Tags |