use of org.jkiss.dbeaver.registry.driver.DriverDescriptor in project dbeaver by dbeaver.
the class MigrateConnectionWizard method performFinish.
@Override
public boolean performFinish() {
final List<DataSourceDescriptor> connections = pageConnections.getSelectedConnections();
final DriverDescriptor targetDriver = pageDriver.selectedDriver;
for (DataSourceDescriptor conn : connections) {
conn.setDriver(targetDriver);
conn.getRegistry().updateDataSource(conn);
}
return true;
}
use of org.jkiss.dbeaver.registry.driver.DriverDescriptor in project dbeaver by dbeaver.
the class NewConnectionWizard method performFinish.
/**
* This method is called when 'Finish' button is pressed in
* the wizard. We will create an operation and run it
* using wizard as execution context.
*/
@Override
public boolean performFinish() {
DriverDescriptor driver = getSelectedDriver();
ConnectionPageSettings pageSettings = getPageSettings();
DataSourceDescriptor dataSourceTpl = pageSettings == null ? getActiveDataSource() : pageSettings.getActiveDataSource();
DBPDataSourceRegistry dataSourceRegistry = getDataSourceRegistry();
DataSourceDescriptor dataSourceNew = new DataSourceDescriptor(dataSourceRegistry, dataSourceTpl.getId(), driver, dataSourceTpl.getConnectionConfiguration());
dataSourceNew.copyFrom(dataSourceTpl);
saveSettings(dataSourceNew);
dataSourceRegistry.addDataSource(dataSourceNew);
return true;
}
use of org.jkiss.dbeaver.registry.driver.DriverDescriptor in project dbeaver by dbeaver.
the class DriverDownloadAutoPage method createControl.
@Override
public void createControl(Composite parent) {
final DriverDownloadWizard wizard = getWizard();
final DriverDescriptor driver = wizard.getDriver();
setMessage(NLS.bind(CoreMessages.dialog_driver_download_auto_page_download_specific_driver_files, driver.getFullName()));
initializeDialogUnits(parent);
Composite composite = UIUtils.createPlaceholder(parent, 1);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
if (!wizard.isForceDownload()) {
Composite infoGroup = UIUtils.createPlaceholder(composite, 2, 5);
infoGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label infoText = new Label(infoGroup, SWT.NONE);
infoText.setText(NLS.bind(CoreMessages.dialog_driver_download_auto_page_driver_file_missing_text, driver.getFullName()));
infoText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
final Button forceCheckbox = UIUtils.createCheckbox(infoGroup, CoreMessages.dialog_driver_download_auto_page_force_download, wizard.isForceDownload());
forceCheckbox.setToolTipText(CoreMessages.dialog_driver_download_auto_page_force_download_tooltip);
forceCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_BEGINNING));
forceCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
wizard.setForceDownload(forceCheckbox.getSelection());
}
});
}
{
Group filesGroup = UIUtils.createControlGroup(composite, CoreMessages.dialog_driver_download_auto_page_required_files, 1, -1, -1);
filesGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
depsTree = new DriverDependenciesTree(filesGroup, new RunnableContextDelegate(getContainer()), getWizard().getDependencies(), driver, driver.getDriverLibraries(), true) {
protected void setLibraryVersion(final DBPDriverLibrary library, final String version) {
String curVersion = library.getVersion();
if (CommonUtils.equalObjects(curVersion, version)) {
return;
}
library.setPreferredVersion(version);
resolveLibraries();
}
};
new Label(filesGroup, SWT.NONE).setText(CoreMessages.dialog_driver_download_auto_page_change_driver_version_text);
}
if (!wizard.isForceDownload()) {
Label infoText = new Label(composite, SWT.NONE);
infoText.setText(CoreMessages.dialog_driver_download_auto_page_obtain_driver_files_text);
infoText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
createLinksPanel(composite);
setControl(composite);
}
use of org.jkiss.dbeaver.registry.driver.DriverDescriptor in project dbeaver by dbeaver.
the class DriverDownloadPage method createLinksPanel.
protected void createLinksPanel(Composite composite) {
final DriverDescriptor driver = getWizard().getDriver();
// UIUtils.createPlaceholder(composite, 1).setLayoutData(new GridData(GridData.FILL_BOTH));
Composite linksGroup = UIUtils.createPlaceholder(composite, 2);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.verticalIndent = 10;
linksGroup.setLayoutData(gd);
// Vendor site
if (!CommonUtils.isEmpty(driver.getWebURL())) {
Link link = UIUtils.createLink(linksGroup, CoreMessages.dialog_driver_download_page_vendor_link, new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
WebUtils.openWebBrowser(driver.getWebURL());
}
});
link.setToolTipText(driver.getWebURL());
link.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_BEGINNING));
} else {
UIUtils.createPlaceholder(linksGroup, 1).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
Link link = UIUtils.createLink(linksGroup, CoreMessages.dialog_driver_download_page_download_conf_link, new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
UIUtils.showPreferencesFor(null, null, PrefPageDrivers.PAGE_ID, PrefPageDriversMaven.PAGE_ID);
}
});
link.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_END));
}
use of org.jkiss.dbeaver.registry.driver.DriverDescriptor in project dbeaver by dbeaver.
the class DriverEditDialog method okPressed.
@Override
protected void okPressed() {
// Set props
driver.setName(driverNameText.getText());
driver.setCategory(driverCategoryCombo.getText());
driver.setDescription(CommonUtils.notEmpty(driverDescText.getText()));
driver.setDriverClassName(driverClassText.getText());
driver.setSampleURL(driverURLText.getText());
driver.setDriverDefaultPort(driverPortText.getText());
driver.setEmbedded(embeddedDriverCheck.getSelection());
// driver.setAnonymousAccess(anonymousCheck.getSelection());
driver.setModified(true);
driver.setDriverParameters(driverPropertySource.getProperties());
driver.setConnectionProperties(connectionPropertySource.getProperties());
// Store client homes
if (clientHomesPanel != null) {
driver.setClientHomeIds(clientHomesPanel.getHomeIds());
}
DriverDescriptor oldDriver = provider.getDriverByName(driver.getCategory(), driver.getName());
if (oldDriver != null && oldDriver != driver) {
UIUtils.showMessageBox(getShell(), "Driver create", "Driver '" + driver.getName() + "' already exists. Change driver name", SWT.ICON_ERROR);
return;
}
// Finish
if (provider.getDriver(driver.getId()) == null) {
provider.addDriver(driver);
}
provider.getRegistry().saveDrivers();
super.okPressed();
}
Aggregations