Search in sources :

Example 11 with DefaultShell

use of org.eclipse.reddeer.swt.impl.shell.DefaultShell 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)

Example 12 with DefaultShell

use of org.eclipse.reddeer.swt.impl.shell.DefaultShell in project jbosstools-hibernate by jbosstools.

the class ProjectConfigurationFactory method addFurtherJPAConfiguration.

private static void addFurtherJPAConfiguration(String jpaVersion, boolean addedJavaFacet) {
    DefaultHyperlink hyperlink = new DefaultHyperlink();
    hyperlink.activate();
    Shell s = new DefaultShell("Modify Faceted Project");
    if (addedJavaFacet) {
        new NextButton().click();
    }
    DefaultGroup group = new DefaultGroup("Platform");
    new DefaultCombo(group).setSelection("Hibernate (JPA " + jpaVersion + ")");
    new LabeledCombo("Type:").setSelection("Disable Library Configuration");
    new OkButton().click();
    new WaitWhile(new ShellIsAvailable(s));
}
Also used : OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) DefaultCombo(org.eclipse.reddeer.swt.impl.combo.DefaultCombo) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) WorkbenchShell(org.eclipse.reddeer.workbench.impl.shell.WorkbenchShell) Shell(org.eclipse.reddeer.swt.api.Shell) NextButton(org.eclipse.reddeer.swt.impl.button.NextButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) LabeledCombo(org.eclipse.reddeer.swt.impl.combo.LabeledCombo) DefaultHyperlink(org.eclipse.reddeer.uiforms.impl.hyperlink.DefaultHyperlink) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) DefaultGroup(org.eclipse.reddeer.swt.impl.group.DefaultGroup)

Example 13 with DefaultShell

use of org.eclipse.reddeer.swt.impl.shell.DefaultShell in project jbosstools-hibernate by jbosstools.

the class ProjectConfigurationFactory method setProjectFacetForDB.

/**
 * Sets JPA project facets for given database configuration
 * @param prj given project
 * @param cfg given database configuration
 * @param jpaVersion JPA version (2.0 or 2.1 is supported)
 */
public static void setProjectFacetForDB(String prj, DatabaseConfiguration cfg, String jpaVersion) {
    ProjectExplorer pe = new ProjectExplorer();
    pe.open();
    PropertyDialog pd = pe.getProject(prj).openProperties();
    boolean javaFacet = false;
    FacetsPropertyPage pp = new FacetsPropertyPage(pd);
    pd.select(pp);
    for (TreeItem t : getFacets(pd.getShell())) {
        if (t.getText().equals("Java")) {
            javaFacet = true;
            break;
        }
    }
    if (!javaFacet) {
        pp.selectFacet("Java");
        DefaultHyperlink hyperlink = new DefaultHyperlink();
        hyperlink.activate();
        Shell s = new DefaultShell("Modify Faceted Project");
        new OkButton().click();
        new WaitWhile(new ShellIsAvailable(s));
    }
    pp.selectFacet("JPA");
    pp.selectVersion("JPA", jpaVersion);
    addFurtherJPAConfiguration(jpaVersion, !javaFacet);
    closePreferences(pd);
    new WorkbenchShell().setFocus();
    pe.open();
    pe.selectProjects(prj);
    pd.open();
    // TODO Why this takes so long ?
    pd.select("JPA");
    JpaFacetInstallPage jpaPage = new JpaFacetInstallPage(pd);
    jpaPage.setConnectionProfile(cfg.getProfileName());
    jpaPage.setAutoDiscovery(true);
    closePreferences(pd);
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
    checkPersistenceXML(prj);
}
Also used : ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) DefaultHyperlink(org.eclipse.reddeer.uiforms.impl.hyperlink.DefaultHyperlink) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) WorkbenchShell(org.eclipse.reddeer.workbench.impl.shell.WorkbenchShell) Shell(org.eclipse.reddeer.swt.api.Shell) WorkbenchShell(org.eclipse.reddeer.workbench.impl.shell.WorkbenchShell) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) PropertyDialog(org.eclipse.reddeer.eclipse.ui.dialogs.PropertyDialog) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) FacetsPropertyPage(org.eclipse.reddeer.eclipse.wst.common.project.facet.ui.FacetsPropertyPage) JpaFacetInstallPage(org.jboss.tools.hibernate.reddeer.wizard.JpaFacetInstallPage)

