Search in sources :

Example 1 with OSXQuitHandler

use of org.zaproxy.zap.view.osxhandlers.OSXQuitHandler in project zaproxy by zaproxy.

the class OsXGui method setup.

/**
     * Setups the GUI of ZAP for OSX.
     * <p>
     * Sets OS X related GUI properties and functionalities.
     */
public static void setup() {
    // Set the various and sundry OS X-specific system properties
    System.setProperty("apple.laf.useScreenMenuBar", "true");
    // Broken and unfixed; thanks, Apple
    System.setProperty("dock:name", "ZAP");
    // more thx
    System.setProperty("com.apple.mrj.application.apple.menu.about.name", "ZAP");
    // Override various handlers, so that About, Preferences, and Quit behave in an OS X typical fashion.
    LOGGER.info("Initializing OS X specific settings, despite Apple's best efforts");
    // Attempt to load the apple classes
    Application app = Application.getApplication();
    // Set the dock image icon
    Image img = Toolkit.getDefaultToolkit().getImage(GuiBootstrap.class.getResource("/resource/zap1024x1024.png"));
    app.setDockIconImage(img);
    // Set handlers for About and Preferences
    app.setAboutHandler(new OSXAboutHandler());
    app.setPreferencesHandler(new OSXPreferencesHandler());
    // Let's not forget to clean up our database mess when we Quit
    OSXQuitHandler quitHandler = new OSXQuitHandler();
    // quitHandler.removeZAPViewItem(view); // TODO
    app.setQuitHandler(quitHandler);
}
Also used : OSXAboutHandler(org.zaproxy.zap.view.osxhandlers.OSXAboutHandler) Image(java.awt.Image) Application(com.apple.eawt.Application) OSXPreferencesHandler(org.zaproxy.zap.view.osxhandlers.OSXPreferencesHandler) OSXQuitHandler(org.zaproxy.zap.view.osxhandlers.OSXQuitHandler)

Aggregations

Application (com.apple.eawt.Application)1 Image (java.awt.Image)1 OSXAboutHandler (org.zaproxy.zap.view.osxhandlers.OSXAboutHandler)1 OSXPreferencesHandler (org.zaproxy.zap.view.osxhandlers.OSXPreferencesHandler)1 OSXQuitHandler (org.zaproxy.zap.view.osxhandlers.OSXQuitHandler)1