use of org.jkiss.dbeaver.ext.mssql.model.SQLServerAuthentication in project dbeaver by serge-rider.
the class SQLServerConnectionPage method createControl.
@Override
public void createControl(Composite composite) {
boolean isSqlServer = isSqlServer();
boolean isDriverAzure = isSqlServer && isDriverAzure();
Composite settingsGroup = new Composite(composite, SWT.NONE);
GridLayout gl = new GridLayout(4, false);
gl.marginHeight = 10;
gl.marginWidth = 10;
settingsGroup.setLayout(gl);
GridData gd = new GridData(GridData.FILL_BOTH);
settingsGroup.setLayoutData(gd);
{
Label hostLabel = new Label(settingsGroup, SWT.NONE);
hostLabel.setText(SQLServerUIMessages.dialog_connection_host_label);
hostLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
hostText = new Text(settingsGroup, SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.grabExcessHorizontalSpace = true;
hostText.setLayoutData(gd);
if (isDriverAzure) {
// no port number for Azure
gd.horizontalSpan = 3;
} else {
Label portLabel = new Label(settingsGroup, SWT.NONE);
portLabel.setText(SQLServerUIMessages.dialog_connection_port_label);
portLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
portText = new Text(settingsGroup, SWT.BORDER);
gd = new GridData(GridData.CENTER);
gd.widthHint = UIUtils.getFontHeight(portText) * 7;
portText.setLayoutData(gd);
}
}
{
Label dbLabel = new Label(settingsGroup, SWT.NONE);
dbLabel.setText(SQLServerUIMessages.dialog_connection_database_schema_label);
dbLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
dbText = new Text(settingsGroup, SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.grabExcessHorizontalSpace = true;
// gd.widthHint = 270;
gd.horizontalSpan = 3;
dbText.setLayoutData(gd);
}
{
if (SQLServerUtils.isDriverSqlServer(getSite().getDriver())) {
boolean isJtds = SQLServerUtils.isDriverJtds(getSite().getDriver());
List<SQLServerAuthentication> supportedSchemas = new ArrayList<>();
for (SQLServerAuthentication auth : SQLServerAuthentication.values()) {
if (!isJtds || auth.isSupportsJTDS()) {
supportedSchemas.add(auth);
}
}
authSchemas = supportedSchemas.toArray(new SQLServerAuthentication[0]);
authCombo = UIUtils.createLabelCombo(settingsGroup, SQLServerUIMessages.dialog_connection_authentication_combo, SQLServerUIMessages.dialog_connection_authentication_combo_tip, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
for (SQLServerAuthentication authentication : authSchemas) {
authCombo.add(authentication.getTitle());
}
authCombo.select(0);
authCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateSecurityControls();
}
});
authCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
UIUtils.createEmptyLabel(settingsGroup, 2, 1);
/*
if (!isDriverAzure) {
windowsAuthenticationButton = UIUtils.createLabelCheckbox(settingsGroup, SQLServerUIMessages.dialog_connection_windows_authentication_button, false);
windowsAuthenticationButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
enableTexts();
}
});
UIUtils.createEmptyLabel(settingsGroup, 2, 1);
} else {
adpAuthenticationButton = UIUtils.createLabelCheckbox(settingsGroup, SQLServerUIMessages.dialog_connection_adp_authentication_button, false);
UIUtils.createEmptyLabel(settingsGroup, 2, 1);
}
*/
}
userNameLabel = new Label(settingsGroup, SWT.NONE);
userNameLabel.setText(SQLServerUIMessages.dialog_connection_user_name_label);
userNameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
userNameText = new Text(settingsGroup, SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.grabExcessHorizontalSpace = true;
userNameText.setLayoutData(gd);
UIUtils.createEmptyLabel(settingsGroup, 2, 1);
passwordLabel = new Label(settingsGroup, SWT.NONE);
passwordLabel.setText(SQLServerUIMessages.dialog_connection_password_label);
passwordLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
passwordText = createPasswordText(settingsGroup, null);
UIUtils.createEmptyLabel(settingsGroup, 2, 1);
}
{
Group secureGroup = new Group(settingsGroup, SWT.NONE);
secureGroup.setText(SQLServerUIMessages.dialog_setting_connection_settings);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 4;
secureGroup.setLayoutData(gd);
secureGroup.setLayout(new GridLayout(1, false));
createPasswordControls(secureGroup);
showAllSchemas = UIUtils.createCheckbox(secureGroup, SQLServerUIMessages.dialog_setting_show_all_schemas, SQLServerUIMessages.dialog_setting_show_all_schemas_tip, true, 2);
}
createDriverPanel(settingsGroup);
setControl(settingsGroup);
}
Aggregations