Search in sources :

Example 1 with DriverFileSource

use of org.jkiss.dbeaver.registry.driver.DriverFileSource in project dbeaver by serge-rider.

the class DriverDownloadManualPage method createControl.

@Override
public void createControl(Composite parent) {
    final DriverDescriptor driver = getWizard().getDriver();
    setMessage("Download & configure " + driver.getFullName() + " driver files");
    Composite composite = UIUtils.createPlaceholder(parent, 1);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    Link infoText = new Link(composite, SWT.NONE);
    infoText.setText(driver.getFullName() + " driver files missing.\n\n" + "According to vendor policy this driver isn't publicly available\nand you have to download it manually from vendor's web site.\n\n" + "After successful driver download you will need to <a>add JAR files</a> in DBeaver libraries list.");
    infoText.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            getWizard().getContainer().buttonPressed(DriverDownloadDialog.EDIT_DRIVER_BUTTON_ID);
        }
    });
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    infoText.setLayoutData(gd);
    Group filesGroup = UIUtils.createControlGroup(composite, "Driver files", 1, -1, -1);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.verticalIndent = 10;
    filesGroup.setLayoutData(gd);
    final Combo sourceCombo = new Combo(filesGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
    for (DriverFileSource source : driver.getDriverFileSources()) {
        sourceCombo.add(source.getName());
    }
    final Link driverLink = new Link(filesGroup, SWT.NONE);
    driverLink.setText("<a>" + driver.getDriverFileSources().get(0).getUrl() + "</a>");
    driverLink.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    driverLink.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            WebUtils.openWebBrowser(driver.getDriverFileSources().get(sourceCombo.getSelectionIndex()).getUrl());
        }
    });
    filesTable = new Table(filesGroup, SWT.BORDER | SWT.FULL_SELECTION);
    filesTable.setHeaderVisible(true);
    filesTable.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    UIUtils.createTableColumn(filesTable, SWT.LEFT, "File");
    UIUtils.createTableColumn(filesTable, SWT.LEFT, "Required");
    UIUtils.createTableColumn(filesTable, SWT.LEFT, "Description");
    sourceCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            selectFileSource(driver.getDriverFileSources().get(sourceCombo.getSelectionIndex()));
            driverLink.setText("<a>" + driver.getDriverFileSources().get(sourceCombo.getSelectionIndex()).getUrl() + "</a>");
        }
    });
    sourceCombo.select(0);
    selectFileSource(driver.getDriverFileSources().get(0));
    UIUtils.packColumns(filesTable, true);
    createLinksPanel(composite);
    composite.setTabList(ArrayUtils.remove(Control.class, composite.getTabList(), infoText));
    setControl(composite);
}
Also used : DriverFileSource(org.jkiss.dbeaver.registry.driver.DriverFileSource) DriverDescriptor(org.jkiss.dbeaver.registry.driver.DriverDescriptor) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) 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 DriverDescriptor (org.jkiss.dbeaver.registry.driver.DriverDescriptor)1 DriverFileSource (org.jkiss.dbeaver.registry.driver.DriverFileSource)1