Note
Only one of the styles SAVE and OPEN may be specified.
Important Note
This class is not intended to be subclassed.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final char | |
| pack-priv static final char | |
| pack-priv String | |
| pack-priv String[] | |
| pack-priv String[] | |
| pack-priv int | |
| pack-priv String[] | |
| pack-priv String | |
| pack-priv String | |
| pack-priv long | |
| pack-priv boolean | |
| pack-priv static final char | |
| pack-priv boolean |
| Access | Constructor and Description |
|---|---|
| public | FileDialog(Shell
a shell which will be the parent of the new instance parent)Constructs a new instance of this class given only its parent. |
| public | FileDialog(Shell
a shell which will be the parent of the new instance parent, int the style of dialog to construct style)Constructs a new instance of this class given its parent and a style value describing its behavior and appearance. |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv String | |
| public String | Returns: the relative path of the fileReturns 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. |
| public String[] | Returns: the relative paths of the filesReturns a (possibly empty) array with the paths of all files that were selected in the dialog relative to the filter path. |
| public String[] | Returns: the file extensions filterReturns the file extensions which the dialog will use to filter the files it shows. |
| public int | Returns: index the file extension filter indexGet the 0-based index of the file extension filter which was selected by the user, or -1 if no filter was selected. |
| public String[] | Returns: the list of filter namesReturns the names that describe the filter extensions which the dialog will use to filter the files it shows. |
| public String | Returns: the directory path stringReturns the directory path that the dialog will use, or an empty string if this is not set. |
| public boolean | Returns: true if the dialog will prompt for file overwrite, false otherwiseReturns the flag that the dialog will use to determine whether to prompt the user for file overwrite if the selected file already exists. |
| private boolean | Returns: true if the extension contains any of the glob pattern wildcardsfile extension as a string extension)Check whether the file extension is a glob pattern. |
| public String | Returns: a string describing the absolute path of the first selected file, or null if the dialog was cancelled or an error occurredMakes the dialog visible and brings it to the front of the display. |
| pack-priv String | Returns: a string describing the absolute path of the first selected file, or nullOpen the file chooser dialog using the GtkFileChooserNative API (GTK3.20+) for running applications without direct filesystem access (such as Flatpak). |
| pack-priv void | |
| public void | setFileName(String
the file name string)Set the initial filename which the dialog will select by default when opened to the argument, which may be null. |
| public void | setFilterExtensions(String[]
the file extension filter extensions)Set the file extensions which the dialog will use to filter the files it shows to the argument, which may be null. |
| public void | setFilterIndex(int
the file extension filter index 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. |
| public void | setFilterNames(String[]
the list of filter names, or null for no filter names 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. |
| public void | setFilterPath(String
the directory path string)Sets the directory path that the dialog will use to the argument, which may be null. |
| public void | setOverwrite(boolean
true if the dialog will prompt for file overwrite, false otherwise 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. |
| pack-priv void |
| EXTENSION_SEPARATOR | back to summary |
|---|---|
| pack-priv static final char EXTENSION_SEPARATOR | |
| FILE_EXTENSION_SEPARATOR | back to summary |
|---|---|
| pack-priv static final char FILE_EXTENSION_SEPARATOR | |
| fileName | back to summary |
|---|---|
| pack-priv String fileName | |
| fileNames | back to summary |
|---|---|
| pack-priv String[] fileNames | |
| filterExtensions | back to summary |
|---|---|
| pack-priv String[] filterExtensions | |
| filterIndex | back to summary |
|---|---|
| pack-priv int filterIndex | |
| filterNames | back to summary |
|---|---|
| pack-priv String[] filterNames | |
| filterPath | back to summary |
|---|---|
| pack-priv String filterPath | |
| fullPath | back to summary |
|---|---|
| pack-priv String fullPath | |
| handle | back to summary |
|---|---|
| pack-priv long handle | |
| overwrite | back to summary |
|---|---|
| pack-priv boolean overwrite | |
| SEPARATOR | back to summary |
|---|---|
| pack-priv static final char SEPARATOR | |
| uriMode | back to summary |
|---|---|
| pack-priv boolean uriMode | |
| FileDialog | back to summary |
|---|---|
| public FileDialog(Shell parent) Constructs a new instance of this class given only its parent.
| |
| FileDialog | back to summary |
|---|---|
| public FileDialog(Shell parent, int style) 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
| |
| computeResultChooserDialog | back to summary |
|---|---|
| pack-priv String computeResultChooserDialog() | |
| getFileName | back to summary |
|---|---|
| public 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 | back to summary |
|---|---|
| public 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 | back to summary |
|---|---|
| public String[] getFilterExtensions() Returns the file extensions which the dialog will use to filter the files it shows.
| |
| getFilterIndex | back to summary |
|---|---|
| public 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. This is an index into the FilterExtensions array and the FilterNames array.
| |
| getFilterNames | back to summary |
|---|---|
| public String[] getFilterNames() Returns the names that describe the filter extensions which the dialog will use to filter the files it shows.
| |
| getFilterPath | back to summary |
|---|---|
| public 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 | back to summary |
|---|---|
| public boolean 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.
| |
| isGlobPattern | back to summary |
|---|---|
| private boolean isGlobPattern(String extension) Check whether the file extension is a glob pattern. For example, *.* is a glob pattern which corresponds to all files *.jp* corresponds to all the files with extension starting with jp like jpg,jpeg etc *.jp? corresponds to 3 letter extension starting with jp with any 3rd letter *.[pq]ng this corresponds to *.png and *.qng
| |
| open | back to summary |
|---|---|
| public String open() Makes the dialog visible and brings it to the front of the display.
| |
| openNativeChooserDialog | back to summary |
|---|---|
| pack-priv String openNativeChooserDialog() Open the file chooser dialog using the GtkFileChooserNative API (GTK3.20+) for running applications without direct filesystem access (such as Flatpak). API for GtkFileChoosernative does not give access to any GtkWindow or GtkWidget for the dialog, thus this method omits calls that requires such access. These are be handled by the GtkNativeDialog API.
| |
| presetChooserDialog | back to summary |
|---|---|
| pack-priv void presetChooserDialog() | |
| setFileName | back to summary |
|---|---|
| public 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 | back to summary |
|---|---|
| public 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. 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". Note On Mac, setting the file extension filter affects how app bundles are treated by the dialog. When a filter extension having the app extension (.app) is selected, bundles are treated as files. For all other extension filters, bundles are treated as directories. When no filter extension is set, bundles are treated as files.
| |
| setFilterIndex | back to summary |
|---|---|
| public 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. This is an index into the FilterExtensions array and the FilterNames array.
| |
| setFilterNames | back to summary |
|---|---|
| public 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.
Each name is a user-friendly short description shown for
its corresponding filter. The
| |
| setFilterPath | back to summary |
|---|---|
| public 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. Note that the path string is platform dependent. For convenience, either '/' or '\' can be used as a path separator.
| |
| setOverwrite | back to summary |
|---|---|
| public void setOverwrite(boolean 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. Note On some platforms where suppressing the overwrite prompt is not supported, the prompt is shown even when invoked with overwrite false.
| |
| setURIMode | back to summary |
|---|---|
| pack-priv void setURIMode(boolean uriMode) | |