Example 14 with DefaultShell

use of org.eclipse.reddeer.swt.impl.shell.DefaultShell in project jbosstools-hibernate by jbosstools.

the class CodeGenerationKeyWordsTest method createAndRunHibernateGenerationConfiguration.

private void createAndRunHibernateGenerationConfiguration(boolean reveng, String src) {
    if (reveng) {
        createRevengFile();
    }
    LaunchConfigurationsDialog dlg = new LaunchConfigurationsDialog();
    dlg.open();
    dlg.createNewConfiguration();
    dlg.selectConfiguration(prj);
    dlg.setOutputDir("/" + prj + "/" + src);
    dlg.setPackage("org.gen");
    dlg.setReverseFromJDBC(true);
    if (reveng)
        dlg.setRevengFile(prj, "hibernate.reveng.xml");
    new DefaultShell(LaunchConfigurationsDialog.DIALOG_TITLE).setFocus();
    dlg.selectExporter(0);
    dlg.selectExporter(1);
    dlg.apply();
    dlg.run();
}
Also used : DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) LaunchConfigurationsDialog(org.jboss.tools.hibernate.reddeer.dialog.LaunchConfigurationsDialog)

Example 15 with DefaultShell

use of org.eclipse.reddeer.swt.impl.shell.DefaultShell in project jbosstools-hibernate by jbosstools.

the class PersistenceXMLFileTest method prepare.

private void prepare() {
    importProject(prj, null);
    ProjectExplorer pe = new ProjectExplorer();
    pe.open();
    PropertyDialog pd = pe.getProject(prj).openProperties();
    FacetsPropertyPage fp = new FacetsPropertyPage(pd);
    pd.select(fp);
    List<TreeItem> facets = fp.getSelectedFacets();
    boolean javaFacet = false;
    boolean jpaFacet = false;
    for (TreeItem facet : facets) {
        if (facet.getText().equals("Java")) {
            javaFacet = true;
        } else if (facet.getText().equals("JPA")) {
            jpaFacet = true;
        }
    }
    if (!javaFacet) {
        fp.selectFacet("Java");
        new DefaultHyperlink(pd).activate();
        Shell s = new DefaultShell("Modify Faceted Project");
        new OkButton(s).click();
        new WaitWhile(new ShellIsAvailable(s));
    }
    if (!jpaFacet) {
        fp.selectFacet("JPA");
        new DefaultHyperlink(pd).activate();
        Shell s = new DefaultShell("Modify Faceted Project");
        new NextButton(s).click();
        JpaFacetInstallPage installPage = new JpaFacetInstallPage(s);
        installPage.setPlatform("Hibernate (JPA 2.1)");
        installPage.setJpaImplementation("Disable Library Configuration");
        new OkButton(s).click();
        new WaitWhile(new ShellIsAvailable(s));
    }
    pd.ok();
}
Also used : ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) NextButton(org.eclipse.reddeer.swt.impl.button.NextButton) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) DefaultHyperlink(org.eclipse.reddeer.uiforms.impl.hyperlink.DefaultHyperlink) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) Shell(org.eclipse.reddeer.swt.api.Shell) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) PropertyDialog(org.eclipse.reddeer.eclipse.ui.dialogs.PropertyDialog) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) FacetsPropertyPage(org.eclipse.reddeer.eclipse.wst.common.project.facet.ui.FacetsPropertyPage) JpaFacetInstallPage(org.jboss.tools.hibernate.reddeer.wizard.JpaFacetInstallPage)

Aggregations

DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)129 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)84 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)83 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)57 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)49 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)46 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)41 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)36 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)30 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)28 Test (org.junit.Test)27 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)25 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)18 Shell (org.eclipse.reddeer.swt.api.Shell)17 DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)17 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)17 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)16 CoreLayerException (org.eclipse.reddeer.core.exception.CoreLayerException)16 YesButton (org.eclipse.reddeer.swt.impl.button.YesButton)16 DefaultTable (org.eclipse.reddeer.swt.impl.table.DefaultTable)16