Search in sources :

Example 26 with DriverDescriptor

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;
}
Also used : DriverDescriptor(org.jkiss.dbeaver.registry.driver.DriverDescriptor) DataSourceDescriptor(org.jkiss.dbeaver.registry.DataSourceDescriptor)

Example 27 with DriverDescriptor

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;
}
Also used : DriverDescriptor(org.jkiss.dbeaver.registry.driver.DriverDescriptor) DBPDataSourceRegistry(org.jkiss.dbeaver.model.app.DBPDataSourceRegistry) DataSourceDescriptor(org.jkiss.dbeaver.registry.DataSourceDescriptor)

Example 28 with DriverDescriptor

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);
}
Also used : DriverDescriptor(org.jkiss.dbeaver.registry.driver.DriverDescriptor) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) RunnableContextDelegate(org.jkiss.dbeaver.runtime.RunnableContextDelegate) DBPDriverLibrary(org.jkiss.dbeaver.model.connection.DBPDriverLibrary) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 29 with DriverDescriptor

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));
}
Also used : DriverDescriptor(org.jkiss.dbeaver.registry.driver.DriverDescriptor) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Link(org.eclipse.swt.widgets.Link)

Example 30 with DriverDescriptor

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();
}
Also used : DriverDescriptor(org.jkiss.dbeaver.registry.driver.DriverDescriptor)

Aggregations

DriverDescriptor (org.jkiss.dbeaver.registry.driver.DriverDescriptor)37 DataSourceDescriptor (org.jkiss.dbeaver.registry.DataSourceDescriptor)11 DataSourceProviderDescriptor (org.jkiss.dbeaver.registry.DataSourceProviderDescriptor)9 DBException (org.jkiss.dbeaver.DBException)7 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)5 SelectionEvent (org.eclipse.swt.events.SelectionEvent)5 GridData (org.eclipse.swt.layout.GridData)5 DBPConnectionConfiguration (org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration)5 ArrayList (java.util.ArrayList)4 DBPDataSourceRegistry (org.jkiss.dbeaver.model.app.DBPDataSourceRegistry)4 DBPDriver (org.jkiss.dbeaver.model.connection.DBPDriver)4 ZipEntry (java.util.zip.ZipEntry)3 NotNull (org.jkiss.code.NotNull)3 DBPDriverLibrary (org.jkiss.dbeaver.model.connection.DBPDriverLibrary)3 DBWHandlerConfiguration (org.jkiss.dbeaver.model.net.DBWHandlerConfiguration)3 TypeToken (com.google.gson.reflect.TypeToken)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 ZipFile (java.util.zip.ZipFile)2 Composite (org.eclipse.swt.widgets.Composite)2