Class PlatformHelper

  • Direct Known Subclasses:
    Win32PlatformHelper

    public abstract class PlatformHelper
    extends java.lang.Object
    Utility class providing platform specific functions.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean closeNativeDialogs​(org.eclipse.swt.widgets.Display display)
      Makes sure that any open native platform dialog is closed.
      static java.nio.file.Path grabScreen​(java.nio.file.Path dir)
      Tries to grab the screen and stores a screenshot by invoking a platform dependent command.
      static boolean inNativeDialog​(org.eclipse.swt.widgets.Display display)
      Checks whether a native platform dialog is currently open.
      protected boolean internalCloseNativeDialogs​(org.eclipse.swt.widgets.Display display)
      Makes sure that any open native platform dialog is closed.
      protected java.nio.file.Path internalGrabScreen​(java.nio.file.Path dir)
      Tries to grab the screen and stores a screenshot by invoking a platform dependent command.
      protected boolean internalInNativeDialog​(org.eclipse.swt.widgets.Display display)
      Checks whether a native platform dialog is currently open.
      protected boolean internalIsCurrentThreadSWTCapable()
      Checks whether SWT code can be executed by the current thread.
      static boolean isCurrentThreadSWTCapable()
      Checks whether SWT code can be executed by the current thread.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PlatformHelper

        protected PlatformHelper()
        Constructs a new PlatformHelper instance.
    • Method Detail

      • isCurrentThreadSWTCapable

        public static boolean isCurrentThreadSWTCapable()
        Checks whether SWT code can be executed by the current thread.
        Returns:
        true if the current thread can execute SWT code.
      • internalIsCurrentThreadSWTCapable

        protected boolean internalIsCurrentThreadSWTCapable()
        Checks whether SWT code can be executed by the current thread.
        Returns:
        true if the current thread can execute SWT code.
        See Also:
        isCurrentThreadSWTCapable()
      • inNativeDialog

        public static boolean inNativeDialog​(org.eclipse.swt.widgets.Display display)
        Checks whether a native platform dialog is currently open.
        Parameters:
        display - the Display to use for checking.
        Returns:
        true if a native platform dialog is currently open.
      • internalInNativeDialog

        protected boolean internalInNativeDialog​(org.eclipse.swt.widgets.Display display)
        Checks whether a native platform dialog is currently open.
        Parameters:
        display - the Display to use for checking.
        Returns:
        true if a native platform dialog is currently open.
        See Also:
        inNativeDialog(Display)
      • closeNativeDialogs

        public static boolean closeNativeDialogs​(org.eclipse.swt.widgets.Display display)
        Makes sure that any open native platform dialog is closed.
        Parameters:
        display - the Display to use for checking.
        Returns:
        true if a native platform dialog has been closed.
      • internalCloseNativeDialogs

        protected boolean internalCloseNativeDialogs​(org.eclipse.swt.widgets.Display display)
        Makes sure that any open native platform dialog is closed.
        Parameters:
        display - the Display to use for checking.
        Returns:
        true if a native platform dialog has been closed.
        See Also:
        closeNativeDialogs(Display)
      • grabScreen

        public static java.nio.file.Path grabScreen​(java.nio.file.Path dir)
                                             throws java.io.IOException
        Tries to grab the screen and stores a screenshot by invoking a platform dependent command.
        Parameters:
        dir - the directory to store the screenshot into.
        Returns:
        the created screenshot file.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • internalGrabScreen

        protected java.nio.file.Path internalGrabScreen​(java.nio.file.Path dir)
                                                 throws java.io.IOException
        Tries to grab the screen and stores a screenshot by invoking a platform dependent command.
        Parameters:
        dir - the directory to store the screenshot into.
        Returns:
        the created screenshot file.
        Throws:
        java.io.IOException - if an I/O error occurs.