use of org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration in project dbeaver by serge-rider.
the class OracleConnectionPage method loadSettings.
@Override
public void loadSettings() {
super.loadSettings();
// Load values from new connection info
DBPConnectionConfiguration connectionInfo = site.getActiveDataSource().getConnectionConfiguration();
final String sidService = connectionInfo.getProviderProperty(OracleConstants.PROP_SID_SERVICE);
if (sidService != null) {
sidServiceCombo.setText(OracleConnectionType.valueOf(sidService).getTitle());
}
//if (isOCI) {
oraHomeSelector.populateHomes(site.getDriver(), connectionInfo.getClientHomeId());
if (tnsNameCombo.getItemCount() == 0) {
populateTnsNameCombo();
}
if (serviceNameCombo.getItemCount() == 0) {
for (String alias : getAvailableServiceNames()) {
serviceNameCombo.add(alias);
}
}
String conTypeProperty = connectionInfo.getProviderProperty(OracleConstants.PROP_CONNECTION_TYPE);
if (conTypeProperty != null) {
connectionType = OracleConstants.ConnectionType.valueOf(CommonUtils.toString(conTypeProperty));
} else {
connectionType = OracleConstants.ConnectionType.BASIC;
}
connectionTypeFolder.setSelection(connectionType.ordinal());
switch(connectionType) {
case BASIC:
hostText.setText(CommonUtils.notEmpty(connectionInfo.getHostName()));
if (!CommonUtils.isEmpty(connectionInfo.getHostPort())) {
portText.setText(String.valueOf(connectionInfo.getHostPort()));
} else if (site.getDriver().getDefaultPort() != null) {
portText.setText(site.getDriver().getDefaultPort());
} else {
portText.setText("");
}
serviceNameCombo.setText(CommonUtils.notEmpty(connectionInfo.getDatabaseName()));
break;
case TNS:
{
tnsNameCombo.setText(CommonUtils.notEmpty(connectionInfo.getDatabaseName()));
String tnsPathProperty = connectionInfo.getProviderProperty(OracleConstants.PROP_TNS_PATH);
// }
if (tnsPathProperty != null) {
tnsPathText.setText(tnsPathProperty);
}
break;
}
case CUSTOM:
connectionUrlText.setText(CommonUtils.notEmpty(connectionInfo.getUrl()));
break;
}
if (OracleConstants.OS_AUTH_USER_NAME.equals(connectionInfo.getUserName())) {
userNameText.setEnabled(false);
passwordText.setEnabled(false);
osAuthCheck.setSelection(true);
} else {
userNameText.setText(CommonUtils.notEmpty(connectionInfo.getUserName()));
passwordText.setText(CommonUtils.notEmpty(connectionInfo.getUserPassword()));
osAuthCheck.setSelection(false);
}
final String roleName = connectionInfo.getProviderProperty(OracleConstants.PROP_INTERNAL_LOGON);
if (roleName != null) {
userRoleCombo.setText(roleName.toUpperCase(Locale.ENGLISH));
}
}
use of org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration in project dbeaver by serge-rider.
the class DatabaseNavigatorLabelProvider method getToolTipText.
@Override
public String getToolTipText(Object element) {
if (element instanceof DBNDataSource) {
final DBPDataSourceContainer ds = ((DBNDataSource) element).getDataSourceContainer();
if (ds != null) {
StringBuilder info = new StringBuilder();
info.append("Name: ").append(ds.getName()).append("\n");
final DBPConnectionConfiguration cfg = ds.getConnectionConfiguration();
if (!CommonUtils.isEmpty(cfg.getUrl())) {
info.append("URL: ").append(cfg.getUrl()).append("\n");
} else if (!CommonUtils.isEmpty(cfg.getDatabaseName())) {
info.append("Database: ").append(cfg.getDatabaseName()).append("\n");
}
if (!CommonUtils.isEmpty(cfg.getUserName())) {
info.append("User: ").append(cfg.getUserName()).append("\n");
}
if (!CommonUtils.isEmpty(ds.getDescription())) {
info.append("Description: ").append(ds.getDescription()).append("\n");
}
/*
if (cfg.getConnectionType() != null) {
info.append("Type: ").append(cfg.getConnectionType().getName()).append("\n");
}
*/
if (ds.isConnectionReadOnly()) {
info.append("Read-only connection\n");
}
if (ds.isProvided()) {
info.append("Provided connection\n");
}
return info.toString().trim();
}
} else if (element instanceof DBNDatabaseNode) {
final String description = ((DBNDatabaseNode) element).getNodeDescription();
if (!CommonUtils.isEmptyTrimmed(description)) {
return description;
}
}
return null;
}
use of org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration in project dbeaver by serge-rider.
the class PostgreConnectionPage method loadSettings.
@Override
public void loadSettings() {
super.loadSettings();
if (!activated) {
setImageDescriptor(LOGO_IMG);
}
// Load values from new connection info
DBPConnectionConfiguration connectionInfo = site.getActiveDataSource().getConnectionConfiguration();
if (hostText != null) {
if (!CommonUtils.isEmpty(connectionInfo.getHostName())) {
hostText.setText(connectionInfo.getHostName());
} else {
hostText.setText(PostgreConstants.DEFAULT_HOST);
}
}
if (portText != null) {
if (!CommonUtils.isEmpty(connectionInfo.getHostPort())) {
portText.setText(String.valueOf(connectionInfo.getHostPort()));
} else if (site.getDriver().getDefaultPort() != null) {
portText.setText(site.getDriver().getDefaultPort());
} else {
portText.setText("");
}
}
if (dbText != null) {
String databaseName = connectionInfo.getDatabaseName();
if (CommonUtils.isEmpty(databaseName) && getSite().isNew()) {
databaseName = PostgreConstants.DEFAULT_DATABASE;
}
dbText.setText(databaseName);
}
if (usernameText != null) {
usernameText.setText(CommonUtils.notEmpty(connectionInfo.getUserName()));
}
if (passwordText != null) {
passwordText.setText(CommonUtils.notEmpty(connectionInfo.getUserPassword()));
}
homesSelector.populateHomes(site.getDriver(), connectionInfo.getClientHomeId());
final boolean showNDD = CommonUtils.toBoolean(connectionInfo.getProviderProperty(PostgreConstants.PROP_SHOW_NON_DEFAULT_DB));
hideNonDefault.setSelection(showNDD);
activated = true;
}
use of org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration in project dbeaver by serge-rider.
the class PostgreConnectionPage method saveSettings.
@Override
public void saveSettings(DBPDataSourceContainer dataSource) {
DBPConnectionConfiguration connectionInfo = dataSource.getConnectionConfiguration();
if (hostText != null) {
connectionInfo.setHostName(hostText.getText().trim());
}
if (portText != null) {
connectionInfo.setHostPort(portText.getText().trim());
}
if (dbText != null) {
connectionInfo.setDatabaseName(dbText.getText().trim());
}
if (usernameText != null) {
connectionInfo.setUserName(usernameText.getText().trim());
}
if (passwordText != null) {
connectionInfo.setUserPassword(passwordText.getText());
}
if (homesSelector != null) {
connectionInfo.setClientHomeId(homesSelector.getSelectedHome());
}
connectionInfo.setProviderProperty(PostgreConstants.PROP_SHOW_NON_DEFAULT_DB, String.valueOf(hideNonDefault.getSelection()));
super.saveSettings(dataSource);
}
use of org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration in project dbeaver by serge-rider.
the class WMIConnectionPage method saveSettings.
@Override
public void saveSettings(DBPDataSourceContainer dataSource) {
DBPConnectionConfiguration connectionInfo = dataSource.getConnectionConfiguration();
if (hostText != null) {
connectionInfo.setHostName(hostText.getText().trim());
}
if (domainText != null) {
connectionInfo.setServerName(domainText.getText().trim());
}
if (namespaceCombo != null) {
connectionInfo.setDatabaseName(namespaceCombo.getText().trim());
}
if (usernameText != null) {
connectionInfo.setUserName(usernameText.getText().trim());
}
if (passwordText != null) {
connectionInfo.setUserPassword(passwordText.getText());
}
super.saveSettings(dataSource);
}
Aggregations