Search in sources :

Example 6 with SWTBotTree

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

the class ImageRunSWTBotTest method shouldNotReportErrorIfNoContainerWithSameNameExists.

@Test
public void shouldNotReportErrorIfNoContainerWithSameNameExists() {
    // given
    final DockerClient client = MockDockerClientFactory.image(MockImageFactory.name("foo:latest").build()).container(MockContainerFactory.name("foo_bar").build()).build();
    final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
    DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
    // expand the 'Images' node and select the 'foo' images
    SWTUtils.getTreeItem(dockerExplorerViewBot, "Test", "Images", "foo").select();
    // when opening the "Run Image..." wizard
    final SWTBotTree dockerExplorerViewTreeBot = dockerExplorerViewBot.bot().tree();
    dockerExplorerViewTreeBot.contextMenu("Run...").click();
    // when use an existing container name
    bot.textWithLabel(WizardMessages.getString("ImageRunSelectionPage.containerName")).setText("foo_bar_baz");
    // then
    assertThat(bot.button("Finish").isEnabled()).isEqualTo(true);
}
Also used : IDockerConnection(org.eclipse.linuxtools.docker.core.IDockerConnection) DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) DockerClient(com.spotify.docker.client.DockerClient) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) Test(org.junit.Test)

Example 7 with SWTBotTree

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

the class ImageSearchSWTBotTest method openPullWizard.

private void openPullWizard(final DockerClient client) {
    // given
    final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
    DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
    // expand the 'Images' node
    final SWTBotTreeItem imagesTreeItem = SWTUtils.getTreeItem(dockerExplorerViewBot, "Test", "Images");
    // when opening the "Pull..." wizard
    final SWTBotTree dockerExplorerViewTreeBot = dockerExplorerViewBot.bot().tree();
    imagesTreeItem.select();
    dockerExplorerViewTreeBot.contextMenu("Pull...").click();
}
Also used : DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)

Example 8 with SWTBotTree

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTree 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)

Example 9 with SWTBotTree

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTree in project gfm_viewer by satyagraha.

the class ProjectBot method createSimpleProject.

public static ProjectBot createSimpleProject() {
    String projectName = "Project_" + System.currentTimeMillis();
    bot.menu("File").menu("New").menu("Project...").click();
    SWTBotShell shell = bot.shell("New Project");
    shell.activate();
    bot.tree().expandNode("General").select("Project");
    bot.button("Next >").click();
    bot.textWithLabel("Project name:").setText(projectName);
    bot.button("Finish").click();
    SWTUtils.sleep(2000);
    SWTBotTree projectsTree = bot.viewByTitle("Project Explorer").bot().tree();
    SWTBotTreeItem projectTree = projectsTree.getTreeItem(projectName);
    return new ProjectBot(projectTree);
}
Also used : SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)

Example 10 with SWTBotTree

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTree in project xtext-xtend by eclipse.

the class SwtBotProjectHelper method expandNode.

public static SWTBotTreeItem expandNode(final AbstractSWTBot<?> bot, final String node) {
    SWTBotTreeItem item = null;
    if ((bot instanceof SWTBotTree)) {
        item = ((SWTBotTree) bot).getTreeItem(node);
    } else {
        if ((bot instanceof SWTBotTreeItem)) {
            item = ((SWTBotTreeItem) bot).getNode(node);
        }
    }
    boolean _isExpanded = item.isExpanded();
    boolean _not = (!_isExpanded);
    if (_not) {
        item.expand();
    }
    return item;
}
Also used : SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)

Aggregations

SWTBotTree (org.eclipse.swtbot.swt.finder.widgets.SWTBotTree)18 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)7 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)7 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)4 DockerConnection (org.eclipse.linuxtools.internal.docker.core.DockerConnection)3 Test (org.junit.Test)3 DockerClient (com.spotify.docker.client.DockerClient)2 IDockerConnection (org.eclipse.linuxtools.docker.core.IDockerConnection)2 Shell (org.eclipse.swt.widgets.Shell)2 SWTWorkbenchBot (org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot)2 Consumer (java.util.function.Consumer)1 ConfirmProjectDeleteDialog (net.heartsome.cat.ts.test.ui.msgdialogs.ConfirmProjectDeleteDialog)1 ProgressDialog (net.heartsome.cat.ts.test.ui.msgdialogs.ProgressDialog)1 ProjectTreeView (net.heartsome.cat.ts.test.ui.views.ProjectTreeView)1 IResource (org.eclipse.core.resources.IResource)1 Composite (org.eclipse.swt.widgets.Composite)1 Tree (org.eclipse.swt.widgets.Tree)1 SWTBotEclipseEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor)1 SWTBotMultiPageEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotMultiPageEditor)1 SWTBot (org.eclipse.swtbot.swt.finder.SWTBot)1