use of org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu in project xtext-xtend by eclipse.
the class AbstractRefactoringSwtBotTest method renameInJavaEditor.
public void renameInJavaEditor(final SWTBotEclipseEditor javaEditor, final String newName, final String dialogName) {
final SWTBotMenu renameMenuItem = SwtBotProjectHelper.clickableContextMenu(javaEditor, "Refactor", "Rename...");
renameMenuItem.click();
boolean _isUseInlineRefactoring = this.testParams.isUseInlineRefactoring();
if (_isUseInlineRefactoring) {
javaEditor.typeText(newName);
boolean _isUsePreview = this.testParams.isUsePreview();
if (_isUsePreview) {
javaEditor.pressShortcut(SWT.CTRL, SWT.CR);
AbstractRefactoringSwtBotTest.bot.shell(dialogName).activate();
AbstractRefactoringSwtBotTest.bot.button("OK").click();
} else {
javaEditor.pressShortcut(KeyStroke.getInstance(SWT.LF));
}
} else {
SWTBot _bot = AbstractRefactoringSwtBotTest.bot.shell(dialogName).activate().bot();
final Procedure1<SWTBot> _function = (SWTBot it) -> {
SWTBotText _textWithLabel = it.textWithLabel("New name:");
_textWithLabel.setText(newName);
boolean _isUsePreview_1 = this.testParams.isUsePreview();
if (_isUsePreview_1) {
it.button("Next").click();
}
it.button("Finish").click();
};
ObjectExtensions.<SWTBot>operator_doubleArrow(_bot, _function);
}
this.waitForRefactoring(javaEditor);
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu in project linuxtools by eclipse.
the class DockerComposeSWTBotTest method getRunAsDockerComposeContextMenu.
/**
* @return the {@link SWTBotMenu} for the "Run as > Docker Image Build"
* shortcut
*/
private SWTBotMenu getRunAsDockerComposeContextMenu(final String projectName, final String dockerComposeFileName) {
final SWTBotView projectExplorerBotView = this.projectExplorerViewRule.getProjectExplorerBotView();
// make sure the project explorer view is visible, in case it was hidden
// by another view.
projectExplorerBotView.setFocus();
final SWTBotTreeItem fooProjectTreeItem = SWTUtils.getTreeItem(projectExplorerBotView, projectName);
assertThat(fooProjectTreeItem).isNotNull();
SWTUtils.syncExec(() -> fooProjectTreeItem.expand());
final SWTBotTreeItem dockerfileTreeItem = SWTUtils.getTreeItem(fooProjectTreeItem, dockerComposeFileName);
assertThat(dockerfileTreeItem).isNotNull();
SWTUtils.select(dockerfileTreeItem);
final SWTBotMenu runAsDockerComposeMenu = SWTUtils.getContextMenu(projectExplorerBotView.bot().tree(), "Run As", "1 Docker Compose");
return runAsDockerComposeMenu;
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu in project linuxtools by eclipse.
the class SWTUtils method getSubMenu.
/**
* @param menu
* the parent menu
* @param path
* the path for the menu
* @return the child {@link SWTBotMenu} named with the first item in the
* given <code>path</code> from the given {@link SWTBotMenu}
*/
public static SWTBotMenu getSubMenu(final SWTBotMenu menu, String... path) {
final SWTBotMenu subMenu = menu.menu(path[0]);
if (subMenu == null) {
Assert.fail("Failed to find submenu '" + path[0] + "'.");
}
if (path.length == 1) {
return subMenu;
}
final String[] remainingPath = new String[path.length - 1];
System.arraycopy(path, 1, remainingPath, 0, remainingPath.length);
return getSubMenu(subMenu, remainingPath);
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu in project linuxtools by eclipse.
the class SWTUtils method getContextMenu.
/**
* @param tree
* the root {@link SWTBotTree}
* @param path
* the path for the menu
* @return the child {@link SWTBotMenu} named with the first item in the
* given <code>path</code> from the given {@link SWTBotTree}
*/
public static SWTBotMenu getContextMenu(final SWTBotTree tree, String... path) {
final SWTBotMenu contextMenu = tree.contextMenu(path[0]);
if (contextMenu == null) {
Assert.fail("Failed to find context menu '" + path[0] + "'.");
}
if (path.length == 1) {
return contextMenu;
}
final String[] remainingPath = new String[path.length - 1];
System.arraycopy(path, 1, remainingPath, 0, remainingPath.length);
return getSubMenu(contextMenu, remainingPath);
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method shouldProvideEnabledUnpauseCommandOnMultipleContainersAtOnce.
@Test
public void shouldProvideEnabledUnpauseCommandOnMultipleContainersAtOnce() {
// given
final DockerClient client = MockDockerClientFactory.container(MockContainerFactory.name("gentle_foo").status("Up (Paused)").build()).container(MockContainerFactory.name("angry_bar").status("Up (Paused)").build()).build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
// open the context menu on one of the containers
selectContainersInTreeView("Test", "gentle_foo", "angry_bar");
final SWTBotMenu menuCommand = dockerExplorerViewBot.bot().tree().contextMenu("Unpause");
// then
MenuAssertion.assertThat(menuCommand).isVisible().isEnabled();
}
Aggregations