/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:set ts=4 sw=4 sts=4 et: */
package jp.oist.flint.command;

import org.apache.log4j.Logger;
import java.lang.reflect.InvocationTargetException;
import javax.swing.SwingUtilities;
import jp.oist.flint.form.MainFrame;

public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(final String args[]) {
        try {

            new Main(args);

        } catch (InvocationTargetException | InterruptedException ex) {
            Logger.getRootLogger().fatal(ex.getMessage());
            System.exit(1);
        }
    }

    private final MainFrame mMainFrame;

    public Main (String[] args) throws InvocationTargetException, InterruptedException {
        CommandLineArguments commandLineArgs = new CommandLineArguments();
        commandLineArgs.parse(args);

        Setup setup = new Setup(commandLineArgs);

        SwingUtilities.invokeAndWait(setup);

        Runnable launcher = setup.getLauncher();

        SwingUtilities.invokeAndWait(launcher);

        if (launcher instanceof Launch) {
            mMainFrame = ((Launch)launcher).getMainFrame();
        } else {
            mMainFrame = null;
        }
    }
        

    public MainFrame getMainFrame () {
        return mMainFrame;
    }
}

@@ -256,45 +256,8 @@
 ies;
-%0Aimport jp.oist.flint.form.MainFrame;
 %0A%0Apu
@@ -406,344 +406,12 @@
 y %7B%0A
-%0A
     
-        new Main(args);%0A%0A        %7D catch (InvocationTargetException %7C InterruptedException ex) %7B%0A            Logger.getRootLogger().fatal(ex.getMessage());%0A            System.exit(1);%0A        %7D%0A    %7D%0A%0A    private final MainFrame mMainFrame;%0A%0A    public Main (String%5B%5D args) throws InvocationTargetException, InterruptedException %7B%0A
     
@@ -489,16 +489,20 @@
         
+    
 commandL
@@ -522,25 +522,26 @@
 (args);%0A
-%0A
+  
         
 Setup se
@@ -532,16 +532,18 @@
         
+  
 Setup se
@@ -576,25 +576,26 @@
 eArgs);%0A
-%0A
+  
         
 SwingUti
@@ -578,32 +578,34 @@
 rgs);%0A          
+  
 SwingUtilities.i
@@ -625,17 +625,20 @@
 setup);%0A
-%0A
+    
         
@@ -678,17 +678,20 @@
 cher();%0A
-%0A
+    
         
@@ -730,25 +730,24 @@
 ncher);%0A
-%0A
         
 if (laun
@@ -742,100 +742,129 @@
     
-if (launcher instanceof Launch) %7B%0A            mMainFrame = ((Launch)launcher).getMainFram
+%7D catch (InvocationTargetException %7C InterruptedException ex) %7B%0A            Logger.getRootLogger().fatal(ex.getMessag
 e()
+)
 ;%0A  
@@ -873,139 +873,37 @@
     
-%7D else %7B%0A            mMainFrame = null;%0A        %7D%0A    %7D%0A        %0A%0A    public MainFrame getMainFrame () %7B%0A        return mMainFrame;
+    System.exit(1);%0A        %7D
 %0A   

simplify the main class