Class FileDialog
- All Implemented Interfaces:
- Adaptable
- Styles:
- MULTI
- Events:
- (none)
The OPEN style is applied by default and setting any other styles has no effect.
IMPORTANT: This class is intended to be subclassed only within the SWT implementation.
- 
Field SummaryFields inherited from class org.eclipse.swt.widgets.DialogreturnCode, shell
- 
Constructor SummaryConstructorsConstructorDescriptionFileDialog(Shell parent) Constructs a new instance of this class given only its parent.FileDialog(Shell parent, int style) Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.
- 
Method SummaryModifier and TypeMethodDescriptionprotected ButtoncreateButton(Composite parent, String text) protected FileUploadcreateFileUpload(Composite parent, String text) Returns a list with exceptions thrown during the file upload.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.String[]Returns a (possibly empty) array with the paths of all files that were selected in the dialog relative to the filter path.String[]Returns the file extensions which the dialog will use to filter the files it shows.Returns the directory where the files should be uploaded to, ornullwhen a temporary directory is used.longReturns the maximum upload size in bytes.longReturns the maximum upload duration in milliseconds.open()Makes the dialog visible and brings it to the front of the display.protected voidvoidsetClientFiles(ClientFile[] files) Sets initial client files to be uploaded.voidsetFilterExtensions(String[] extensions) Set the file extensions which the dialog will use to filter the files it shows to the argument, which may be null.voidsetUploadDirectory(File directory) Set the directory where the files should be uploaded to.voidsetUploadSizeLimit(long limit) Sets the maximum upload size in bytes.voidsetUploadTimeLimit(long limit) Sets the maximum upload duration in milliseconds.Methods inherited from class org.eclipse.swt.widgets.DialogcheckOperationMode, checkSubclass, getAdapter, getParent, getStyle, getText, open, runEventLoop, setText
- 
Constructor Details- 
FileDialogConstructs 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
 
 
- 
FileDialogConstructs 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.- 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
 
 
 
- 
- 
Method Details- 
getFileNameReturns 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.- Returns:
- the relative path of the file
 
- 
getFileNamesReturns a (possibly empty) array with the paths of all files that were selected in the dialog relative to the filter path.- Returns:
- the relative paths of the files
 
- 
setFilterExtensionsSet the file extensions which the dialog will use to filter the files it shows to the argument, which may be null.An extension filter string must be of the form ".extension". - Parameters:
- extensions- the file extension filter
- Since:
- 3.2
 
- 
getFilterExtensionsReturns the file extensions which the dialog will use to filter the files it shows.- Returns:
- the file extensions filter
- Since:
- 3.2
 
- 
setClientFilesSets initial client files to be uploaded. The upload of these files will start immediately after opening the dialog. Hence, this method must be called before opening the dialog.A user can drag and drop files from the client operating system on any control with a drop listener attached. In this case, the client files can be obtained from the ClientFileTransferobject. This FileDialog can then be used to handle the upload and display upload progress.- Parameters:
- files- an array of client files to be added to the dialog
- Since:
- 3.1
 
- 
setUploadSizeLimitpublic void setUploadSizeLimit(long limit) Sets the maximum upload size in bytes. If upload size is bigger it will be interrupted. A value of -1 indicates no limit.- Parameters:
- limit- the maximum upload size in bytes
- Since:
- 3.3
- See Also:
 
- 
getUploadSizeLimitpublic long getUploadSizeLimit()Returns the maximum upload size in bytes. The default value of -1 indicates no limit.- Since:
- 3.3
 
- 
setUploadDirectorySet the directory where the files should be uploaded to. If no directory is set or it is set tonulla temporary directory is used.- Parameters:
- directory- the directory to upload to
- Since:
- 3.7
 
- 
getUploadDirectoryReturns the directory where the files should be uploaded to, ornullwhen a temporary directory is used.- Since:
- 3.7
 
- 
setUploadTimeLimitpublic void setUploadTimeLimit(long limit) Sets the maximum upload duration in milliseconds. If upload takes longer it will be interrupted. The default value of -1 indicates no limit.- Parameters:
- limit- the maximum upload duration in milliseconds
- Since:
- 3.3
- See Also:
 
- 
getUploadTimeLimitpublic long getUploadTimeLimit()Returns the maximum upload duration in milliseconds. The default value of -1 indicates no limit.- Since:
- 3.3
 
- 
getExceptionsReturns a list with exceptions thrown during the file upload. Will never return null.- Since:
- 3.3
- See Also:
 
- 
openMakes the dialog visible and brings it to the front of the display.RAP Note: This method is not supported when running the application in JEE_COMPATIBILITY mode. Use Dialog#open(DialogCallback)instead.- Returns:
- a string describing the absolute path of the first selected file, or null if the dialog was cancelled or an error occurred
- Throws:
- SWTException-- ERROR_WIDGET_DISPOSED - if the dialog has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog
 
 
- 
prepareOpenprotected void prepareOpen()- Overrides:
- prepareOpenin class- Dialog
 
- 
createFileUpload
- 
createButton
 
-