Search in sources :

Example 1 with AboutAction

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

the class MacOsIntegration method invoke.

@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
    if ("openFiles".equals(method.getName())) {
        if (args[0] != null) {
            Object files = args[0].getClass().getMethod("getFiles").invoke(args[0]);
            if (files instanceof List) {
                OpenAction openAction = new OpenAction(kseFrame);
                for (File file : (List<File>) files) {
                    openAction.openKeyStore(file);
                }
            }
        }
    } else if ("handleQuitRequestWith".equals(method.getName())) {
        ExitAction exitAction = new ExitAction(kseFrame);
        exitAction.exitApplication();
        // If we have returned from the above call the user has decied not to quit
        if (args[1] != null) {
            args[1].getClass().getDeclaredMethod("cancelQuit").invoke(args[1]);
        }
    } else if ("handleAbout".equals(method.getName())) {
        AboutAction aboutAction = new AboutAction(kseFrame);
        aboutAction.showAbout();
    } else if ("handlePreferences".equals(method.getName())) {
        PreferencesAction preferencesAction = new PreferencesAction(kseFrame);
        preferencesAction.showPreferences();
    }
    return null;
}
Also used : PreferencesAction(org.kse.gui.actions.PreferencesAction) OpenAction(org.kse.gui.actions.OpenAction) ExitAction(org.kse.gui.actions.ExitAction) AboutAction(org.kse.gui.actions.AboutAction) List(java.util.List) File(java.io.File)

Aggregations

File (java.io.File)1 List (java.util.List)1 AboutAction (org.kse.gui.actions.AboutAction)1 ExitAction (org.kse.gui.actions.ExitAction)1 OpenAction (org.kse.gui.actions.OpenAction)1 PreferencesAction (org.kse.gui.actions.PreferencesAction)1