| Summary: | setFilterPath only obeyed if a file has not already been loaded from a different path | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | merry-v <dmclarke> |
| Component: | SWT | Assignee: | Platform-SWT-Inbox <platform-swt-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | eclipse.felipe, haterschuur |
| Version: | 3.6.1 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | stalebug | ||
My version of Eclipse SDK is 3.6.1 Works for me, always open at C:\Users\Public
public static void main(String[] args) {
Display display = new Display();
final Shell shell = new Shell(display);
final FileDialog dialog = new FileDialog(shell, SWT.OPEN);
shell.addListener(SWT.MouseDown, new Listener() {
public void handleEvent(Event e) {
dialog.setFilterPath("C:\\Users\\Public");
System.out.println(dialog.open());
}
});
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
Does it work for you ?
According to http://msdn.microsoft.com/en-us/library/ms646839(VS.85).aspx the behavior of the lpstrInitialDir member is changed on Windows 7. David Washington (Program Manager at Microsoft) explains why this behavior was changed in a discussion related to this issue on the Microsoft MSDN forums: http://social.msdn.microsoft.com/Forums/en-US/windowsuidevelopment/thread/7c6614ea-bef9-4421-9778-f8e42b95456a/ This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. If the bug is still relevant, please remove the stalebug whiteboard tag. |
Build Identifier: M20100909-0800 I have a FileDialog, which is set to use the same path (from the app preferences) every time by setFilterPath(). But after selecting a file from a different path, and clicking "Open", the future behaviour changes. Now the FileDialog opens up in the location of the last file selected, ignoring the path given by setFilterPath(). Here is the code sample - // wft_path is set from preferences FileDialog loaddlg = new FileDialog(wc.getShell()); loaddlg.setFilterExtensions(new String [] {"*.xml"}); loaddlg.setFilterPath(wft_path); //value of wft_path is verified by debug loaddlg.open(); Here is the value of wft_path when this code is run - c:\data\_090_PROJECTS\_030_MINOR_ACTIVE\eclipse workflow\eclipse_workspaces\wf3\wf2\dc_created_save_dir\ Here is the value of the alternative path - c:\data\_090_PROJECTS\_030_MINOR_ACTIVE\eclipse workflow\eclipse_workspaces\wf3\ Reproducible: Always Steps to Reproduce: 1. Run the code specified in the Details secion in this bug report, the file dialog appears, and its using the path specified by wft_path . Let's call it "path A". So far so good. 2. Navigate the file open dialog to a different path ("path B") and select a file there. Click Open. 3. Exit and restart the app, run the file dialog code again. The dialog opens but now it is open at "path B". If setFilterPath was obeyed, I would expect it to open in "path A".