Search in sources :

Example 6 with EncryptionException

use of org.jkiss.dbeaver.runtime.encode.EncryptionException in project dbeaver by dbeaver.

the class PrefPageDrivers method performOk.

@Override
public boolean performOk() {
    DBPPreferenceStore store = DBWorkbench.getPlatform().getPreferenceStore();
    store.setValue(ModelPreferences.UI_DRIVERS_VERSION_UPDATE, versionUpdateCheck.getSelection());
    store.setValue(ModelPreferences.UI_PROXY_HOST, proxyHostText.getText());
    store.setValue(ModelPreferences.UI_PROXY_PORT, proxyPortSpinner.getSelection());
    store.setValue(ModelPreferences.UI_PROXY_USER, proxyUserText.getText());
    String password = proxyPasswordText.getText();
    if (!CommonUtils.isEmpty(password) && encrypter != null) {
        // Encrypt password
        try {
            password = encrypter.encrypt(password);
        } catch (EncryptionException e) {
            log.warn(e);
        }
    }
    store.setValue(ModelPreferences.UI_PROXY_PASSWORD, password);
    store.setValue(ModelPreferences.UI_DRIVERS_HOME, customDriversHome.getText());
    {
        StringBuilder sources = new StringBuilder();
        for (String item : sourceList.getItems()) {
            if (sources.length() > 0)
                sources.append('|');
            sources.append(item);
        }
        store.setValue(ModelPreferences.UI_DRIVERS_SOURCES, sources.toString());
    }
    PrefUtils.savePreferenceStore(store);
    return super.performOk();
}
Also used : EncryptionException(org.jkiss.dbeaver.runtime.encode.EncryptionException) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Aggregations

EncryptionException (org.jkiss.dbeaver.runtime.encode.EncryptionException)6 DBPPreferenceStore (org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)4 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 GridData (org.eclipse.swt.layout.GridData)2 Button (org.eclipse.swt.widgets.Button)2 Group (org.eclipse.swt.widgets.Group)2 Label (org.eclipse.swt.widgets.Label)2 DBPConnectionConfiguration (org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration)2 SecuredPasswordEncrypter (org.jkiss.dbeaver.runtime.encode.SecuredPasswordEncrypter)2 BaseAuthDialog (org.jkiss.dbeaver.ui.dialogs.BaseAuthDialog)2