Search in sources :

Example 6 with TreeItem

use of org.eclipse.reddeer.swt.api.TreeItem 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 7 with TreeItem

use of org.eclipse.reddeer.swt.api.TreeItem in project jbosstools-openshift by jbosstools.

the class DeployDockerImageTest method debugDockerImageTest.

/**
 * Auxiliary method for helping with debugging JBIDE-23841.
 * This method maximizes Docker explorer view, captures screenshot and restores the view back.
 * It also gathers some info and returns it.
 */
private static String debugDockerImageTest() {
    String message = "";
    DockerExplorerView dockerExplorerView = new DockerExplorerView();
    dockerExplorerView.maximize();
    try {
        ScreenshotCapturer.getInstance().captureScreenshot("DeployDockerImageTest#setup");
    } catch (CaptureScreenshotException e) {
        // Capturing screenshot was not successfull. No big deal.
        LOGGER.debug("Capturing screenshot was not succesfull.");
    }
    dockerExplorerView.restore();
    List<String> names = dockerExplorerView.getDockerConnectionNames();
    for (String name : names) {
        DockerConnection connection = dockerExplorerView.getDockerConnectionByName(name);
        TreeItem treeItem = connection.getTreeItem();
        message += "TreeItem for connection \"" + name + "\": " + treeItem.getText() + "\n";
    }
    return message;
}
Also used : DockerConnection(org.eclipse.linuxtools.docker.reddeer.ui.resources.DockerConnection) DockerExplorerView(org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) CaptureScreenshotException(org.eclipse.reddeer.junit.screenshot.CaptureScreenshotException)

Example 8 with TreeItem

use of org.eclipse.reddeer.swt.api.TreeItem in project jbosstools-openshift by jbosstools.

the class CDKServerWizardAbstractTest method assertServerType.

protected void assertServerType(final String serverType) {
    NewCDKServerWizard wizard = (NewCDKServerWizard) CDKTestUtils.openNewServerWizardDialog();
    try {
        TreeItem item = new DefaultTreeItem(new String[] { SERVER_TYPE_GROUP }).getItem(serverType);
        item.select();
        assertTrue(item.getText().equalsIgnoreCase(serverType));
        new WaitWhile(new JobIsRunning(), TimePeriod.MEDIUM, false);
    } catch (CoreLayerException coreExp) {
        log.error(coreExp.getMessage());
        fail("Server type " + serverType + " was not found in New Server Wizard");
    }
    assertEquals(new LabeledText("Server's host name:").getText(), "localhost");
    assertEquals(new LabeledText("Server name:").getText(), getServerAdapter());
    new WaitUntil(new ControlIsEnabled(new NextButton()), TimePeriod.MEDIUM, false);
    assertTrue("Dialog button Next is not enabled!", wizard.isNextEnabled());
    try {
        new WaitWhile(new JobIsRunning(), TimePeriod.MEDIUM, false);
        new CancelButton().click();
    } catch (WaitTimeoutExpiredException exc) {
        exc.printStackTrace();
        log.error("Dialog could not be canceled because there were unfinished jobs running after timeout" + "\n\rTrying to cancel dialog manually");
        new DefaultShell("New Server").close();
    }
}
Also used : NextButton(org.eclipse.reddeer.swt.impl.button.NextButton) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) CancelButton(org.eclipse.reddeer.swt.impl.button.CancelButton) SystemJobIsRunning(org.jboss.tools.cdk.reddeer.core.condition.SystemJobIsRunning) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) NewCDKServerWizard(org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDKServerWizard) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException)

Example 9 with TreeItem

use of org.eclipse.reddeer.swt.api.TreeItem in project jbosstools-openshift by jbosstools.

the class DebuggingEAPAppTest method checkDebugView.

private void checkDebugView() {
    LaunchView debugView = new LaunchView();
    debugView.open();
    TreeItem createHelloMessageDebugItem = ensureCorrectFrameIsSelected(debugView);
    assertTrue(createHelloMessageDebugItem.getText().contains("createHelloMessage"));
}
Also used : TreeItem(org.eclipse.reddeer.swt.api.TreeItem) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) LaunchView(org.eclipse.reddeer.eclipse.debug.ui.views.launch.LaunchView)

Example 10 with TreeItem

use of org.eclipse.reddeer.swt.api.TreeItem in project jbosstools-openshift by jbosstools.

the class NodeJSAppDebugTest method getVariable.

/**
 * getVariable from Variables view.
 *
 * @param variable
 *            name
 * @return TreeItem
 */
protected TreeItem getVariable(String name) {
    WorkbenchView variables = new WorkbenchView("Variables");
    variables.activate();
    DefaultTree variablesTree = new DefaultTree();
    TreeItem var = null;
    try {
        new WaitUntil(new TreeContainsItem(variablesTree, new WithTextMatcher(name), false));
    } catch (WaitTimeoutExpiredException e) {
        // not found
        return null;
    }
    List<TreeItem> vars = variablesTree.getItems();
    for (TreeItem i : vars) {
        if (i.getText().equals(name)) {
            var = i;
        }
    }
    return var;
}
Also used : DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) WorkbenchView(org.eclipse.reddeer.workbench.impl.view.WorkbenchView) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) WithTextMatcher(org.eclipse.reddeer.core.matcher.WithTextMatcher) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil)

Aggregations

TreeItem (org.eclipse.reddeer.swt.api.TreeItem)27 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)10 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)9 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)9 DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)8 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)7 DefaultTree (org.eclipse.reddeer.swt.impl.tree.DefaultTree)7 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)6 CoreLayerException (org.eclipse.reddeer.core.exception.CoreLayerException)6 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)6 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)5 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)5 ArrayList (java.util.ArrayList)4 ProjectExplorer (org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer)4 Shell (org.eclipse.reddeer.swt.api.Shell)4 Test (org.junit.Test)4 LaunchView (org.eclipse.reddeer.eclipse.debug.ui.views.launch.LaunchView)3 CaptureScreenshotException (org.eclipse.reddeer.junit.screenshot.CaptureScreenshotException)3 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)3 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)3