- java.lang.Object
-
- de.carne.test.swt.platform.PlatformHelper
-
- Direct Known Subclasses:
Win32PlatformHelper
public abstract class PlatformHelper extends java.lang.ObjectUtility class providing platform specific functions.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPlatformHelper()Constructs a new PlatformHelper instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleancloseNativeDialogs(org.eclipse.swt.widgets.Display display)Makes sure that any open native platform dialog is closed.static java.nio.file.PathgrabScreen(java.nio.file.Path dir)Tries to grab the screen and stores a screenshot by invoking a platform dependent command.static booleaninNativeDialog(org.eclipse.swt.widgets.Display display)Checks whether a native platform dialog is currently open.protected booleaninternalCloseNativeDialogs(org.eclipse.swt.widgets.Display display)Makes sure that any open native platform dialog is closed.protected java.nio.file.PathinternalGrabScreen(java.nio.file.Path dir)Tries to grab the screen and stores a screenshot by invoking a platform dependent command.protected booleaninternalInNativeDialog(org.eclipse.swt.widgets.Display display)Checks whether a native platform dialog is currently open.protected booleaninternalIsCurrentThreadSWTCapable()Checks whether SWT code can be executed by the current thread.static booleanisCurrentThreadSWTCapable()Checks whether SWT code can be executed by the current thread.
-
-
-
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:
trueif the current thread can execute SWT code.
-
internalIsCurrentThreadSWTCapable
protected boolean internalIsCurrentThreadSWTCapable()
Checks whether SWT code can be executed by the current thread.- Returns:
trueif 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:
trueif 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:
trueif 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:
trueif 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:
trueif 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.IOExceptionTries 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.IOExceptionTries 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.
-
-