Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Furnadjiev2016-10-26 10:08:45 +0000
committerIvan Furnadjiev2016-10-26 10:08:45 +0000
commit77cee2df44c18545361c1e41213ac245c191a906 (patch)
treed420acca09eaa980547d71e313e4753cb6956223 /bundles
parent4510729f34ea57f51c8699e839b2a0d44daafc03 (diff)
downloadorg.eclipse.rap-77cee2df44c18545361c1e41213ac245c191a906.tar.gz
org.eclipse.rap-77cee2df44c18545361c1e41213ac245c191a906.tar.xz
org.eclipse.rap-77cee2df44c18545361c1e41213ac245c191a906.zip
Add support for filter extensions in FileDialog
433501: [FileDialog] Filtering of extensions, path and filename not possible anymore https://bugs.eclipse.org/bugs/show_bug.cgi?id=433501 Change-Id: Ie7e5a3e4d11a1907cb80da3259c59617c04ffc2d
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.rap.filedialog/src/org/eclipse/swt/widgets/FileDialog.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/bundles/org.eclipse.rap.filedialog/src/org/eclipse/swt/widgets/FileDialog.java b/bundles/org.eclipse.rap.filedialog/src/org/eclipse/swt/widgets/FileDialog.java
index 8ab8cf53d0..b853437526 100644
--- a/bundles/org.eclipse.rap.filedialog/src/org/eclipse/swt/widgets/FileDialog.java
+++ b/bundles/org.eclipse.rap.filedialog/src/org/eclipse/swt/widgets/FileDialog.java
@@ -93,6 +93,7 @@ public class FileDialog extends Dialog {
private UploadPanel placeHolder;
private ProgressCollector progressCollector;
private ClientFile[] clientFiles;
+ private String[] filterExtensions;
/**
* Constructs a new instance of this class given only its parent.
@@ -171,6 +172,34 @@ public class FileDialog extends Dialog {
}
/**
+ * Set the file extensions which the dialog will
+ * use to filter the files it shows to the argument,
+ * which may be null.
+ * <p>
+ * An extension filter string must be of the form ".extension".
+ * </p>
+ *
+ * @param extensions the file extension filter
+ *
+ * @since 3.2
+ */
+ public void setFilterExtensions( String[] extensions ) {
+ filterExtensions = extensions;
+ }
+
+ /**
+ * Returns the file extensions which the dialog will
+ * use to filter the files it shows.
+ *
+ * @return the file extensions filter
+ *
+ * @since 3.2
+ */
+ public String[] getFilterExtensions() {
+ return filterExtensions;
+ }
+
+ /**
* Sets 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.
* <p>
@@ -373,6 +402,9 @@ public class FileDialog extends Dialog {
FileUpload fileUpload = new FileUpload( parent, isMulti() ? SWT.MULTI : SWT.NONE );
fileUpload.setText( text );
fileUpload.setLayoutData( createButtonLayoutData( fileUpload ) );
+ if( filterExtensions != null ) {
+ fileUpload.setFilterExtensions( filterExtensions );
+ }
fileUpload.addListener( SWT.Selection, new Listener() {
@Override
public void handleEvent( Event event ) {

Back to the top