Skip to main content



      Home
Home » Eclipse Projects » Eclipse Scout » FileChooser with default filename
FileChooser with default filename [message #870903] Thu, 10 May 2012 04:29 Go to next message
Eclipse UserFriend
This is what I want:

String filename = getExportPath() + sapFaufNr;
File[] file = new FileChooser(new File(filename), new String[]{"prd", "ddd"}, false).startChooser();


But FileChooser doesn't allow me to specify a default filename. In fact, if the File provided is not a directory, it is ignored. Right now I am forced to do the following:

String filename = getExportPath() + sapFaufNr; // ignore
File[] file = new FileChooser(new File(getExportPath()), new String[]{"prd", "ddd"}, false).startChooser();


Can this be added or is there some fundamental UI thought that went into this?
Re: FileChooser with default filename [message #870907 is a reply to message #870903] Thu, 10 May 2012 04:47 Go to previous messageGo to next message
Eclipse UserFriend
Did you try setting the filename?
The directory is the directory it starts browsing.
so do the following:

String folder = FileChooser.getCurrentDirectory();
String filename = "foo.prd";
FileChooser chooser=new FileChooser(folder, new String[]{"prd", "ddd"},false);
chooser.setFileName(filename);
File[] files = chooser.startChooser();
if(files.length>0){
  //convenience, remember the directory the user used for future accesses
  FileChooser.setCurrentDirectory(files[0].getParent());
  //use files[0]...
}
Re: FileChooser with default filename [message #870909 is a reply to message #870903] Thu, 10 May 2012 04:49 Go to previous messageGo to next message
Eclipse UserFriend
Hi Alex

The way I use it:
FileChooser chooser = new FileChooser(null, new String[]{}, false);
chooser.setTypeLoad(false);
chooser.setFileName(getFileColumn().getSelectedValue());


The file chooser pops up and the filename is prefilled.
Re: FileChooser with default filename [message #870913 is a reply to message #870903] Thu, 10 May 2012 04:55 Go to previous message
Eclipse UserFriend
Thanks, all! That solved my problem. Smile
Previous Topic:Saving Form State to XML and Templates
Next Topic:Scout Client minimized to taskbar disappears when trying to reopen
Goto Forum:
  


Current Time: Fri Jul 25 09:15:20 EDT 2025

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

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

Back to the top