Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » FileChooser with default filename
FileChooser with default filename [message #870903] Thu, 10 May 2012 08:29 Go to next message
Alex Schroeder is currently offline Alex SchroederFriend
Messages: 38
Registered: February 2010
Location: Zürich, Switzerland
Member

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 08:47 Go to previous messageGo to next message
Ivan Motsch is currently offline Ivan MotschFriend
Messages: 154
Registered: March 2010
Senior Member
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 08:49 Go to previous messageGo to next message
Stephan Merkli is currently offline Stephan MerkliFriend
Messages: 40
Registered: April 2012
Member
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 08:55 Go to previous message
Alex Schroeder is currently offline Alex SchroederFriend
Messages: 38
Registered: February 2010
Location: Zürich, Switzerland
Member

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: Sat Apr 27 04:17:26 GMT 2024

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

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

Back to the top