use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.
the class DB2ReorgTableDialog method createControls.
@Override
protected void createControls(Composite parent) {
Group optionsGroup = UIUtils.createControlGroup(parent, DB2Messages.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));
// INPLACE
dlgInplace = UIUtils.createCheckbox(composite, DB2Messages.dialog_table_tools_reorg_inplace, false);
dlgInplace.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (dlgInplace.getSelection()) {
dlgTruncate.setEnabled(true);
dlgTruncate.setSelection(true);
dlgUseTempTS.setEnabled(false);
dlgIndexScan.setEnabled(false);
dlgReorgLobsTS.setEnabled(false);
dlgUseLobsTemp.setEnabled(false);
dlgResetDictionary.setEnabled(false);
dlgAccesReadWrite.setEnabled(true);
dlgAccesNo.setEnabled(false);
dlgAccesNo.setSelection(false);
dlgAccesReadWrite.setSelection(false);
dlgAccesReadOnly.setSelection(true);
} else {
dlgTruncate.setEnabled(false);
dlgTruncate.setSelection(false);
dlgUseTempTS.setEnabled(true);
dlgIndexScan.setEnabled(true);
dlgReorgLobsTS.setEnabled(true);
dlgUseLobsTemp.setEnabled(true);
dlgResetDictionary.setEnabled(true);
dlgAccesNo.setEnabled(true);
dlgAccesReadWrite.setEnabled(false);
dlgAccesReadWrite.setSelection(false);
dlgAccesReadOnly.setSelection(false);
dlgAccesNo.setSelection(true);
}
updateSQL();
}
});
UIUtils.createPlaceholder(composite, 1);
// USE INDEX
dlgUseIndex = UIUtils.createCheckbox(composite, DB2Messages.dialog_table_tools_reorg_useindex, false);
dlgUseIndex.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (dlgUseIndex.getSelection()) {
indexesCombo.setEnabled(true);
dlgIndexScan.setEnabled(true);
} else {
indexesCombo.setEnabled(false);
dlgIndexScan.setEnabled(false);
}
updateSQL();
}
});
indexesCombo = createIndexesCombo(composite);
// INDEXSCAN
dlgIndexScan = UIUtils.createCheckbox(composite, DB2Messages.dialog_table_tools_reorg_useindexscan, false);
dlgIndexScan.addSelectionListener(SQL_CHANGE_LISTENER);
UIUtils.createPlaceholder(composite, 1);
// TRUNCATE
dlgTruncate = UIUtils.createCheckbox(composite, DB2Messages.dialog_table_tools_reorg_truncate, false);
dlgTruncate.addSelectionListener(SQL_CHANGE_LISTENER);
UIUtils.createPlaceholder(composite, 1);
// USE TEMP TS
dlgUseTempTS = UIUtils.createCheckbox(composite, DB2Messages.dialog_table_tools_reorg_usetempts, false);
dlgUseTempTS.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (dlgUseTempTS.getSelection()) {
tempTSCombo.setEnabled(true);
} else {
tempTSCombo.setEnabled(false);
}
updateSQL();
}
});
tempTSCombo = createTempTablespaceCombo(composite);
// REORG LONG AND LOBS
dlgReorgLobsTS = UIUtils.createCheckbox(composite, DB2Messages.dialog_table_tools_reorg_reorglobs, false);
dlgReorgLobsTS.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (dlgReorgLobsTS.getSelection()) {
dlgUseLobsTemp.setEnabled(true);
tempLobsTSCombo.setEnabled(false);
} else {
dlgUseLobsTemp.setEnabled(false);
tempLobsTSCombo.setEnabled(false);
}
updateSQL();
}
});
UIUtils.createPlaceholder(composite, 1);
// REORG LONG AND LOBS TEMP TS
dlgUseLobsTemp = UIUtils.createCheckbox(composite, DB2Messages.dialog_table_tools_reorg_reorglobsts, false);
dlgUseLobsTemp.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (dlgUseLobsTemp.getSelection()) {
tempLobsTSCombo.setEnabled(true);
} else {
tempLobsTSCombo.setEnabled(false);
}
updateSQL();
}
});
tempLobsTSCombo = createLobsTempTablespaceCombo(composite);
// RESET DICTIONARY
dlgResetDictionary = UIUtils.createCheckbox(composite, DB2Messages.dialog_table_tools_reorg_resetdict, false);
dlgResetDictionary.addSelectionListener(SQL_CHANGE_LISTENER);
UIUtils.createPlaceholder(composite, 1);
// TABLE ACCESS
UIUtils.createLabel(composite, DB2Messages.dialog_table_tools_reorg_access_title);
Composite groupRB = new Composite(composite, SWT.NULL);
groupRB.setLayout(new RowLayout());
dlgAccesNo = new Button(groupRB, SWT.RADIO);
dlgAccesNo.setText(DB2Messages.dialog_table_tools_reorg_access_no);
dlgAccesNo.addSelectionListener(SQL_CHANGE_LISTENER);
dlgAccesReadOnly = new Button(groupRB, SWT.RADIO);
dlgAccesReadOnly.setText(DB2Messages.dialog_table_tools_reorg_access_read);
dlgAccesReadOnly.addSelectionListener(SQL_CHANGE_LISTENER);
dlgAccesReadWrite = new Button(groupRB, SWT.RADIO);
dlgAccesReadWrite.setText(DB2Messages.dialog_table_tools_reorg_access_readwrite);
dlgAccesReadWrite.addSelectionListener(SQL_CHANGE_LISTENER);
// Initial setup
dlgTruncate.setEnabled(false);
dlgIndexScan.setEnabled(false);
dlgUseLobsTemp.setEnabled(false);
tempLobsTSCombo.setEnabled(false);
dlgAccesReadWrite.setEnabled(false);
dlgAccesReadOnly.setSelection(true);
indexName = listIndexNames.isEmpty() ? null : listIndexNames.get(0);
tempTablespace = listTempTsNames.isEmpty() ? null : listTempTsNames.get(0);
lobsTablespace = listTempTsNames.isEmpty() ? null : listTempTsNames.get(0);
// Object Selector
createObjectsSelector(parent);
}
use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.
the class DB2ReorgTableDialog method createTempTablespaceCombo.
private Combo createTempTablespaceCombo(Composite parent) {
final Combo combo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
for (String tablespaceName : listTempTsNames) {
combo.add(tablespaceName);
}
combo.select(0);
combo.setEnabled(false);
combo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
tempTablespace = listTempTsNames.get(combo.getSelectionIndex());
updateSQL();
}
});
return combo;
}
use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.
the class DB2RunstatsDialog method createControls.
@Override
protected void createControls(Composite parent) {
Group optionsGroup = UIUtils.createControlGroup(parent, DB2Messages.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));
// RUNSTATS ON COLUMNS
UIUtils.createLabel(composite, DB2Messages.dialog_table_tools_runstats_cols_title).setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
Composite groupCols = new Composite(composite, SWT.NONE);
groupCols.setLayout(new RowLayout(SWT.VERTICAL));
dlgColsAllAndDistribution = new Button(groupCols, SWT.RADIO);
dlgColsAllAndDistribution.setText(DB2Messages.dialog_table_tools_runstats_cols_all_and_distribution);
dlgColsAllAndDistribution.addSelectionListener(SQL_CHANGE_LISTENER);
dlgColsAll = new Button(groupCols, SWT.RADIO);
dlgColsAll.setText(DB2Messages.dialog_table_tools_runstats_cols_all);
dlgColsAll.addSelectionListener(SQL_CHANGE_LISTENER);
Button dlgColsNo = new Button(groupCols, SWT.RADIO);
dlgColsNo.setText(DB2Messages.dialog_table_tools_runstats_cols_no);
dlgColsNo.addSelectionListener(SQL_CHANGE_LISTENER);
// RUNSTATS ON INDEXES
UIUtils.createLabel(composite, DB2Messages.dialog_table_tools_runstats_indexes_title).setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
Composite groupIx = new Composite(composite, SWT.NULL);
groupIx.setLayout(new RowLayout(SWT.VERTICAL));
dlgIndexesDetailed = new Button(groupIx, SWT.RADIO);
dlgIndexesDetailed.setText(DB2Messages.dialog_table_tools_runstats_indexes_detailed);
dlgIndexesDetailed.addSelectionListener(SQL_CHANGE_LISTENER);
dlgIndexesAll = new Button(groupIx, SWT.RADIO);
dlgIndexesAll.setText(DB2Messages.dialog_table_tools_runstats_indexes_all);
dlgIndexesAll.addSelectionListener(SQL_CHANGE_LISTENER);
Button dlgIndexesNo = new Button(groupIx, SWT.RADIO);
dlgIndexesNo.setText(DB2Messages.dialog_table_tools_runstats_indexes_no);
dlgIndexesNo.addSelectionListener(SQL_CHANGE_LISTENER);
// SAMPLING
dlgSample = UIUtils.createCheckbox(composite, DB2Messages.dialog_table_tools_runstats_stats_title, false);
dlgSample.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
dlgSampleValue.setEnabled(dlgSample.getSelection());
updateSQL();
}
});
dlgSampleValue = new Spinner(composite, SWT.BORDER);
dlgSampleValue.setMinimum(0);
dlgSampleValue.setMaximum(100);
dlgSampleValue.setIncrement(1);
Rectangle clientArea = getShell().getClientArea();
dlgSampleValue.setLocation(clientArea.x, clientArea.y);
dlgSampleValue.pack();
dlgSampleValue.addSelectionListener(SQL_CHANGE_LISTENER);
// Initial setup
dlgColsAllAndDistribution.setSelection(true);
dlgIndexesDetailed.setSelection(true);
dlgSampleValue.setSelection(0);
dlgSampleValue.setEnabled(false);
// Object Selector
createObjectsSelector(parent);
}
use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.
the class DB2TruncateDialog method createControls.
@Override
protected void createControls(Composite parent) {
Group optionsGroup = UIUtils.createControlGroup(parent, DB2Messages.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));
// Drop/Reuse Storage
UIUtils.createLabel(composite, DB2Messages.dialog_table_tools_truncate_storage_title).setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
Composite groupCols = new Composite(composite, SWT.NONE);
groupCols.setLayout(new RowLayout(SWT.VERTICAL));
dlgStorageDrop = new Button(groupCols, SWT.RADIO);
dlgStorageDrop.setText(DB2Messages.dialog_table_tools_truncate_storage_drop);
dlgStorageDrop.addSelectionListener(SQL_CHANGE_LISTENER);
dlgStorageReuse = new Button(groupCols, SWT.RADIO);
dlgStorageReuse.setText(DB2Messages.dialog_table_tools_truncate_storage_reuse);
dlgStorageReuse.addSelectionListener(SQL_CHANGE_LISTENER);
// Triggers Clauses
UIUtils.createLabel(composite, DB2Messages.dialog_table_tools_truncate_triggers_title).setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
Composite groupIx = new Composite(composite, SWT.NULL);
groupIx.setLayout(new RowLayout(SWT.VERTICAL));
dlgTriggersDelete = new Button(groupIx, SWT.RADIO);
dlgTriggersDelete.setText(DB2Messages.dialog_table_tools_truncate_triggers_ignore);
dlgTriggersDelete.addSelectionListener(SQL_CHANGE_LISTENER);
dlgTriggersRestrict = new Button(groupIx, SWT.RADIO);
dlgTriggersRestrict.setText(DB2Messages.dialog_table_tools_truncate_triggers_restrict);
dlgTriggersRestrict.addSelectionListener(SQL_CHANGE_LISTENER);
// Initial setup
dlgStorageDrop.setSelection(true);
dlgTriggersDelete.setSelection(true);
// Object Selector
createObjectsSelector(parent);
}
use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.
the class PostgreWizardPageSettings method createSecurityGroup.
public void createSecurityGroup(Composite parent) {
try {
final SecuredPasswordEncrypter encrypter = new SecuredPasswordEncrypter();
final DBPConnectionConfiguration connectionInfo = wizard.getConnectionInfo();
final String authProperty = DBConstants.INTERNAL_PROP_PREFIX + "-auth-" + wizard.getObjectsName() + "@";
String authUser = null;
String authPassword = null;
{
String authValue = connectionInfo.getProviderProperty(authProperty);
if (authValue != null) {
String authCredentials = encrypter.decrypt(authValue);
int divPos = authCredentials.indexOf(':');
if (divPos != -1) {
authUser = authCredentials.substring(0, divPos);
authPassword = authCredentials.substring(divPos + 1);
}
}
}
wizard.setToolUserName(authUser == null ? connectionInfo.getUserName() : authUser);
wizard.setToolUserPassword(authPassword == null ? connectionInfo.getUserPassword() : authPassword);
final boolean savePassword = authUser != null;
Group securityGroup = UIUtils.createControlGroup(parent, "Security", 2, GridData.HORIZONTAL_ALIGN_BEGINNING, 0);
Label infoLabel = new Label(securityGroup, SWT.NONE);
infoLabel.setText("Override user credentials (" + wizard.getConnectionInfo().getUserName() + ") for pg_dump'.");
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
infoLabel.setLayoutData(gd);
Button authButton = new Button(securityGroup, SWT.PUSH);
authButton.setText("Authentication");
authButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
BaseAuthDialog authDialog = new BaseAuthDialog(getShell(), "Authentication", false);
authDialog.setUserName(wizard.getToolUserName());
authDialog.setUserPassword(wizard.getToolUserPassword());
authDialog.setSavePassword(savePassword);
if (authDialog.open() == IDialogConstants.OK_ID) {
wizard.setToolUserName(authDialog.getUserName());
wizard.setToolUserPassword(authDialog.getUserPassword());
if (authDialog.isSavePassword()) {
try {
connectionInfo.setProviderProperty(authProperty, encrypter.encrypt(wizard.getToolUserName() + ':' + wizard.getToolUserPassword()));
} catch (EncryptionException e1) {
// Never be here
}
}
}
}
});
Button resetButton = new Button(securityGroup, SWT.PUSH);
resetButton.setText("Reset to default");
resetButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
connectionInfo.getProviderProperties().remove(authProperty);
wizard.setToolUserName(connectionInfo.getUserName());
wizard.setToolUserPassword(connectionInfo.getUserPassword());
}
});
} catch (EncryptionException e) {
// Never be here
}
}
Aggregations