FileDialog Extension Filter does not work ?! [message #444574] |
Fri, 15 October 2004 06:13  |
Eclipse User |
|
|
|
Hello
I have tried to to set the filter extension in my SaveDialog to xml files.
But the FileDialog doesn't show any file in the Directory!??
Another question, is it possible to define a default extension. For example:
When the user write "myfile", I want to store this as "myfile.xml".
Here is the Codesnippet:
FileDialog dialog = new FileDialog(this.getSite().getShell(), SWT.SAVE);
dialog.setText("Save as...");
dialog.setFilterNames(new String[]{"xml"});
dialog.setFilterExtensions(new String[]{"xml"});
String path = dialog.open();
Thanks in advance!
-Rene-
|
|
|
|
Re: FileDialog Extension Filter does not work ?! [message #444629 is a reply to message #444577] |
Mon, 18 October 2004 04:43  |
Eclipse User |
|
|
|
Blame on me!! ;-)
It have to be *.xml!!! Thanks for your Tipp!
And if no extension is entered, the FileDialog uses xml. I don't have to set
the default manually.
I think I am a bit too much Microsoft (MFC, .Net WinForms) misguided. ;-)
"Grant Gayed" <grant_gayed@ca.ibm.com> schrieb im Newsbeitrag
news:ckois3$dsa$1@eclipse.org...
> Rene,
>
> Your filter extension string should be "*.xml", not just "xml". This
> should
> explain why all of your files are being filtered out; if this change does
> not make some or all of them reappear then please log a bug report with
> Platform - SWT.
>
> There is no way to set a default extension into a FileDialog, but since
> the
> dialog just returns to you whatever the user entered, you can just detect
> the case where no extension was specified and add it on yourself
> afterwards,
> no?
>
> Grant
>
> "Teichgraf" <teichgraf@gmx.de> wrote in message
> news:cko7hu$mgt$1@eclipse.org...
>> Hello
>> I have tried to to set the filter extension in my SaveDialog to xml
>> files.
>> But the FileDialog doesn't show any file in the Directory!??
>> Another question, is it possible to define a default extension. For
> example:
>> When the user write "myfile", I want to store this as "myfile.xml".
>>
>> Here is the Codesnippet:
>>
>> FileDialog dialog = new FileDialog(this.getSite().getShell(), SWT.SAVE);
>> dialog.setText("Save as...");
>> dialog.setFilterNames(new String[]{"xml"});
>> dialog.setFilterExtensions(new String[]{"xml"});
>> String path = dialog.open();
>>
>>
>> Thanks in advance!
>> -Rene-
>>
>>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.04132 seconds