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;
}
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);
}
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();
});
}
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));
}
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);
}
}
Aggregations