Search in sources :

Example 1 with YesButton

use of org.eclipse.reddeer.swt.impl.button.YesButton in project jbosstools-hibernate by jbosstools.

the class HQLEditor method runHQLQuery.

/**
 * Executes HQL query
 */
public void runHQLQuery() {
    new DefaultToolItem("Run HQL").click();
    try {
        Shell s = new DefaultShell("Open Session factory");
        new YesButton(s).click();
        new WaitWhile(new ShellIsAvailable(s));
    } catch (WaitTimeoutExpiredException e) {
        log.warn("Open Session factory question dialog was expected");
    }
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) Shell(org.eclipse.reddeer.swt.api.Shell) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) DefaultToolItem(org.eclipse.reddeer.swt.impl.toolbar.DefaultToolItem) YesButton(org.eclipse.reddeer.swt.impl.button.YesButton)

Example 2 with YesButton

use of org.eclipse.reddeer.swt.impl.button.YesButton in project jbosstools-hibernate by jbosstools.

the class ConnectionProfileFactory method createConnectionProfile.

/**
 * Creates Connection profile based on DatabaseRequirement configuration
 * @param conf given database requirement configuration
 */
public static void createConnectionProfile(DatabaseConfiguration cfg) {
    DataSourceExplorerView dse = new DataSourceExplorerView();
    dse.open();
    // TODO implement this in explorer
    // TODO fix explorer name
    DefaultTreeItem item = new DefaultTreeItem("Database Connections");
    item.expand(TimePeriod.DEFAULT);
    List<TreeItem> items = item.getItems();
    for (TreeItem i : items) {
        i.select();
        new ContextMenuItem("Delete").select();
        Shell delete = new DefaultShell("Delete confirmation");
        new YesButton(delete).click();
        new WaitWhile(new ShellIsAvailable(delete));
    }
    DatabaseProfile dbProfile = new DatabaseProfile();
    dbProfile.setDatabase(cfg.getProfileName());
    dbProfile.setDriverDefinition(DriverDefinitionFactory.getDriverDefinition(cfg));
    dbProfile.setHostname(cfg.getJdbcString());
    dbProfile.setName(cfg.getProfileName());
    dbProfile.setPassword(cfg.getPassword());
    dbProfile.setUsername(cfg.getUsername());
    dbProfile.setVendor(cfg.getDriverVendor());
    // Driver Definition creation
    NewCPWizard cpw = new NewCPWizard();
    cpw.open();
    cpw.createDatabaseProfile(dbProfile);
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) Shell(org.eclipse.reddeer.swt.api.Shell) DatabaseProfile(org.eclipse.reddeer.eclipse.datatools.ui.DatabaseProfile) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) DataSourceExplorerView(org.eclipse.reddeer.eclipse.datatools.connectivity.ui.dse.views.DataSourceExplorerView) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) NewCPWizard(org.eclipse.reddeer.eclipse.datatools.connectivity.ui.wizards.NewCPWizard) YesButton(org.eclipse.reddeer.swt.impl.button.YesButton)

Example 3 with YesButton

use of org.eclipse.reddeer.swt.impl.button.YesButton in project jbosstools-hibernate by jbosstools.

the class ConnectionProfileFactory method deleteConnectionProfile.

/**
 * Deletes connection profile
 * @param profileName profile name to delete
 */
@SuppressWarnings("unchecked")
public static void deleteConnectionProfile(String profileName) {
    DataSourceExplorerView explorer = new DataSourceExplorerView();
    explorer.open();
    new DefaultTreeItem(new TreeItemRegexMatcher("Database Connections"), new TreeItemRegexMatcher(profileName + ".*")).select();
    new ContextMenuItem("Delete").select();
    Shell delete = new DefaultShell("Delete confirmation");
    new YesButton(delete).click();
    new WaitWhile(new ShellIsAvailable(delete));
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) TreeItemRegexMatcher(org.eclipse.reddeer.core.matcher.TreeItemRegexMatcher) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) Shell(org.eclipse.reddeer.swt.api.Shell) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) DataSourceExplorerView(org.eclipse.reddeer.eclipse.datatools.connectivity.ui.dse.views.DataSourceExplorerView) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) YesButton(org.eclipse.reddeer.swt.impl.button.YesButton)

Example 4 with YesButton

use of org.eclipse.reddeer.swt.impl.button.YesButton in project jbosstools-hibernate by jbosstools.

the class ConnectionProfileFactory method deleteAllConnectionProfiles.

/**
 * Method deletes all connection profiles via Data Source Explorer
 */
public static void deleteAllConnectionProfiles() {
    DataSourceExplorerView dse = new DataSourceExplorerView();
    dse.open();
    List<TreeItem> items = new DefaultTreeItem("Database Connections").getItems();
    for (TreeItem i : items) {
        i.select();
        new ContextMenuItem("Delete").select();
        ;
        Shell delete = new DefaultShell("Delete confirmation");
        new YesButton(delete).click();
        new WaitWhile(new ShellIsAvailable(delete));
    }
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) Shell(org.eclipse.reddeer.swt.api.Shell) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) DataSourceExplorerView(org.eclipse.reddeer.eclipse.datatools.connectivity.ui.dse.views.DataSourceExplorerView) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) YesButton(org.eclipse.reddeer.swt.impl.button.YesButton)

Example 5 with YesButton

use of org.eclipse.reddeer.swt.impl.button.YesButton 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

YesButton (org.eclipse.reddeer.swt.impl.button.YesButton)16 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)16 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)14 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)14 Shell (org.eclipse.reddeer.swt.api.Shell)7 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)7 DefaultTable (org.eclipse.reddeer.swt.impl.table.DefaultTable)6 DataSourceExplorerView (org.eclipse.reddeer.eclipse.datatools.connectivity.ui.dse.views.DataSourceExplorerView)3 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)3 DefaultToolItem (org.eclipse.reddeer.swt.impl.toolbar.DefaultToolItem)3 DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)3 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)3 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)2 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)2 WidgetIsFound (org.eclipse.reddeer.core.condition.WidgetIsFound)2 TableItem (org.eclipse.reddeer.swt.api.TableItem)2 TreeItem (org.eclipse.reddeer.swt.api.TreeItem)2 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)2 Test (org.junit.Test)2 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)1