use of org.jkiss.dbeaver.ui.controls.TextWithOpen in project dbeaver by serge-rider.
the class DialogUtils method createOutputFolderChooser.
@NotNull
public static Text createOutputFolderChooser(final Composite parent, @Nullable String label, @Nullable ModifyListener changeListener) {
final String message = label != null ? label : CoreMessages.data_transfer_wizard_output_label_directory;
UIUtils.createControlLabel(parent, message);
final TextWithOpen directoryText = new TextWithOpen(parent) {
@Override
protected void openBrowser() {
DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.NONE);
dialog.setMessage("Choose target directory");
dialog.setText(message);
String directory = getText();
if (CommonUtils.isEmpty(directory)) {
directory = curDialogFolder;
}
if (!CommonUtils.isEmpty(directory)) {
dialog.setFilterPath(directory);
}
directory = dialog.open();
if (directory != null) {
setText(directory);
setCurDialogFolder(directory);
}
}
};
directoryText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
if (changeListener != null) {
directoryText.getTextControl().addModifyListener(changeListener);
}
return directoryText.getTextControl();
}
Aggregations