use of org.eclipse.swt.events.SelectionEvent in project dbeaver by serge-rider.
the class EditShellCommandsDialogPage method createControl.
@Override
public void createControl(Composite parent) {
Composite group = UIUtils.createPlaceholder(parent, 2);
group.setLayoutData(new GridData(GridData.FILL_BOTH));
{
Composite eventGroup = new Composite(group, SWT.NONE);
eventGroup.setLayout(new GridLayout(1, false));
eventGroup.setLayoutData(new GridData(GridData.FILL_VERTICAL));
UIUtils.createControlLabel(eventGroup, CoreMessages.dialog_connection_events_label_event);
eventTypeTable = new Table(eventGroup, SWT.BORDER | SWT.CHECK | SWT.SINGLE | SWT.FULL_SELECTION);
eventTypeTable.setLayoutData(new GridData(GridData.FILL_VERTICAL));
eventTypeTable.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
if (event.detail == SWT.CHECK) {
eventTypeTable.select(eventTypeTable.indexOf((TableItem) event.item));
}
}
});
for (DBPConnectionEventType eventType : DBPConnectionEventType.values()) {
DBRShellCommand command = eventsCache.get(eventType);
TableItem item = new TableItem(eventTypeTable, SWT.NONE);
item.setData(eventType);
item.setText(eventType.getTitle());
item.setImage(DBeaverIcons.getImage(UIIcon.EVENT));
item.setChecked(command != null && command.isEnabled());
}
eventTypeTable.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
DBPConnectionEventType eventType = getSelectedEventType();
selectEventType(eventType);
DBRShellCommand command = eventType == null ? null : eventsCache.get(eventType);
boolean enabled = ((TableItem) e.item).getChecked();
if (enabled || (command != null && enabled != command.isEnabled())) {
updateEvent(false);
}
}
});
}
{
Composite detailsGroup = new Composite(group, SWT.NONE);
detailsGroup.setLayout(new GridLayout(1, false));
detailsGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
//UIUtils.createControlGroup(group, "Event", 1, GridData.FILL_BOTH | GridData.HORIZONTAL_ALIGN_BEGINNING, 0);
UIUtils.createControlLabel(detailsGroup, CoreMessages.dialog_connection_events_label_command);
commandText = new Text(detailsGroup, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
commandText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
updateEvent(true);
}
});
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.heightHint = 60;
gd.widthHint = 300;
commandText.setLayoutData(gd);
SelectionAdapter eventEditAdapter = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateEvent(false);
}
};
showProcessCheck = UIUtils.createCheckbox(detailsGroup, CoreMessages.dialog_connection_events_checkbox_show_process, false);
showProcessCheck.addSelectionListener(eventEditAdapter);
waitFinishCheck = UIUtils.createCheckbox(detailsGroup, CoreMessages.dialog_connection_events_checkbox_wait_finish, false);
waitFinishCheck.addSelectionListener(eventEditAdapter);
terminateCheck = UIUtils.createCheckbox(detailsGroup, CoreMessages.dialog_connection_events_checkbox_terminate_at_disconnect, false);
terminateCheck.addSelectionListener(eventEditAdapter);
Group helpGroup = new Group(detailsGroup, SWT.NONE);
helpGroup.setText("Command parameters");
helpGroup.setLayout(new GridLayout(2, false));
helpGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
Label infoLabel = new Label(helpGroup, SWT.NONE);
infoLabel.setText("You may use following variables:");
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
infoLabel.setLayoutData(gd);
addVariableLegend(helpGroup, RegistryConstants.VARIABLE_HOST, "target host");
addVariableLegend(helpGroup, RegistryConstants.VARIABLE_PORT, "target port");
addVariableLegend(helpGroup, RegistryConstants.VARIABLE_SERVER, "target server name");
addVariableLegend(helpGroup, RegistryConstants.VARIABLE_DATABASE, "target database");
addVariableLegend(helpGroup, RegistryConstants.VARIABLE_USER, "user name");
addVariableLegend(helpGroup, RegistryConstants.VARIABLE_PASSWORD, "password (plain)");
addVariableLegend(helpGroup, RegistryConstants.VARIABLE_URL, "JDBC URL");
}
selectEventType(null);
setControl(group);
}
use of org.eclipse.swt.events.SelectionEvent in project dbeaver by serge-rider.
the class ConnectionPageAbstract method createDriverPanel.
protected void createDriverPanel(Composite parent) {
int numColumns = ((GridLayout) parent.getLayout()).numColumns;
Composite panel = UIUtils.createPlaceholder(parent, 4, 5);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = numColumns;
panel.setLayoutData(gd);
Composite placeholder = UIUtils.createPlaceholder(panel, 1);
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_END);
gd.horizontalSpan = 4;
gd.grabExcessHorizontalSpace = true;
gd.grabExcessVerticalSpace = true;
placeholder.setLayoutData(gd);
if (!site.isNew() && !site.getDriver().isEmbedded()) {
Link netConfigLink = new Link(panel, SWT.NONE);
netConfigLink.setText("<a>Network settings (SSH, SSL, Proxy, ...)</a>");
netConfigLink.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
site.openSettingsPage(ConnectionPageNetwork.PAGE_NAME);
}
});
gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
gd.horizontalSpan = 4;
netConfigLink.setLayoutData(gd);
}
Label divLabel = new Label(panel, SWT.SEPARATOR | SWT.HORIZONTAL);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 4;
divLabel.setLayoutData(gd);
Label driverLabel = new Label(panel, SWT.NONE);
driverLabel.setText(CoreMessages.dialog_connection_driver);
gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
driverLabel.setLayoutData(gd);
driverText = new Text(panel, SWT.READ_ONLY);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.grabExcessHorizontalSpace = true;
gd.horizontalSpan = 2;
//gd.widthHint = 200;
driverText.setLayoutData(gd);
Button driverButton = new Button(panel, SWT.PUSH);
driverButton.setText(CoreMessages.dialog_connection_edit_driver_button);
gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
driverButton.setLayoutData(gd);
driverButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
if (site.openDriverEditor()) {
updateDriverInfo(site.getDriver());
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
}
use of org.eclipse.swt.events.SelectionEvent 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.SelectionEvent 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.SelectionEvent 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;
}
Aggregations