Search in sources :

Example 16 with ManagedDriver

use of net.sourceforge.sqlexplorer.dbproduct.ManagedDriver in project tdq-studio-se by Talend.

the class CreateAliasDlg method populateCombo.

private void populateCombo() {
    String previous = cboDriver.getText();
    if (previous != null) {
        previous = previous.trim();
        if (previous.length() == 0)
            previous = null;
    }
    if (previous != null)
        previous = previous.toLowerCase();
    DriverManager driverModel = SQLExplorerPlugin.getDefault().getDriverModel();
    cboDriver.removeAll();
    TreeSet<ManagedDriver> drivers = new TreeSet<ManagedDriver>();
    drivers.addAll(driverModel.getDrivers());
    int index = 0;
    for (ManagedDriver driver : drivers) {
        try {
            driver.registerSQLDriver();
        } catch (ClassNotFoundException e) {
        // Nothing
        }
        if (driver.isDriverClassLoaded() == true) {
            cboDriver.add(driver.getName());
            comboDriverIndexes.put(new Integer(index), driver);
            if (previous != null && driver.getName().toLowerCase().startsWith(previous))
                cboDriver.select(index);
            index++;
        }
    }
}
Also used : ManagedDriver(net.sourceforge.sqlexplorer.dbproduct.ManagedDriver) TreeSet(java.util.TreeSet) DriverManager(net.sourceforge.sqlexplorer.dbproduct.DriverManager)

Aggregations

ManagedDriver (net.sourceforge.sqlexplorer.dbproduct.ManagedDriver)16 DriverManager (net.sourceforge.sqlexplorer.dbproduct.DriverManager)8 User (net.sourceforge.sqlexplorer.dbproduct.User)3 SQLExplorerPlugin (net.sourceforge.sqlexplorer.plugin.SQLExplorerPlugin)3 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)3 File (java.io.File)2 MalformedURLException (java.net.MalformedURLException)2 ArrayList (java.util.ArrayList)2 ExplorerException (net.sourceforge.sqlexplorer.ExplorerException)2 CreateDriverDlg (net.sourceforge.sqlexplorer.dialogs.CreateDriverDlg)2 AliasAndManaDriverHelper (net.sourceforge.sqlexplorer.util.AliasAndManaDriverHelper)2 MyURLClassLoader (net.sourceforge.sqlexplorer.util.MyURLClassLoader)2 IFile (org.eclipse.core.resources.IFile)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 Font (org.eclipse.swt.graphics.Font)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Button (org.eclipse.swt.widgets.Button)2 Composite (org.eclipse.swt.widgets.Composite)2