提交 e5bcb928 编写于 作者: S serge@jkiss.org

Network profiles init fix


Former-commit-id: 1bfcf97a
上级 cf0233cf
......@@ -17,6 +17,7 @@
package org.jkiss.dbeaver.ui.dialogs.connection;
import org.eclipse.jface.dialogs.ControlEnableState;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
......@@ -135,7 +136,9 @@ public class ConnectionPageNetworkHandler extends ConnectionWizardPage implement
null,
null);
if (preferenceDialog != null) {
preferenceDialog.open();
if (preferenceDialog.open() == IDialogConstants.OK_ID) {
setConnectionConfigProfile(profileCombo.getText());
}
}
}
});
......@@ -161,9 +164,6 @@ public class ConnectionPageNetworkHandler extends ConnectionWizardPage implement
saveSettings(site.getActiveDataSource());
if (activeProfile != null) {
if (CommonUtils.equalObjects(oldProfileId, activeProfile.getProfileName())) {
return;
}
cfg.setConfigProfile(activeProfile);
handlerConfiguration = cfg.getHandler(handlerDescriptor.getId());
if (handlerConfiguration == null) {
......@@ -194,6 +194,11 @@ public class ConnectionPageNetworkHandler extends ConnectionWizardPage implement
}
}
// Update settings from profile
if (activeProfile != null) {
}
// Update page controls
handlerConfiguration = cfg.getHandler(handlerDescriptor.getId());
if (handlerConfiguration == null) {
......
......@@ -33,7 +33,7 @@ public class DBWHandlerConfiguration {
@NotNull
private final DBWHandlerDescriptor descriptor;
private final DBPDriver driver;
private DBPDriver driver;
private boolean enabled;
private String userName;
private String password;
......@@ -73,6 +73,10 @@ public class DBWHandlerConfiguration {
return driver;
}
public void setDriver(DBPDriver driver) {
this.driver = driver;
}
public DBWHandlerType getType() {
return descriptor.getType();
}
......
......@@ -44,10 +44,7 @@ import org.jkiss.dbeaver.model.exec.DBCTransactionManager;
import org.jkiss.dbeaver.model.exec.DBExecUtils;
import org.jkiss.dbeaver.model.impl.data.DefaultValueHandler;
import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.net.DBWHandlerConfiguration;
import org.jkiss.dbeaver.model.net.DBWHandlerType;
import org.jkiss.dbeaver.model.net.DBWNetworkHandler;
import org.jkiss.dbeaver.model.net.DBWTunnel;
import org.jkiss.dbeaver.model.net.*;
import org.jkiss.dbeaver.model.preferences.DBPPropertySource;
import org.jkiss.dbeaver.model.runtime.AbstractJob;
import org.jkiss.dbeaver.model.runtime.DBRProcessDescriptor;
......@@ -714,6 +711,10 @@ public class DataSourceDescriptor
DBWHandlerConfiguration tunnelConfiguration = null, proxyConfiguration = null;
for (DBWHandlerConfiguration handler : connectionInfo.getHandlers()) {
if (handler.isEnabled()) {
// Set driver explicitly.
// Handler config may have null driver if it was copied from profile config.
handler.setDriver(getDriver());
if (handler.getType() == DBWHandlerType.TUNNEL) {
tunnelConfiguration = handler;
} else if (handler.getType() == DBWHandlerType.PROXY) {
......@@ -784,7 +785,15 @@ public class DataSourceDescriptor
this.resolvedConnectionInfo.resolveDynamicVariables();
}
if (!CommonUtils.isEmpty(connectionInfo.getConfigProfileName())) {
// Update config from profile
DBWNetworkProfile profile = registry.getNetworkProfile(connectionInfo.getConfigProfileName());
if (profile != null) {
for (DBWHandlerConfiguration handlerCfg : profile.getConfigurations()) {
if (handlerCfg.isEnabled()) {
resolvedConnectionInfo.updateHandler(handlerCfg);
}
}
}
}
if (!CommonUtils.isEmpty(connectionInfo.getUserProfileName())) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册