Search in sources :

Example 1 with RunnableContextDelegate

use of org.jkiss.dbeaver.runtime.RunnableContextDelegate in project dbeaver by serge-rider.

the class DriverDownloadAutoPage method createControl.

@Override
public void createControl(Composite parent) {
    final DriverDownloadWizard wizard = getWizard();
    final DriverDescriptor driver = wizard.getDriver();
    setMessage("Download " + driver.getFullName() + " driver files");
    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(driver.getFullName() + " driver files are missing.\nDBeaver can download these files automatically.\n\n");
        infoText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        final Button forceCheckbox = UIUtils.createCheckbox(infoGroup, "Force download / overwrite", wizard.isForceDownload());
        forceCheckbox.setToolTipText("Force files download. Will download files even if they are already on the disk");
        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, "Files required by driver", 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("You can change driver version by clicking on version column.\nThen you can choose one of the available versions.");
    }
    if (!wizard.isForceDownload()) {
        Label infoText = new Label(composite, SWT.NONE);
        infoText.setText("\nOr you can obtain driver files by yourself and add them in driver editor.");
        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)

Aggregations

SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 GridData (org.eclipse.swt.layout.GridData)1 DBPDriverLibrary (org.jkiss.dbeaver.model.connection.DBPDriverLibrary)1 DriverDescriptor (org.jkiss.dbeaver.registry.driver.DriverDescriptor)1 RunnableContextDelegate (org.jkiss.dbeaver.runtime.RunnableContextDelegate)1