use of org.jkiss.dbeaver.model.net.DBWHandlerConfiguration in project dbeaver by serge-rider.
the class ConnectionPageNetworkHandler method updateProfileList.
private void updateProfileList() {
DBPConnectionConfiguration cfg = site.getActiveDataSource().getConnectionConfiguration();
String profileId = cfg.getConfigProfileName();
activeProfile = CommonUtils.isEmpty(profileId) ? null : site.getProject().getDataSourceRegistry().getNetworkProfile(profileId);
// Refresh profile list
profileCombo.removeAll();
profileCombo.add("");
for (DBWNetworkProfile profile : site.getProject().getDataSourceRegistry().getNetworkProfiles()) {
profileCombo.add(profile.getProfileName());
if (CommonUtils.equalObjects(profileId, profile.getProfileName())) {
profileCombo.select(profileCombo.getItemCount() - 1);
}
}
// Update settings from profile
if (activeProfile != null) {
}
// Update page controls
handlerConfiguration = cfg.getHandler(handlerDescriptor.getId());
if (handlerConfiguration == null) {
handlerConfiguration = new DBWHandlerConfiguration(handlerDescriptor, site.getActiveDataSource());
}
useHandlerCheck.setSelection(handlerConfiguration.isEnabled());
configurator.loadSettings(handlerConfiguration);
enableHandlerContent();
}
use of org.jkiss.dbeaver.model.net.DBWHandlerConfiguration in project dbeaver by serge-rider.
the class ConnectionPageNetwork method saveSettings.
@Override
public void saveSettings(DBPDataSourceContainer dataSource) {
boolean foundHandlers = false;
java.util.List<DBWHandlerConfiguration> handlers = new ArrayList<>();
for (HandlerBlock handlerBlock : configurations.values()) {
DBWHandlerConfiguration configuration = handlerBlock.loadedConfigs.get(dataSource.getId());
if (configuration != null) {
foundHandlers = true;
handlerBlock.configurator.saveSettings(configuration);
handlers.add(configuration);
}
}
if (foundHandlers) {
dataSource.getConnectionConfiguration().setHandlers(handlers);
}
}
use of org.jkiss.dbeaver.model.net.DBWHandlerConfiguration in project dbeaver by serge-rider.
the class ConnectionPageNetwork method activatePage.
@Override
public void activatePage() {
DataSourceDescriptor dataSource = wizard.getPageSettings().getActiveDataSource();
DBPDriver driver = wizard.getSelectedDriver();
NetworkHandlerRegistry registry = NetworkHandlerRegistry.getInstance();
if (prevDataSource == null || prevDataSource != dataSource) {
for (TabItem item : handlersFolder.getItems()) {
item.dispose();
}
for (NetworkHandlerDescriptor descriptor : registry.getDescriptors(dataSource)) {
try {
createHandlerTab(descriptor);
} catch (DBException e) {
log.warn(e);
}
}
prevDataSource = dataSource;
handlersFolder.layout(true, true);
// for (TabItem item : handlersFolder.getItems()) {
// ((Composite)item.getControl()).layout(false);
// }
}
TabItem selectItem = null;
for (NetworkHandlerDescriptor descriptor : registry.getDescriptors(dataSource)) {
DBWHandlerConfiguration configuration = dataSource.getConnectionConfiguration().getHandler(descriptor.getId());
if (configuration == null) {
configuration = new DBWHandlerConfiguration(descriptor, dataSource);
}
HandlerBlock handlerBlock = configurations.get(descriptor);
if (handlerBlock == null) {
continue;
}
// handlerBlock.useHandlerCheck.setSelection(configuration.isEnabled());
if (selectItem == null && configuration.isEnabled()) {
selectItem = handlerBlock.tabItem;
}
if (!handlerBlock.loadedConfigs.containsKey(dataSource.getId())) {
handlerBlock.configurator.loadSettings(configuration);
handlerBlock.loadedConfigs.put(dataSource.getId(), configuration);
}
enableHandlerContent(descriptor);
}
if (selectItem != null) {
handlersFolder.setSelection(selectItem);
} else {
handlersFolder.setSelection(0);
}
}
use of org.jkiss.dbeaver.model.net.DBWHandlerConfiguration in project dbeaver by dbeaver.
the class ConnectionPageNetworkHandler method updateProfileList.
private void updateProfileList() {
DBPConnectionConfiguration cfg = site.getActiveDataSource().getConnectionConfiguration();
String profileId = cfg.getConfigProfileName();
activeProfile = CommonUtils.isEmpty(profileId) ? null : site.getProject().getDataSourceRegistry().getNetworkProfile(profileId);
// Refresh profile list
profileCombo.removeAll();
profileCombo.add("");
for (DBWNetworkProfile profile : site.getProject().getDataSourceRegistry().getNetworkProfiles()) {
profileCombo.add(profile.getProfileName());
if (CommonUtils.equalObjects(profileId, profile.getProfileName())) {
profileCombo.select(profileCombo.getItemCount() - 1);
}
}
// Update settings from profile
if (activeProfile != null) {
}
// Update page controls
handlerConfiguration = cfg.getHandler(handlerDescriptor.getId());
if (handlerConfiguration == null) {
handlerConfiguration = new DBWHandlerConfiguration(handlerDescriptor, site.getActiveDataSource());
}
useHandlerCheck.setSelection(handlerConfiguration.isEnabled());
configurator.loadSettings(handlerConfiguration);
enableHandlerContent();
}
use of org.jkiss.dbeaver.model.net.DBWHandlerConfiguration in project dbeaver by dbeaver.
the class ConnectionPageNetworkHandler method setConnectionConfigProfile.
private void setConnectionConfigProfile(String profileName) {
activeProfile = CommonUtils.isEmpty(profileName) ? null : site.getProject().getDataSourceRegistry().getNetworkProfile(profileName);
DBPDataSourceContainer dataSource = site.getActiveDataSource();
DBPConnectionConfiguration cfg = dataSource.getConnectionConfiguration();
String oldProfileId = cfg.getConfigProfileName();
saveSettings(site.getActiveDataSource());
if (activeProfile != null) {
cfg.setConfigProfile(activeProfile);
handlerConfiguration = cfg.getHandler(handlerDescriptor.getId());
if (handlerConfiguration == null) {
handlerConfiguration = new DBWHandlerConfiguration(handlerDescriptor, dataSource);
}
} else {
cfg.setConfigProfile(null);
}
site.firePropertyChange(this, PROP_CONFIG_PROFILE, oldProfileId, activeProfile == null ? null : activeProfile.getProfileName());
}
Aggregations