So I have a method that takes in some information, and returns the path name as a string. Everything works the way I would like it to, except when the file browser opens I would like to open up in the folder "startPath". However it opens up in the previous folder location used, not the "startPath" like desired. I've read similar posts to this but none really had a solution. Any help would be appreciated.
//return the path from a browser
String browserTarget = null;
public String getPathFromBrowser(final String title, final String startPath, final String[] extensions, final String fileName, final int style){
d.syncExec(new Runnable() {
public void run() {
browserTarget = null;
Shell shell;
if(designer != null)
shell = SWT_AWT.new_Shell(d, designer);
else
shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
FileDialog fileDialog = new FileDialog(shell, style);
// initialize the browser dialog
fileDialog.setText(title);
fileDialog.setFilterPath(startPath);
fileDialog.setFilterExtensions(extensions);
fileDialog.setOverwrite(true);
if(fileName != null)
fileDialog.setFileName(fileName);
// browser returns the export target or null
String target = fileDialog.open();
// when a target is returned...
if (target != null)
browserTarget = target;
}
});
return browserTarget;
}