[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Re: Seeding initial directory in DialogDirectory
|
I have not heard of DirectoryDialog.setFilterPath() not working before, and
I've verified that it works for me on win2000 with eclipse/swt 3.2.2 and 3.4
with the snippet below (it sets the dialog's initial selection to the value
of "property"). Does the value of "property" look wrong on your machine for
some reason? Does it exist?
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.*;
public class Main0 {
public static void main (String [] args) {
Display display = new Display ();
DirectoryDialog dialog = new DirectoryDialog(new Shell (display),
SWT.NONE);
String property = System.getProperty("user.home");
System.out.println(property);
dialog.setFilterPath(property);
System.out.println(dialog.open());
display.dispose ();
}
}
Grant
"Nat Mills" <nat@xxxxxxxxxxxxxxxx> wrote in message
news:5dcfeff39accfad0173dff5b8d5e44fd$1@xxxxxxxxxxxxxxxxxx
> I may not be understanding the setFilterPath API in DirectoryDialog. From
> what I observe in WinXP, it has no effect (e.g., you begin in "My
> Documents" whether you want to or not... In FileDialog, you can use this
> to seed the initial location within the filesystem from which to begin
> navigation. I'd tried using a filter mask of "*." in FileDialog, but you
> can't select a directory there (makes sense)...
>
> My goal is to prompt for a location to create a new file, seeding it with
> the recommended location (based on the user.home System property).
> Unfortunately, I'm at SWT 3.2.3.v3236c which ships with current IDE from
> IBM. Any suggested work arounds to provide selection of just directories
> with create/delete capabilities as exist in the DirectoryDialog?
>
> I suppose I can simply use the FileDialog and test if the returned String
> results in an existing File or not to glean if it was new (e.g., to decide
> fill in default values).
>