}
});
btnBrowse.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
DirectoryDialog dialog = new DirectoryDialog(group.getShell());
dialog.setMessage("Choose a directory for the project contents:");
String directoryName = txtLocation.getText().trim();
if (directoryName == null || directoryName.length() == 0) {
String previous = JavaPlugin.getDefault().getDialogSettings().get(DIALOGSTORE_LAST_EXTERNAL_LOC);
if (previous != null)
directoryName = previous;
}
assert (directoryName != null);
if (directoryName.length() > 0) {
File path = new File(directoryName);
if (path.exists())
dialog.setFilterPath(directoryName);
}
String selected = dialog.open();
if (selected != null) {
txtLocation.setText(selected);
}
}
});