Class PlatformHookOsx

  • All Implemented Interfaces:
    PlatformHook

    public class PlatformHookOsx
    extends java.lang.Object
    implements PlatformHook
    PlatformHook implementation for Apple macOS (formerly Mac OS X) systems.
    Since:
    1023
    • Method Detail

      • afterPrefStartupHook

        public void afterPrefStartupHook()
        Description copied from interface: PlatformHook
        The afterPrefStartupHook will be called early, but after the preferences have been loaded and basic processing of command line arguments is finished. It is guaranteed to be called before the GUI setup has started.
        Specified by:
        afterPrefStartupHook in interface PlatformHook
      • preStartupHook

        public void preStartupHook()
        Description copied from interface: PlatformHook
        The preStartupHook will be called extremely early. It is guaranteed to be called before the GUI setup has started.

        Reason: On OSX we need to inform the Swing libraries that we want to be integrated with the OS before we setup our GUI.

        Specified by:
        preStartupHook in interface PlatformHook
      • startupHook

        public void startupHook​(PlatformHook.JavaExpirationCallback javaCallback,
                                PlatformHook.SanityCheckCallback sanityCheckCallback)
        Description copied from interface: PlatformHook
        The startupHook will be called early, but after the GUI setup has started.

        Reason: On OSX we need to register some callbacks with the OS, so we'll receive events from the system menu.

        Specified by:
        startupHook in interface PlatformHook
        Parameters:
        javaCallback - Java expiration callback, providing GUI feedback
        sanityCheckCallback - Sanity check callback, providing GUI feedback
      • setHandlers

        protected void setHandlers()
        Registers Apple handlers.
      • enableOSXFullscreen

        public static void enableOSXFullscreen​(java.awt.Window window)
        Enables fullscreen support for the given window.
        Parameters:
        window - The window for which full screen will be available
        Since:
        7482
      • openUrl

        public void openUrl​(java.lang.String url)
                     throws java.io.IOException
        Description copied from interface: PlatformHook
        The openURL hook will be used to open a URL in the default web browser.
        Specified by:
        openUrl in interface PlatformHook
        Parameters:
        url - The URL to open
        Throws:
        java.io.IOException - if any I/O error occurs
      • initSystemShortcuts

        public void initSystemShortcuts()
        Description copied from interface: PlatformHook
        The initSystemShortcuts hook will be called by the Shortcut class after the modifier groups have been read from the config, but before any shortcuts are read from it or registered from within the application.

        Please note that you are not allowed to register any shortcuts from this hook, but only "systemCuts"!

        BTW: SystemCuts should be named "system:<whatever>", and it'd be best if you'd recycle the names already used by the Windows and OSX hooks. Especially the latter has really many of them.

        You should also register any and all shortcuts that the operating system handles itself to block JOSM from trying to use them---as that would just not work. Call setAutomatic on them to prevent the keyboard preferences from allowing the user to change them.

        Specified by:
        initSystemShortcuts in interface PlatformHook
      • getHome

        private static java.lang.String getHome()
      • getDefaultStyle

        public java.lang.String getDefaultStyle()
        Description copied from interface: PlatformHook
        Returns the default LAF to be used on this platform to look almost as a native application.
        Specified by:
        getDefaultStyle in interface PlatformHook
        Returns:
        The default native LAF for this platform
      • canFullscreen

        public boolean canFullscreen()
        Description copied from interface: PlatformHook
        Determines if the platform allows full-screen.
        Specified by:
        canFullscreen in interface PlatformHook
        Returns:
        true if full screen is allowed, false otherwise
      • getX509Certificate

        public java.security.cert.X509Certificate getX509Certificate​(CertificateAmendment.NativeCertAmend certAmend)
                                                              throws java.io.IOException
        Description copied from interface: PlatformHook
        Returns the X509Certificate matching the given certificate amendment information.
        Specified by:
        getX509Certificate in interface PlatformHook
        Parameters:
        certAmend - certificate amendment
        Returns:
        the X509Certificate matching the given certificate amendment information, or null
        Throws:
        java.io.IOException - in case of error