FileDialog

Instances of this class allow the user to navigate the file system and select or enter a file name. <dl> <dt><b>Styles:</b></dt> <dd>SAVE, OPEN, MULTI</dd> <dt><b>Events:</b></dt> <dd>(none)</dd> </dl> <p> Note: Only one of the styles SAVE and OPEN may be specified. </p><p> IMPORTANT: This class is intended to be subclassed <em>only</em> within the SWT implementation. </p>

@see <a href="http://www.eclipse.org/swt/snippets/#filedialog">FileDialog snippets</a> @see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: ControlExample, Dialog tab</a> @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>

Constructors

this
this(Shell parent)

Constructs a new instance of this class given only its parent.

this
this(Shell parent, int style)

Constructs a new instance of this class given its parent and a style value describing its behavior and appearance. <p> The style value is either one of the style constants defined in class <code>SWT</code> which is applicable to instances of this class, or must be built by <em>bitwise OR</em>'ing together (that is, using the <code>int</code> "|" operator) two or more of those <code>SWT</code> style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses. </p>

Members

Functions

getFileName
String getFileName()

Returns the path of the first file that was selected in the dialog relative to the filter path, or an empty string if no such file has been selected.

getFileNames
String[] getFileNames()

Returns a (possibly empty) array with the paths of all files that were selected in the dialog relative to the filter path.

getFilterExtensions
String[] getFilterExtensions()

Returns the file extensions which the dialog will use to filter the files it shows.

getFilterIndex
int getFilterIndex()

Get the 0-based index of the file extension filter which was selected by the user, or -1 if no filter was selected. <p> This is an index into the FilterExtensions array and the FilterNames array. </p>

getFilterNames
String[] getFilterNames()

Returns the names that describe the filter extensions which the dialog will use to filter the files it shows.

getFilterPath
String getFilterPath()

Returns the directory path that the dialog will use, or an empty string if this is not set. File names in this path will appear in the dialog, filtered according to the filter extensions.

getOverwrite
bool getOverwrite()

Returns the flag that the dialog will use to determine whether to prompt the user for file overwrite if the selected file already exists.

open
String open()

Makes the dialog visible and brings it to the front of the display.

setFileName
void setFileName(String string)

Set the initial filename which the dialog will select by default when opened to the argument, which may be null. The name will be prefixed with the filter path when one is supplied.

setFilterExtensions
void setFilterExtensions(String[] extensions)

Set the file extensions which the dialog will use to filter the files it shows to the argument, which may be null. <p> The strings are platform specific. For example, on some platforms, an extension filter string is typically of the form "*.extension", where "*.*" matches all files. For filters with multiple extensions, use semicolon as a separator, e.g. "*.jpg;*.png". </p>

setFilterIndex
void setFilterIndex(int index)

Set the 0-based index of the file extension filter which the dialog will use initially to filter the files it shows to the argument. <p> This is an index into the FilterExtensions array and the FilterNames array. </p>

setFilterNames
void setFilterNames(String[] names)

Sets the names that describe the filter extensions which the dialog will use to filter the files it shows to the argument, which may be null. <p> Each name is a user-friendly short description shown for its corresponding filter. The <code>names</code> array must be the same length as the <code>extensions</code> array. </p>

setFilterPath
void setFilterPath(String string)

Sets the directory path that the dialog will use to the argument, which may be null. File names in this path will appear in the dialog, filtered according to the filter extensions. If the string is null, then the operating system's default filter path will be used. <p> Note that the path string is platform dependent. For convenience, either '/' or '\' can be used as a path separator. </p>

setOverwrite
void setOverwrite(bool overwrite)

Sets the flag that the dialog will use to determine whether to prompt the user for file overwrite if the selected file already exists.

Inherited Members

From Dialog

checkSubclass
void checkSubclass()

Checks that this class can be subclassed. <p> IMPORTANT: See the comment in <code>Widget.checkSubclass()</code>. </p>

checkParent
void checkParent(Shell parent)

Throws an exception if the specified widget can not be used as a parent for the receiver.

error
void error(int code)

Does whatever dialog specific cleanup is required, and then uses the code in <code>SWTError.error</code> to handle the error.

getParent
Shell getParent()

Returns the receiver's parent, which must be a <code>Shell</code> or null.

getStyle
int getStyle()

Returns the receiver's style information. <p> Note that, the value which is returned by this method <em>may not match</em> the value which was provided to the constructor when the receiver was created. </p>

getText
String getText()

Returns the receiver's text, which is the string that the window manager will typically display as the receiver's <em>title</em>. If the text has not previously been set, returns an empty string.

setText
void setText(String string)

Sets the receiver's text, which is the string that the window manager will typically display as the receiver's <em>title</em>, to the argument, which must not be null.

Meta