use of org.eclipse.reddeer.eclipse.datatools.connectivity.ui.preferences.DriverPreferences 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();
}
Aggregations