FidoNet Echomail Archive
java_language

<<< Previous Index Next >>>

From: Gerrit Kuehn
To: *
Date: 2004-05-12 21:09:00
Subject: SWT FileDialog

Hello *!

I think this question is rather specific, but since there are at least some
people around here who are using Eclipse, who knows...? :)

Well, the problem is as follows:
I try to use an SWT FileDialog style SWT_OPEN and want to restrict the
selection to a certain group of files. From reading the docs I thought that
setFilterExtensions and setFilterNames should do the trick. What is more,
some other code I found via Google uses exactly this. However, for me it
doesn't work at all. The selection isn't filtered, I can still see and
select all files.

Example code:

    // open button
    openButton.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        FileDialog dialogShell = new FileDialog(toplevelShell, SWT.OPEN);
        dialogShell.setText("Open File");
        dialogShell.setFilterPath("/work/gerrit/datapool/riker");
        dialogShell.setFilterExtensions(new String[] { "*.spe;
*.SPE", "*.*" });
        dialogShell.open();
      }
    });


FilterPath works as supposed, FilterExtensions doesn't (and neither does
FilterNames, which I have tried inbetween, too).
From other code snippets I have seen I suppose that there should appear
some kind of box from where I can select one of the filters. Maybe I'm just
too blind to see this box? Or are there any other hints? Does this work for
anyone else here?


Regards,
Gerrit

--- Msged/BSD 6.0.0
 * Origin: A love pays love for lying (2:246/4020)
SEEN-BY: 633/267 270
@PATH: 246/4020 2411/413 2432/200 774/605 123/500 106/2000 633/267


<<< Previous Index Next >>>