Search in sources :

Example 1 with DriverDefinition

use of org.eclipse.reddeer.eclipse.datatools.ui.DriverDefinition in project jbosstools-hibernate by jbosstools.

the class DriverDefinitionFactory method getDriverDefinition.

/**
 * Returns Driver Definition instance based on configuration
 * @param cfg given configuration
 * @return driver definition
 */
public static DriverDefinition getDriverDefinition(DatabaseConfiguration cfg) {
    // Driver definition
    DriverDefinition dd = new DriverDefinition();
    dd.setDriverClass(cfg.getDriverClass());
    dd.setDriverLibrary(cfg.getDriverPath());
    dd.setDriverName(cfg.getDriverName());
    dd.setDriverTemplate(getDriverTemplate(cfg));
    return dd;
}
Also used : DriverDefinition(org.eclipse.reddeer.eclipse.datatools.ui.DriverDefinition)

Example 2 with DriverDefinition

use of org.eclipse.reddeer.eclipse.datatools.ui.DriverDefinition in project jbosstools-hibernate by jbosstools.

the class DriverDefinitionFactory method createDatabaseDriverDefinition.

/**
 * Creates Driver definition based on DatabaseRequirement configuration
 * @param conf given database requirement configuration
 */
public static void createDatabaseDriverDefinition(DatabaseConfiguration cfg) {
    DriverTemplate dt = getDriverTemplate(cfg);
    DriverDefinition dd = getDriverDefinition(cfg);
    // Driver Definition creation
    WorkbenchPreferenceDialog preferenceDialog = new WorkbenchPreferenceDialog();
    preferenceDialog.open();
    DriverPreferences preferencePage = new DriverPreferences(preferenceDialog);
    preferenceDialog.select(preferencePage);
    // TODO implement this in preference page
    // TODO dont create new driver def if it already exists
    List<TableItem> items = new DefaultTable().getItems();
    for (int i = 0; i < items.size(); i++) {
        new DefaultTableItem(0).select();
        new PushButton("Remove").click();
        Shell confirm = new DefaultShell("Confirm Driver Removal");
        new YesButton().click();
        new WaitWhile(new ShellIsAvailable(confirm));
        new DefaultShell("Preferences");
    }
    DriverDialog ddw = preferencePage.addDriverDefinition();
    ddw.selectDriverTemplate(dt.getType(), dt.getVersion());
    ddw.setName(cfg.getDriverName());
    ddw.addDriverLibrary(dd.getDriverLibrary());
    ddw.setDriverClass(cfg.getDriverClass());
    ddw.ok();
    preferenceDialog.ok();
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) DriverDefinition(org.eclipse.reddeer.eclipse.datatools.ui.DriverDefinition) DefaultTableItem(org.eclipse.reddeer.swt.impl.table.DefaultTableItem) TableItem(org.eclipse.reddeer.swt.api.TableItem) DefaultTable(org.eclipse.reddeer.swt.impl.table.DefaultTable) DefaultTableItem(org.eclipse.reddeer.swt.impl.table.DefaultTableItem) YesButton(org.eclipse.reddeer.swt.impl.button.YesButton) DriverPreferences(org.eclipse.reddeer.eclipse.datatools.connectivity.ui.preferences.DriverPreferences) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) Shell(org.eclipse.reddeer.swt.api.Shell) DriverTemplate(org.eclipse.reddeer.eclipse.datatools.ui.DriverTemplate) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) WorkbenchPreferenceDialog(org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) DriverDialog(org.eclipse.reddeer.eclipse.datatools.connectivity.ui.dialogs.DriverDialog)

Aggregations

DriverDefinition (org.eclipse.reddeer.eclipse.datatools.ui.DriverDefinition)2 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)1 DriverDialog (org.eclipse.reddeer.eclipse.datatools.connectivity.ui.dialogs.DriverDialog)1 DriverPreferences (org.eclipse.reddeer.eclipse.datatools.connectivity.ui.preferences.DriverPreferences)1 DriverTemplate (org.eclipse.reddeer.eclipse.datatools.ui.DriverTemplate)1 Shell (org.eclipse.reddeer.swt.api.Shell)1 TableItem (org.eclipse.reddeer.swt.api.TableItem)1 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)1 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)1 YesButton (org.eclipse.reddeer.swt.impl.button.YesButton)1 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)1 DefaultTable (org.eclipse.reddeer.swt.impl.table.DefaultTable)1 DefaultTableItem (org.eclipse.reddeer.swt.impl.table.DefaultTableItem)1 WorkbenchPreferenceDialog (org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog)1