Search in sources :

Example 16 with SWTBotShell

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project linuxtools by eclipse.

the class SVNReporsitoriesView method open.

/**
 * Open the SVNRepositoriesView
 */
public SVNReporsitoriesView open() {
    bot.menu("Window").menu("Show View").menu("Other...").click();
    SWTBotShell shell = bot.shell("Show View");
    shell.activate();
    bot.tree().expandNode("SVN").select("SVN Repositories");
    bot.button("OK").click();
    return this;
}
Also used : SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)

Example 17 with SWTBotShell

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project linuxtools by eclipse.

the class CloseShellRule method isInDialog.

private static boolean isInDialog(final SWTWorkbenchBot bot) {
    final SWTBotShell activeShell = bot.activeShell();
    final String text = SWTUtils.syncExec(() -> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getText());
    final String shellText = activeShell.getText();
    return text != null && !text.equals(shellText);
}
Also used : SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)

Example 18 with SWTBotShell

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project linuxtools by eclipse.

the class BuildDockerImageShortcutSWTBotTest method shouldNotBuildDockerImageOnSecondCallWhenAllConnectionWereRemoved.

@Test
@RunWithProject("foo")
public void shouldNotBuildDockerImageOnSecondCallWhenAllConnectionWereRemoved() throws InterruptedException, com.spotify.docker.client.exceptions.DockerException, IOException {
    // given
    final DockerClient client = MockDockerClientFactory.build();
    final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
    DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
    // when
    SWTUtils.asyncExec(() -> getRunAsdockerImageBuildContextMenu("foo", "Dockerfile").click());
    // then expect a dialog, fill the "repository" text field and click "Ok"
    assertThat(bot.shell(WizardMessages.getString("ImageBuildDialog.title"))).isNotNull();
    bot.textWithLabel(WizardMessages.getString("ImageBuildDialog.repoNameLabel")).setText("foo/bar:latest");
    // when launching the build
    SWTUtils.syncExec(() -> {
        bot.button("OK").click();
    });
    // then the 'DockerConnection#buildImage(...) method should have been
    // called within the specified timeout
    Mockito.verify(client, Mockito.timeout((int) TimeUnit.SECONDS.toMillis(30)).times(1)).build(Matchers.any(Path.class), Matchers.any(String.class), Matchers.any(ProgressHandler.class), Matchers.anyVararg());
    // when trying to call again after connection was removed, there should
    // be an error dialog
    DockerConnectionManager.getInstance().removeConnection(dockerConnection);
    SWTUtils.asyncExec(() -> getRunAsdockerImageBuildContextMenu("foo", "Dockerfile").click(), false);
    final SWTBotShell shell = bot.shell("Edit Configuration");
    assertThat(shell).isNotNull();
    assertThat(shell.bot().button("Run").isEnabled()).isFalse();
    // closing the wizard
    SWTUtils.asyncExec(() -> {
        shell.bot().button(IDialogConstants.CLOSE_LABEL).click();
    }, false);
    // do not save the config while closing
    SWTUtils.syncExec(() -> {
        bot.button(IDialogConstants.NO_LABEL).click();
    });
}
Also used : DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) Path(java.nio.file.Path) DockerClient(com.spotify.docker.client.DockerClient) ProgressHandler(com.spotify.docker.client.ProgressHandler) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) Test(org.junit.Test) RunWithProject(org.eclipse.linuxtools.internal.docker.ui.testutils.RunWithProject)

Example 19 with SWTBotShell

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project eclipse-pmd by acanda.

the class EnablePMDTest method enablePMD.

@Test
public void enablePMD() {
    SWTBotShell dialog = JavaProjectClient.openPMDPropertyDialog(PROJECT_NAME);
    SWTBotCheckBox enablePMDCheckBox = dialog.bot().checkBoxWithId(SWTBotID.ENABLE_PMD.name());
    assertFalse("PMD should be disabled by default", enablePMDCheckBox.isChecked());
    enablePMDCheckBox.select();
    dialog.bot().button("OK").click();
    bot().waitUntil(org.eclipse.swtbot.swt.finder.waits.Conditions.shellCloses(dialog));
    dialog = JavaProjectClient.openPMDPropertyDialog(PROJECT_NAME);
    enablePMDCheckBox = dialog.bot().checkBoxWithId(SWTBotID.ENABLE_PMD.name());
    assertTrue("PMD should be enabled", enablePMDCheckBox.isChecked());
    dialog.bot().button("OK").click();
    bot().waitUntil(org.eclipse.swtbot.swt.finder.waits.Conditions.shellCloses(dialog));
}
Also used : SWTBotCheckBox(org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) Test(org.junit.Test)

