use of org.jkiss.dbeaver.registry.network.NetworkHandlerRegistry in project dbeaver by serge-rider.
the class ConnectionPageNetwork method activatePage.
@Override
public void activatePage() {
DataSourceDescriptor dataSource = wizard.getPageSettings().getActiveDataSource();
DriverDescriptor 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();
for (TabItem item : handlersFolder.getItems()) {
((Composite) item.getControl()).layout();
}
}
TabItem selectItem = null;
for (NetworkHandlerDescriptor descriptor : registry.getDescriptors(dataSource)) {
DBWHandlerConfiguration configuration = dataSource.getConnectionConfiguration().getHandler(descriptor.getId());
if (configuration == null) {
configuration = new DBWHandlerConfiguration(descriptor, driver);
}
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);
}
}
Aggregations