Search in sources :

Example 1 with AWSRegion

use of org.jkiss.dbeaver.ext.athena.model.AWSRegion in project dbeaver by serge-rider.

the class AthenaConnectionPage method loadSettings.

@Override
public void loadSettings() {
    super.loadSettings();
    // Load values from new connection info
    DBPConnectionConfiguration connectionInfo = site.getActiveDataSource().getConnectionConfiguration();
    if (awsRegionCombo != null) {
        awsRegionCombo.removeAll();
        for (AWSRegion region : AWSRegion.values()) {
            awsRegionCombo.add(region.getId());
        }
        if (!CommonUtils.isEmpty(connectionInfo.getServerName())) {
            awsRegionCombo.setText(connectionInfo.getServerName());
        }
        if (awsRegionCombo.getText().isEmpty()) {
            awsRegionCombo.setText(AWSRegion.us_west_1.getId());
        }
    }
    if (s3LocationText != null) {
        String databaseName = connectionInfo.getDatabaseName();
        if (CommonUtils.isEmpty(databaseName)) {
            // $NON-NLS-1$
            databaseName = "s3://";
        }
        s3LocationText.setText(databaseName);
    }
    if (accessKeyText != null) {
        accessKeyText.setText(CommonUtils.notEmpty(connectionInfo.getUserName()));
    }
    if (passwordText != null) {
        passwordText.setText(CommonUtils.notEmpty(connectionInfo.getUserPassword()));
    }
}
Also used : DBPConnectionConfiguration(org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration) AWSRegion(org.jkiss.dbeaver.ext.athena.model.AWSRegion)

Example 2 with AWSRegion

use of org.jkiss.dbeaver.ext.athena.model.AWSRegion in project dbeaver by dbeaver.

the class AthenaConnectionPage method loadSettings.

@Override
public void loadSettings() {
    super.loadSettings();
    // Load values from new connection info
    DBPConnectionConfiguration connectionInfo = site.getActiveDataSource().getConnectionConfiguration();
    if (awsRegionCombo != null) {
        awsRegionCombo.removeAll();
        for (AWSRegion region : AWSRegion.values()) {
            awsRegionCombo.add(region.getId());
        }
        if (!CommonUtils.isEmpty(connectionInfo.getServerName())) {
            awsRegionCombo.setText(connectionInfo.getServerName());
        }
        if (awsRegionCombo.getText().isEmpty()) {
            awsRegionCombo.setText(AWSRegion.us_west_1.getId());
        }
    }
    if (s3LocationText != null) {
        String databaseName = connectionInfo.getDatabaseName();
        if (CommonUtils.isEmpty(databaseName)) {
            // $NON-NLS-1$
            databaseName = "s3://";
        }
        s3LocationText.setText(databaseName);
    }
    if (accessKeyText != null) {
        accessKeyText.setText(CommonUtils.notEmpty(connectionInfo.getUserName()));
    }
    if (passwordText != null) {
        passwordText.setText(CommonUtils.notEmpty(connectionInfo.getUserPassword()));
    }
}
Also used : DBPConnectionConfiguration(org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration) AWSRegion(org.jkiss.dbeaver.ext.athena.model.AWSRegion)

Aggregations

AWSRegion (org.jkiss.dbeaver.ext.athena.model.AWSRegion)2 DBPConnectionConfiguration (org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration)2