btnOpenFileDialog = new Button (row, SWT.PUSH);
btnOpenFileDialog.setText (Messages.Wizard_WW_SelectFile);
final Shell shell = parent.getShell();
btnOpenFileDialog.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog fd = new FileDialog(shell, SWT.OPEN);
fd.setText(Messages.Wizard_WW_SelectFile);
setLastUsedPath(fd);
// Set filter on XML-files
String[] filterExtensions = {"*.xml"}; //$NON-NLS-1$
String[] filterNames = {"NASA WorldWind Configuration File (*.xml)"}; //$NON-NLS-1$
fd.setFilterExtensions(filterExtensions);
fd.setFilterNames(filterNames);
// Open the dialog
String selectedFile = fd.open();
if (selectedFile != null) {
txtLocalFile.setText(selectedFile);
saveLastUsedPath(fd.getFilterPath());
modifyText(null);
}
}
private void saveLastUsedPath(String path) {
if (settings != null && path != null) {
settings.put(WW_PATH, path);
}
}
private void setLastUsedPath(FileDialog fd) {
if (settings != null) {
fd.setFilterPath(settings.get(WW_PATH));
}
}
});
//endregion