use of org.eclipse.swt.events.SelectionEvent in project dbeaver by serge-rider.
the class ExasolExportTableToolDialog method createControls.
@Override
protected void createControls(final Composite parent) {
Group optionsGroup = UIUtils.createControlGroup(parent, ExasolMessages.dialog_table_tools_options, 1, 0, 0);
optionsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Composite composite = new Composite(optionsGroup, 2);
composite.setLayout(new GridLayout(2, false));
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
// Directory select Button
btSelectDirectory = UIUtils.createPushButton(composite, ExasolMessages.dialog_table_open_output_directory, null);
btSelectDirectory.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
final DirectoryDialog dialog = new DirectoryDialog(parent.getShell());
final String directory = dialog.open();
if (directory != null) {
selectedDirectory.setVisible(true);
selectedDirectory.setText(directory + File.separatorChar);
} else {
selectedDirectory.setVisible(false);
}
updateSQL();
}
});
//label for selected directory
selectedDirectory = UIUtils.createLabel(composite, "");
selectedDirectory.setVisible(false);
//file template
filename = "${schema}_${table}_${date}";
txFileName = UIUtils.createLabelText(composite, ExasolMessages.dialog_table_tools_file_template, filename);
txFileName.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent arg0) {
filename = txFileName.getText();
updateSQL();
}
});
// compress output
btSelectCompress = UIUtils.createCheckbox(composite, ExasolMessages.dialog_table_tools_export_compress, false);
btSelectCompress.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateSQL();
}
});
// PlaceHolder
UIUtils.createPlaceholder(composite, 1);
// include column headings
btInclColNames = UIUtils.createCheckbox(composite, ExasolMessages.dialog_table_tools_column_heading, true);
btInclColNames.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateSQL();
}
});
// PlaceHolder
UIUtils.createPlaceholder(composite, 1);
// encoding combo
cbEncoding = UIUtils.createLabelCombo(composite, ExasolMessages.dialog_table_tools_encoding, SWT.DROP_DOWN | SWT.READ_ONLY);
for (String enc : ExasolConstants.encodings) {
cbEncoding.add(enc);
}
cbEncoding.select(0);
encoding = ExasolConstants.encodings.get(0);
cbEncoding.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
encoding = ExasolConstants.encodings.get(cbEncoding.getSelectionIndex());
updateSQL();
}
});
// row seperator
cbRowSep = UIUtils.createLabelCombo(composite, ExasolMessages.dialog_table_tools_string_sep_mode, SWT.DROP_DOWN | SWT.READ_ONLY);
for (String mode : ExasolConstants.rowSeperators) {
cbRowSep.add(mode);
}
cbRowSep.select(0);
rowSep = ExasolConstants.rowSeperators.get(0);
cbRowSep.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
rowSep = ExasolConstants.rowSeperators.get(cbRowSep.getSelectionIndex());
updateSQL();
}
});
// string sep mode
cbStringSepMode = UIUtils.createLabelCombo(composite, ExasolMessages.dialog_table_tools_string_sep_mode, SWT.DROP_DOWN | SWT.READ_ONLY);
for (String mode : ExasolConstants.stringSepModes) {
cbStringSepMode.add(mode);
}
cbStringSepMode.select(0);
sepMode = ExasolConstants.stringSepModes.get(0);
cbStringSepMode.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
sepMode = ExasolConstants.stringSepModes.get(cbStringSepMode.getSelectionIndex());
updateSQL();
}
});
// column sep
txColSep = UIUtils.createLabelText(composite, ExasolMessages.dialog_table_tools_column_sep, ";");
txColSep.setTextLimit(1);
txColSep.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent arg0) {
updateSQL();
}
});
// string sep
txStringSep = UIUtils.createLabelText(composite, ExasolMessages.dialog_table_tools_string_sep, "\"");
txStringSep.setTextLimit(1);
txStringSep.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent arg0) {
updateSQL();
}
});
createObjectsSelector(parent);
}
use of org.eclipse.swt.events.SelectionEvent in project dbeaver by serge-rider.
the class ExasolImportTableToolDialog method createControls.
@Override
protected void createControls(final Composite parent) {
Group optionsGroup = UIUtils.createControlGroup(parent, ExasolMessages.dialog_table_tools_options, 1, 0, 0);
optionsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Composite composite = new Composite(optionsGroup, 2);
composite.setLayout(new GridLayout(2, false));
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
// Directory select Button
btSelectDirectory = UIUtils.createPushButton(composite, ExasolMessages.dialog_table_open_output_directory, null);
btSelectDirectory.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
final DirectoryDialog dialog = new DirectoryDialog(parent.getShell());
final String directory = dialog.open();
if (directory != null) {
selectedDirectory.setVisible(true);
selectedDirectory.setText(directory + File.separatorChar);
} else {
selectedDirectory.setVisible(false);
}
updateSQL();
}
});
//label for selected directory
selectedDirectory = UIUtils.createLabel(composite, "");
selectedDirectory.setVisible(false);
//file template
filename = "${schema}_${table}_${date}";
txFileName = UIUtils.createLabelText(composite, ExasolMessages.dialog_table_tools_file_template, filename);
txFileName.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent arg0) {
filename = txFileName.getText();
updateSQL();
}
});
// compress output
btSelectCompress = UIUtils.createCheckbox(composite, ExasolMessages.dialog_table_tools_export_compress, false);
btSelectCompress.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateSQL();
}
});
// PlaceHolder
UIUtils.createPlaceholder(composite, 1);
// include column headings
btInclColNames = UIUtils.createCheckbox(composite, ExasolMessages.dialog_table_tools_column_heading, true);
btInclColNames.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateSQL();
}
});
// PlaceHolder
UIUtils.createPlaceholder(composite, 1);
// encoding combo
cbEncoding = UIUtils.createLabelCombo(composite, ExasolMessages.dialog_table_tools_encoding, SWT.DROP_DOWN | SWT.READ_ONLY);
for (String enc : ExasolConstants.encodings) {
cbEncoding.add(enc);
}
cbEncoding.select(0);
encoding = ExasolConstants.encodings.get(0);
cbEncoding.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
encoding = ExasolConstants.encodings.get(cbEncoding.getSelectionIndex());
updateSQL();
}
});
// row seperator
cbRowSep = UIUtils.createLabelCombo(composite, ExasolMessages.dialog_table_tools_string_sep_mode, SWT.DROP_DOWN | SWT.READ_ONLY);
for (String mode : ExasolConstants.rowSeperators) {
cbRowSep.add(mode);
}
cbRowSep.select(0);
rowSep = ExasolConstants.rowSeperators.get(0);
cbRowSep.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
rowSep = ExasolConstants.rowSeperators.get(cbRowSep.getSelectionIndex());
updateSQL();
}
});
// column sep
txColSep = UIUtils.createLabelText(composite, ExasolMessages.dialog_table_tools_column_sep, ";");
txColSep.setTextLimit(1);
txColSep.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent arg0) {
updateSQL();
}
});
// string sep
txStringSep = UIUtils.createLabelText(composite, ExasolMessages.dialog_table_tools_string_sep, "\"");
txStringSep.setTextLimit(1);
txStringSep.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent arg0) {
updateSQL();
}
});
createObjectsSelector(parent);
}
use of org.eclipse.swt.events.SelectionEvent in project dbeaver by serge-rider.
the class ExasolConnectionPage method createControl.
@Override
public void createControl(Composite composite) {
setImageDescriptor(EXASOL_LOGO_IMG);
Composite control = new Composite(composite, SWT.NONE);
control.setLayout(new GridLayout(1, false));
control.setLayoutData(new GridData(GridData.FILL_BOTH));
ModifyListener textListener = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
evaluateURL();
}
};
{
Composite addrGroup = UIUtils.createControlGroup(control, "Database", 2, 0, 0);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
addrGroup.setLayoutData(gd);
Label hostLabel = UIUtils.createControlLabel(addrGroup, "Host List");
hostLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
hostText = new Text(addrGroup, SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.grabExcessHorizontalSpace = true;
hostText.setLayoutData(gd);
hostText.addModifyListener(textListener);
backupHostLabel = UIUtils.createControlLabel(addrGroup, "Backup Host List");
gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
backupHostLabel.setLayoutData(gd);
backupHostLabel.setEnabled(showBackupHosts);
backupHostText = new Text(addrGroup, SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.grabExcessHorizontalSpace = true;
backupHostText.setLayoutData(gd);
backupHostText.addModifyListener(textListener);
useBackupHostList = UIUtils.createLabelCheckbox(addrGroup, "Use Backup Host List", showBackupHosts);
useBackupHostList.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
backupHostLabel.setEnabled(useBackupHostList.getSelection());
backupHostText.setEnabled(useBackupHostList.getSelection());
//reset text if disabled
if (!useBackupHostList.getSelection())
backupHostText.setText("");
}
});
Label portLabel = UIUtils.createControlLabel(addrGroup, ExasolMessages.dialog_connection_port);
gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
portLabel.setLayoutData(gd);
portText = new Text(addrGroup, SWT.BORDER);
gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
gd.widthHint = 40;
portText.setLayoutData(gd);
portText.addVerifyListener(UIUtils.getIntegerVerifyListener(Locale.getDefault()));
portText.addModifyListener(textListener);
encryptCommunication = UIUtils.createLabelCheckbox(addrGroup, "Encrypt Communication", false);
}
{
Composite addrGroup = UIUtils.createControlGroup(control, "Security", 2, 0, 0);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
addrGroup.setLayoutData(gd);
Label usernameLabel = UIUtils.createControlLabel(addrGroup, ExasolMessages.dialog_connection_user_name);
usernameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
usernameText = new Text(addrGroup, SWT.BORDER);
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.widthHint = 200;
usernameText.setLayoutData(gd);
usernameText.addModifyListener(textListener);
Label passwordLabel = UIUtils.createControlLabel(addrGroup, ExasolMessages.dialog_connection_password);
passwordLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
passwordText = new Text(addrGroup, SWT.BORDER | SWT.PASSWORD);
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.widthHint = 200;
passwordText.setLayoutData(gd);
passwordText.addModifyListener(textListener);
}
createDriverPanel(control);
setControl(control);
}
use of org.eclipse.swt.events.SelectionEvent in project dbeaver by serge-rider.
the class ScriptsExportWizardPage method createControl.
@Override
public void createControl(Composite parent) {
String outDir = DBeaverCore.getGlobalPreferenceStore().getString(PREF_SCRIPTS_EXPORT_OUT_DIR);
if (CommonUtils.isEmpty(outDir)) {
outDir = RuntimeUtils.getUserHomeDir().getAbsolutePath();
}
Composite placeholder = UIUtils.createPlaceholder(parent, 1);
placeholder.setLayout(new GridLayout(1, false));
// Project list
scriptsNavigator = new DatabaseNavigatorTree(placeholder, DBeaverCore.getInstance().getNavigatorModel().getRoot(), SWT.BORDER | SWT.CHECK);
GridData gd = new GridData(GridData.FILL_BOTH);
scriptsNavigator.setLayoutData(gd);
CheckboxTreeViewer viewer = (CheckboxTreeViewer) scriptsNavigator.getViewer();
viewer.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
updateState();
}
});
scriptsNavigator.getViewer().addFilter(new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
return element instanceof DBNResource && ((DBNResource) element).getResource() instanceof IContainer;
}
});
// Output folder
Composite generalSettings = UIUtils.createPlaceholder(placeholder, 3);
generalSettings.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
{
overwriteCheck = UIUtils.createCheckbox(generalSettings, CoreMessages.dialog_project_export_wizard_page_checkbox_overwrite_files, false);
gd = new GridData(GridData.BEGINNING);
gd.horizontalSpan = 3;
overwriteCheck.setLayoutData(gd);
UIUtils.createControlLabel(generalSettings, CoreMessages.dialog_project_export_wizard_page_label_directory);
directoryText = new Text(generalSettings, SWT.BORDER);
directoryText.setText(outDir);
directoryText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
directoryText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
updateState();
}
});
Button openFolder = new Button(generalSettings, SWT.PUSH);
openFolder.setImage(DBeaverIcons.getImage(DBIcon.TREE_FOLDER));
openFolder.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.NONE);
dialog.setMessage(CoreMessages.dialog_project_export_wizard_page_dialog_choose_export_dir_message);
dialog.setText(CoreMessages.dialog_project_export_wizard_page_dialog_choose_export_dir_text);
String directory = directoryText.getText();
if (!CommonUtils.isEmpty(directory)) {
dialog.setFilterPath(directory);
}
directory = dialog.open();
if (directory != null) {
directoryText.setText(directory);
}
}
});
}
setControl(placeholder);
updateState();
}
use of org.eclipse.swt.events.SelectionEvent in project dbeaver by serge-rider.
the class DatabaseConsumerPageLoadSettings method createControl.
@Override
public void createControl(Composite parent) {
initializeDialogUnits(parent);
Composite composite = new Composite(parent, SWT.NULL);
GridLayout gl = new GridLayout();
gl.marginHeight = 0;
gl.marginWidth = 0;
composite.setLayout(gl);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
final DatabaseConsumerSettings settings = getWizard().getPageSettings(this, DatabaseConsumerSettings.class);
{
Group performanceSettings = UIUtils.createControlGroup(composite, "Performance", 4, GridData.FILL_HORIZONTAL, 0);
final Button newConnectionCheckbox = UIUtils.createLabelCheckbox(performanceSettings, CoreMessages.data_transfer_wizard_output_checkbox_new_connection, settings.isOpenNewConnections());
newConnectionCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setOpenNewConnections(newConnectionCheckbox.getSelection());
}
});
newConnectionCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 3, 1));
final Button useTransactionsCheck = UIUtils.createLabelCheckbox(performanceSettings, "Use transactions", settings.isUseTransactions());
useTransactionsCheck.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setUseTransactions(useTransactionsCheck.getSelection());
}
});
useTransactionsCheck.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 3, 1));
final Spinner commitAfterEdit = UIUtils.createLabelSpinner(performanceSettings, "Commit after insert of ", settings.getCommitAfterRows(), 1, Integer.MAX_VALUE);
commitAfterEdit.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setCommitAfterRows(commitAfterEdit.getSelection());
}
});
commitAfterEdit.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 3, 1));
}
{
Group generalSettings = UIUtils.createControlGroup(composite, "General", 4, GridData.FILL_HORIZONTAL, 0);
final Button showTableCheckbox = UIUtils.createLabelCheckbox(generalSettings, "Open table editor on finish", settings.isOpenTableOnFinish());
showTableCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setOpenTableOnFinish(showTableCheckbox.getSelection());
}
});
showTableCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 3, 1));
}
setControl(composite);
}
Aggregations