Example 20 with SWTBotShell

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project translationstudio8 by heartsome.

the class ProjectDelete method deletePrj.

/**
	 * 删除项目
	 * @param name
	 *            项目名称
	 * @param deleteContent
	 *            是否同时删除项目文件夹
	 */
public void deletePrj(Entry from, String name, boolean deleteContent) {
    ProjectTreeView ptv = ProjectTreeView.getInstance();
    SWTBotTree treePrj = ProjectTreeView.getTree();
    Waits.prjExistOnTree(name);
    // 取消选中任何项目,避免误操作
    treePrj.unselect();
    // 选择项目并删除
    treePrj.select(name).isActive();
    switch(from) {
        case CONTEXT_MENU:
            {
                ptv.ctxMenuDelete().click();
                break;
            }
        case MENU:
            {
                TS.getInstance().menuEditDelete().click();
                break;
            }
        default:
            {
                assertTrue("无此入口:" + from, false);
            }
    }
    // 确认删除对话框
    ConfirmProjectDeleteDialog cpd = new ConfirmProjectDeleteDialog(name);
    cpd.isActive();
    // 选择是否删除内容
    if (deleteContent) {
        cpd.radBtnAlsoDeleteContentsUnder().click();
        cpd.btnYes().click();
        Waits.shellClosed(cpd);
        SWTBotShell[] shells = HSBot.bot().shells();
        if (shells.length > 1) {
            ProgressDialog dlgProg = new ProgressDialog("dlgTitleProgressDeleteResource");
            Waits.shellClosed(dlgProg);
        }
        Waits.prjNotExistOnTree(name);
        Waits.prjNotExistInWorkspace(name);
    } else {
        cpd.radBtnDoNotDeleteContents().click();
        cpd.btnYes().click();
        Waits.shellClosed(cpd);
        SWTBotShell[] shells = HSBot.bot().shells();
        if (shells.length > 1) {
            ProgressDialog dlgProg = new ProgressDialog("dlgTitleProgressDeleteResource");
            Waits.shellClosed(dlgProg);
        }
        Waits.prjNotExistOnTree(name);
        Waits.prjExistInWorkspace(name);
    }
}
Also used : ConfirmProjectDeleteDialog(net.heartsome.cat.ts.test.ui.msgdialogs.ConfirmProjectDeleteDialog) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) ProgressDialog(net.heartsome.cat.ts.test.ui.msgdialogs.ProgressDialog) ProjectTreeView(net.heartsome.cat.ts.test.ui.views.ProjectTreeView)

Aggregations

SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)41 Test (org.junit.Test)14 SWTWorkbenchBot (org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot)8 SWTBotTable (org.eclipse.swtbot.swt.finder.widgets.SWTBotTable)6 SWTBotTree (org.eclipse.swtbot.swt.finder.widgets.SWTBotTree)6 SWTBotEclipseEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor)5 SWTBotCombo (org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo)5 SWTBotText (org.eclipse.swtbot.swt.finder.widgets.SWTBotText)5 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)5 WidgetNotFoundException (org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException)4 Point (org.eclipse.swt.graphics.Point)3 SWTBotEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor)3 SWTBot (org.eclipse.swtbot.swt.finder.SWTBot)3 SWTBotMenu (org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu)3 BeforeClass (org.junit.BeforeClass)3 DockerClient (com.spotify.docker.client.DockerClient)2 ProgressHandler (com.spotify.docker.client.ProgressHandler)2 Path (java.nio.file.Path)2 IFile (org.eclipse.core.resources.IFile)2 IWorkspace (org.eclipse.core.resources.IWorkspace)2