Package net.sourceforge.ganttproject.export

Examples of net.sourceforge.ganttproject.export.CommandLineExportApplication


        return myResourceActions;
    }

    /** The main */
    public static void main(String[] arg) {
        CommandLineExportApplication cmdlineApplication = new CommandLineExportApplication();
        HashMap parsedArgs = new HashMap();
        String argName = "";
        for (int i=0; i<arg.length; i++) {
            String nextWord = arg[i];
            if (nextWord.charAt(0) == '-'){
                if (argName.length()!=0) {
                    parsedArgs.put(argName, Collections.EMPTY_LIST);
                }
                argName = nextWord.toLowerCase();
            } else {
                List values = (List) parsedArgs.get(argName);
                if (values==null || values==Collections.EMPTY_LIST) {
                    values = new ArrayList();
                    parsedArgs.put(argName, values);
                }
                values.add(nextWord);
                if (!cmdlineApplication.getCommandLineFlags().contains(argName)) {
                    argName = "";
                }
            }
        }
        if (argName.length()>0 && !parsedArgs.containsKey(argName)) {
            parsedArgs.put(argName, Collections.EMPTY_LIST);           
        }
        if (parsedArgs.containsKey("-h") || parsedArgs.containsKey("--help")) {
            usage();
            System.exit(0);
        }
        if (parsedArgs.containsKey("-log")) {
            List values = (List) parsedArgs.get("-log");           
            String logFileName = values.isEmpty() ?
                    System.getProperty("user.home") +"/.ganttproject.log" :
                    String.valueOf(values.get(0));
            File logFile = new File(logFileName);
            try {
                System.setErr(new PrintStream(new FileOutputStream(logFile)));
                System.out.println("Writing log to " + logFile.getAbsolutePath());
            } catch (FileNotFoundException e) {
                System.err.println("Failed to redirect error log to file="+logFileName);
                e.printStackTrace();
            }
        }
        if (false==cmdlineApplication.export(parsedArgs)) {
          GanttSplash splash = new GanttSplash();
          try {
            splash.setVisible(true);
            GanttProject ganttFrame = new GanttProject(false);
            System.err.println("Main frame created");
View Full Code Here

TOP

Related Classes of net.sourceforge.ganttproject.export.CommandLineExportApplication

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.