Home » Eclipse-SWT-3.5.1 » org.eclipse.swt.widgets » [javadoc | source]
org.eclipse.swt.widgets
public class: FileDialog [javadoc | source]
java.lang.Object
   org.eclipse.swt.widgets.Dialog
      org.eclipse.swt.widgets.FileDialog
Instances of this class allow the user to navigate the file system and select or enter a file name.
Styles:
SAVE, OPEN, MULTI
Events:
(none)

Note: Only one of the styles SAVE and OPEN may be specified.

IMPORTANT: This class is intended to be subclassed only within the SWT implementation.

Field Summary
 String[] filterNames     
 String[] filterExtensions     
 String[] fileNames     
 String filterPath     
 String fileName     
 int filterIndex     
 boolean overwrite     
static final  String FILTER     
static  int BUFFER_SIZE     
static  boolean USE_HOOK     
Fields inherited from org.eclipse.swt.widgets.Dialog:
style,  parent,  title
Constructor:
 public FileDialog(Shell parent) 
    Constructs a new instance of this class given only its parent.
    Parameters:
    parent - a shell which will be the parent of the new instance
    Throws:
    IllegalArgumentException -
    • ERROR_NULL_ARGUMENT - if the parent is null

    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

    exception: IllegalArgumentException -
    • ERROR_NULL_ARGUMENT - if the parent is null

    exception: 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

 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 SWT which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using the int "|" operator) two or more of those SWT style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.

    Parameters:
    parent - a shell which will be the parent of the new instance
    style - the style of dialog to construct
    Throws:
    IllegalArgumentException -
    • ERROR_NULL_ARGUMENT - if the parent is null

    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

    Also see:
    SWT#SAVE
    SWT#OPEN
    SWT#MULTI
    exception: IllegalArgumentException -
    • ERROR_NULL_ARGUMENT - if the parent is null

    exception: 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

Method from org.eclipse.swt.widgets.FileDialog Summary:
OFNHookProc,   getFileName,   getFileNames,   getFilterExtensions,   getFilterIndex,   getFilterNames,   getFilterPath,   getOverwrite,   open,   setFileName,   setFilterExtensions,   setFilterIndex,   setFilterNames,   setFilterPath,   setOverwrite
Methods from org.eclipse.swt.widgets.Dialog:
checkParent,   checkStyle,   checkSubclass,   error,   getParent,   getStyle,   getText,   setText
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.eclipse.swt.widgets.FileDialog Detail:
 int OFNHookProc(int hdlg,
    int uiMsg,
    int wParam,
    int lParam) 
 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.
 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.
 public String[] getFilterExtensions() 
    Returns the file extensions which the dialog will use to filter the files it shows.
 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.

 public String[] getFilterNames() 
    Returns the names that describe the filter extensions which the dialog will use to filter the files it shows.
 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.
 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.
 public String open() 
    Makes the dialog visible and brings it to the front of the display.
 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.
 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".

 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.

 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 names array must be the same length as the extensions array.

 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.

 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.