Search in sources :

Example 1 with CreateApplicationGui

use of org.kse.gui.CreateApplicationGui in project keystore-explorer by kaikramer.

the class KSE method main.

/**
 * Start the KeyStore Explorer application. Takes one optional argument -
 * the location of a KeyStore file to open upon startup.
 *
 * @param args
 *            the command line arguments
 */
public static void main(String[] args) {
    try {
        // To take affect these must be set before the splash screen is instantiated
        if (OperatingSystem.isMacOs()) {
            setAppleSystemProperties();
        } else if (OperatingSystem.isWindows7() || OperatingSystem.isWindows8() || OperatingSystem.isWindows10()) {
            String appId = props.getString("KSE.AppUserModelId");
            Shell32 shell32 = (Shell32) Native.loadLibrary("shell32", Shell32.class);
            shell32.SetCurrentProcessExplicitAppUserModelID(new WString(appId)).longValue();
        } else if (OperatingSystem.isLinux()) {
            fixAppClassName();
        }
        setInstallDirProperty();
        SplashScreen splash = SplashScreen.getSplashScreen();
        updateSplashMessage(splash, res.getString("KSE.LoadingApplicationSettings.splash.message"));
        ApplicationSettings applicationSettings = ApplicationSettings.getInstance();
        setCurrentDirectory(applicationSettings);
        updateSplashMessage(splash, res.getString("KSE.InitializingSecurity.splash.message"));
        initialiseSecurity();
        // list of files to open after start
        List<File> parameterFiles = new ArrayList<File>();
        for (String arg : args) {
            File parameterFile = new File(arg);
            if (parameterFile.exists()) {
                parameterFiles.add(parameterFile);
            }
        }
        // Create application GUI on the event handler thread
        updateSplashMessage(splash, res.getString("KSE.CreatingApplicationGui.splash.message"));
        SwingUtilities.invokeLater(new CreateApplicationGui(applicationSettings, splash, parameterFiles));
    } catch (Throwable t) {
        DError dError = new DError(new JFrame(), t);
        dError.setLocationRelativeTo(null);
        dError.setVisible(true);
        System.exit(1);
    }
}
Also used : WString(com.sun.jna.WString) JFrame(javax.swing.JFrame) ArrayList(java.util.ArrayList) SplashScreen(java.awt.SplashScreen) CreateApplicationGui(org.kse.gui.CreateApplicationGui) WString(com.sun.jna.WString) File(java.io.File) DError(org.kse.gui.error.DError)

Aggregations

WString (com.sun.jna.WString)1 SplashScreen (java.awt.SplashScreen)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 JFrame (javax.swing.JFrame)1 CreateApplicationGui (org.kse.gui.CreateApplicationGui)1 DError (org.kse.gui.error.DError)1