Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » FileDialog Extension Filter does not work ?!
FileDialog Extension Filter does not work ?! [message #444574] Fri, 15 October 2004 06:13 Go to next message
Eclipse UserFriend
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 #444577 is a reply to message #444574] Fri, 15 October 2004 09:26 Go to previous messageGo to next message
Eclipse UserFriend
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-
>
>
Re: FileDialog Extension Filter does not work ?! [message #444629 is a reply to message #444577] Mon, 18 October 2004 04:43 Go to previous message
Eclipse UserFriend
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-
>>
>>
>
>
Previous Topic:Re: Watermark
Next Topic:Editor closing/background
Goto Forum:
  


Current Time: Sat Jul 05 07:27:55 EDT 2025

Powered by FUDForum. Page generated in 0.04132 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top