Class TmfFileDialogFactory
This allows file dialogs to be stubbed out for SWTBot tests.
- Since:
- 2.2
- Author:
- Matthew Khouzam
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.eclipse.swt.widgets.FileDialogcreate(org.eclipse.swt.widgets.Shell parent) File dialog factory, creates aFileDialog.static org.eclipse.swt.widgets.FileDialogcreate(org.eclipse.swt.widgets.Shell parent, int style) File dialog factory, creates aFileDialog.static voidsetOverrideFiles(String... paths) Set the override string name that will be returned for the nextFileDialog.
-
Constructor Details
-
TmfFileDialogFactory
public TmfFileDialogFactory()
-
-
Method Details
-
create
public static org.eclipse.swt.widgets.FileDialog create(org.eclipse.swt.widgets.Shell parent) File dialog factory, creates aFileDialog.Constructs a new instance of this class given only its parent.
If the factory is overridden with
setOverrideFiles(String...), the FileDialog will return the set String when open is called instead of opening a system window- Parameters:
parent- a shell which will be the parent of the new instance- Returns:
- the
FileDialog - Throws:
IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the parent is null
org.eclipse.swt.SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
- ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
-
create
public static org.eclipse.swt.widgets.FileDialog create(org.eclipse.swt.widgets.Shell parent, int style) File dialog factory, creates aFileDialog.Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.
The style value is either one of the style constants defined in class
SWTwhich is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using theint"|" operator) two or more of thoseSWTstyle constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.If the factory is overridden with
setOverrideFiles(String[]), the FileDialog will return the set String when open is called instead of opening a system window- Parameters:
parent- a shell which will be the parent of the new instancestyle- the style of dialog to construct- Returns:
- the
FileDialog - Throws:
IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the parent is null
org.eclipse.swt.SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
- ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
- See Also:
-
setOverrideFiles
Set the override string name that will be returned for the nextFileDialog. Must be called before creating the dialogs. This is a method aimed for testing, This should not be used in product code.- Parameters:
paths- the paths to override theFileDialog. They must be absolute. One or many absolute paths may be entered. When many paths are entered, it return an input of a multi-select action if paths is null, it will undo overriding, if paths is a zero length array, it will behave as if the dialog was cancelled.
-