Search in sources :

Example 1 with PropertyDialog

use of org.eclipse.reddeer.eclipse.ui.dialogs.PropertyDialog 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 2 with PropertyDialog

use of org.eclipse.reddeer.eclipse.ui.dialogs.PropertyDialog in project jbosstools-hibernate by jbosstools.

the class MappingFileTest method createMappingFileWithNoConfig.

// JBIDE-21766
@Test
public void createMappingFileWithNoConfig() {
    ProjectExplorer pe = new ProjectExplorer();
    pe.open();
    PropertyDialog pd = pe.getProject(PRJ).openProperties();
    pd.select("Hibernate Settings");
    new DefaultCombo(pd).setSelection("<None>");
    pd.ok();
    createMappingFileFromFile();
}
Also used : ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) DefaultCombo(org.eclipse.reddeer.swt.impl.combo.DefaultCombo) PropertyDialog(org.eclipse.reddeer.eclipse.ui.dialogs.PropertyDialog) Test(org.junit.Test)

Example 3 with PropertyDialog

use of org.eclipse.reddeer.eclipse.ui.dialogs.PropertyDialog 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)

Example 4 with PropertyDialog

use of org.eclipse.reddeer.eclipse.ui.dialogs.PropertyDialog in project jbosstools-hibernate by jbosstools.

the class MappingFileTest method createMappingFilePackageWithNoConfig.

// JBIDE-21766
@Test
public void createMappingFilePackageWithNoConfig() {
    ProjectExplorer pe = new ProjectExplorer();
    pe.open();
    PropertyDialog pd = pe.getProject(PRJ).openProperties();
    pd.select("Hibernate Settings");
    new DefaultCombo(pd).setSelection("<None>");
    pd.ok();
    createMappingFileFromPackage();
}
Also used : ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) DefaultCombo(org.eclipse.reddeer.swt.impl.combo.DefaultCombo) PropertyDialog(org.eclipse.reddeer.eclipse.ui.dialogs.PropertyDialog) Test(org.junit.Test)

Example 5 with PropertyDialog

use of org.eclipse.reddeer.eclipse.ui.dialogs.PropertyDialog in project jbosstools-hibernate by jbosstools.

the class ProjectConfigurationFactory method convertProjectToFacetsForm.

/**
 * Convert project to facet form
 * @param prj given project name
 */
public static void convertProjectToFacetsForm(String prj) {
    ProjectExplorer pe = new ProjectExplorer();
    pe.open();
    PropertyDialog pd = pe.getProject(prj).openProperties();
    pd.select("Project Facets");
    // convert to faceted form
    new DefaultTreeItem("Project Facets").select();
    new DefaultLink("Convert to faceted form...").click();
    new WaitWhile(new JobIsRunning());
    new WaitUntil(new WidgetIsFound(Button.class, new WithStyleMatcher(SWT.PUSH), new WithMnemonicTextMatcher("Apply")), TimePeriod.LONG);
    PushButton apply = new PushButton("Apply");
    new WaitUntil(new ControlIsEnabled(apply));
    apply.click();
    pd.ok();
}
Also used : ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) WithStyleMatcher(org.eclipse.reddeer.core.matcher.WithStyleMatcher) DefaultLink(org.eclipse.reddeer.swt.impl.link.DefaultLink) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) PropertyDialog(org.eclipse.reddeer.eclipse.ui.dialogs.PropertyDialog) WithMnemonicTextMatcher(org.eclipse.reddeer.core.matcher.WithMnemonicTextMatcher) WidgetIsFound(org.eclipse.reddeer.core.condition.WidgetIsFound) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) Button(org.eclipse.swt.widgets.Button) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) NextButton(org.eclipse.reddeer.swt.impl.button.NextButton) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton)

Aggregations

PropertyDialog (org.eclipse.reddeer.eclipse.ui.dialogs.PropertyDialog)5 ProjectExplorer (org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer)5 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)3 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)3 FacetsPropertyPage (org.eclipse.reddeer.eclipse.wst.common.project.facet.ui.FacetsPropertyPage)2 Shell (org.eclipse.reddeer.swt.api.Shell)2 TreeItem (org.eclipse.reddeer.swt.api.TreeItem)2 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)2 NextButton (org.eclipse.reddeer.swt.impl.button.NextButton)2 DefaultCombo (org.eclipse.reddeer.swt.impl.combo.DefaultCombo)2 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)2 DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)2 DefaultHyperlink (org.eclipse.reddeer.uiforms.impl.hyperlink.DefaultHyperlink)2 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)2 JpaFacetInstallPage (org.jboss.tools.hibernate.reddeer.wizard.JpaFacetInstallPage)2 Test (org.junit.Test)2 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)1 WidgetIsFound (org.eclipse.reddeer.core.condition.WidgetIsFound)1 WithMnemonicTextMatcher (org.eclipse.reddeer.core.matcher.WithMnemonicTextMatcher)1 WithStyleMatcher (org.eclipse.reddeer.core.matcher.WithStyleMatcher)1