use of org.eclipse.swt.events.SelectionAdapter in project dbeaver by serge-rider.
the class PendingTransactionsDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
getShell().setText("Pending transactions");
Composite composite = (Composite) super.createDialogArea(parent);
contextTree = new Tree(composite, SWT.FULL_SELECTION | SWT.BORDER);
contextTree.setHeaderVisible(true);
contextTree.setLinesVisible(true);
TreeColumn colName = new TreeColumn(contextTree, SWT.NONE);
colName.setText("Connection");
TreeColumn colTxn = new TreeColumn(contextTree, SWT.RIGHT);
colTxn.setText("Transaction");
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = contextTree.getHeaderHeight() + contextTree.getItemHeight() * 5;
contextTree.setLayoutData(gd);
contextTree.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (e.item != null && e.item.getData() instanceof DBCExecutionContext) {
selectedContext = (DBCExecutionContext) e.item.getData();
} else {
selectedContext = null;
}
boolean hasTransaction = selectedContext != null && QMUtils.isTransactionActive(selectedContext);
commitButton.setEnabled(hasTransaction);
rollbackButton.setEnabled(hasTransaction);
logViewer.setFilter(createContextFilter(selectedContext));
logViewer.refresh();
}
});
{
Composite controlPanel = UIUtils.createPlaceholder(composite, 3, 5);
controlPanel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
final Button showAllCheck = UIUtils.createCheckbox(controlPanel, "Show all connections", "Show all datasource connections. Otherwise shows only transactional connections.", false, 1);
showAllCheck.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
loadContexts(showAllCheck.getSelection());
}
});
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.grabExcessHorizontalSpace = true;
showAllCheck.setLayoutData(gd);
commitButton = UIUtils.createPushButton(controlPanel, "Commit", DBeaverIcons.getImage(UIIcon.TXN_COMMIT));
commitButton.setEnabled(false);
commitButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
endTransaction(true);
}
});
rollbackButton = UIUtils.createPushButton(controlPanel, "Rollback", DBeaverIcons.getImage(UIIcon.TXN_ROLLBACK));
rollbackButton.setEnabled(false);
rollbackButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
endTransaction(false);
}
});
}
super.createTransactionLogPanel(composite);
loadContexts(false);
return parent;
}
use of org.eclipse.swt.events.SelectionAdapter in project dbeaver by serge-rider.
the class DataFormatProfilesEditDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
getShell().setText(CoreMessages.dialog_data_format_profiles_title);
Composite group = new Composite(parent, SWT.NONE);
group.setLayout(new GridLayout(1, false));
group.setLayoutData(new GridData(GridData.FILL_BOTH));
profileList = new org.eclipse.swt.widgets.List(group, SWT.SINGLE | SWT.BORDER);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = 300;
gd.heightHint = 200;
profileList.setLayoutData(gd);
profileList.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
getButton(DELETE_ID).setEnabled(profileList.getSelectionIndex() >= 0);
}
});
loadProfiles();
return parent;
}
use of org.eclipse.swt.events.SelectionAdapter in project dbeaver by serge-rider.
the class DateTimeStandaloneEditor method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
IValueController valueController = getValueController();
Object value = valueController.getValue();
Composite dialogGroup = (Composite) super.createDialogArea(parent);
Composite panel = UIUtils.createPlaceholder(dialogGroup, 3);
panel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
int style = SWT.BORDER;
if (valueController.isReadOnly()) {
style |= SWT.READ_ONLY;
}
UIUtils.createControlLabel(panel, "Time").setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
timeEditor = new CustomTimeEditor(panel, style);
timeEditor.getControl().addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
dirty = true;
}
});
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalAlignment = GridData.CENTER;
timeEditor.getControl().setLayoutData(gd);
primeEditorValue(value);
Button button = UIUtils.createPushButton(panel, "Set Current", null);
button.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
button.setEnabled(!valueController.isReadOnly());
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
primeEditorValue(new Date());
}
});
return dialogGroup;
}
use of org.eclipse.swt.events.SelectionAdapter 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.SelectionAdapter 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);
}
Aggregations