How to select a directory/file using FileBrowserSheet

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to select a directory/file using FileBrowserSheet

davidgao
Hi,

I'm writing a file chooser now. I found that I can only select a file when the mode is SAVE_AS and a directory when the mode is SAVE_TO.

I would like a mode in which I can select either a file or a directory. I find no way to realize this. Please help.

My use case is something like what Swing JFileChoose does below:

JFileChooser chooser = new JFileChooser();
...
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
int returnVal = chooser.showOpenDialog(this);

Please help
Reply | Threaded
Open this post in threaded view
|

Re: How to select a directory/file using FileBrowserSheet

Greg Brown
Administrator
That isn't currently supported. I'd like to understand the use case better, though. Under what circumstances might the user want to select either a file or a directory?

On May 14, 2010, at 10:36 AM, David Gao wrote:

> Hi,
>
> I'm writing a file chooser now. I found that I can only select a file when the mode is SAVE_AS and a directory when the mode is SAVE_TO.
>
> I would like a mode in which I can select either a file or a directory. I find no way to realize this. Please help.
>
> My use case is something like what Swing JFileChoose does below:
>
> JFileChooser chooser = new JFileChooser();
> ...
> chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
> int returnVal = chooser.showOpenDialog(this);
>
> Please help

Reply | Threaded
Open this post in threaded view
|

Re: How to select a directory/file using FileBrowserSheet

davidgao
Hi Creg,

The use case is like this. I am writing a tool which can do some
conversion tasks for files. If user selects a file via FileBrowserSheet,
the tool will just deal with the selected file. However, if the user
selects a folder, the tool will scan and convert all files or filtered
files under this folder recursively. This will make the tool look smarter.

My several other tools also need such behavior.

Best Regards,

David Gao

Greg Brown 写道:

> That isn't currently supported. I'd like to understand the use case better, though. Under what circumstances might the user want to select either a file or a directory?
>
> On May 14, 2010, at 10:36 AM, David Gao wrote:
>
>    
>> Hi,
>>
>> I'm writing a file chooser now. I found that I can only select a file when the mode is SAVE_AS and a directory when the mode is SAVE_TO.
>>
>> I would like a mode in which I can select either a file or a directory. I find no way to realize this. Please help.
>>
>> My use case is something like what Swing JFileChoose does below:
>>
>> JFileChooser chooser = new JFileChooser();
>> ...
>> chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
>> int returnVal = chooser.showOpenDialog(this);
>>
>> Please help
>>      
>    
Reply | Threaded
Open this post in threaded view
|

Re: How to select a directory/file using FileBrowserSheet

Greg Brown
Administrator
Ah, OK. Sounds like you would want the OPEN and OPEN_MULTIPLE modes to allow folder selection as well as file selection. This isn't currently supported, but seems like a reasonable request. Can you add a JIRA ticket for this and assign it to 1.5.1?
Thanks,
Greg
 
On Friday, May 14, 2010, at 01:44PM, "David Gao" <[hidden email]> wrote:

>Hi Creg,
>
>The use case is like this. I am writing a tool which can do some
>conversion tasks for files. If user selects a file via FileBrowserSheet,
>the tool will just deal with the selected file. However, if the user
>selects a folder, the tool will scan and convert all files or filtered
>files under this folder recursively. This will make the tool look smarter.
>
>My several other tools also need such behavior.
>
>Best Regards,
>
>David Gao
>
>Greg Brown 写道:
>> That isn't currently supported. I'd like to understand the use case better, though. Under what circumstances might the user want to select either a file or a directory?
>>
>> On May 14, 2010, at 10:36 AM, David Gao wrote:
>>
>>    
>>> Hi,
>>>
>>> I'm writing a file chooser now. I found that I can only select a file when the mode is SAVE_AS and a directory when the mode is SAVE_TO.
>>>
>>> I would like a mode in which I can select either a file or a directory. I find no way to realize this. Please help.
>>>
>>> My use case is something like what Swing JFileChoose does below:
>>>
>>> JFileChooser chooser = new JFileChooser();
>>> ...
>>> chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
>>> int returnVal = chooser.showOpenDialog(this);
>>>
>>> Please help
>>>      
>>    
>
>