use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView in project eclipse-integration-commons by spring-projects.
the class SWTBotUtils method getView.
/**
* Gets a view by name. It assumes the view MUST be opened, although not
* necessarily active. Open the view first if necessary.
*
* @return Active, focused explorer view
*/
public static SWTBotView getView(SWTWorkbenchBot bot, String name) {
SWTBotView explorer = bot.viewByTitle(name);
explorer.setFocus();
return explorer;
}
use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView 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.eclipse.finder.widgets.SWTBotView in project linuxtools by eclipse.
the class DockerConnectionManagerUtils method configureConnectionManager.
/**
* Configures the {@link DockerConnectionManager} with the given array of
* {@link IDockerConnection} (can be mocked) and refreshes the associated
* {@link DockerExplorerView}.
*
* @param connectionStorageManager
* the {@link IDockerConnectionStorageManager} to use (can be
* mocked)
*/
public static void configureConnectionManager(final IDockerConnectionStorageManager connectionStorageManager) {
DockerConnectionManager.getInstance().setConnectionStorageManager(connectionStorageManager);
final SWTWorkbenchBot bot = new SWTWorkbenchBot();
final SWTBotView dockerExplorerBotView = SWTUtils.getSWTBotView(bot, DockerExplorerView.VIEW_ID);
final SWTBotView dockerContainersBotView = SWTUtils.getSWTBotView(bot, DockerContainersView.VIEW_ID);
SWTUtils.syncExec(() -> {
DockerConnectionManager.getInstance().reloadConnections();
if (dockerExplorerBotView != null) {
final DockerExplorerView dockerExplorerView = (DockerExplorerView) dockerExplorerBotView.getViewReference().getView(false);
if (dockerExplorerView != null) {
dockerExplorerView.getCommonViewer().refresh();
dockerExplorerView.showConnectionsOrExplanations();
}
}
if (dockerContainersBotView != null) {
final DockerContainersView dockerContainersView = (DockerContainersView) dockerContainersBotView.getViewReference().getView(false);
if (dockerContainersView != null) {
dockerContainersView.getViewer().refresh();
}
}
});
}
use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView in project linuxtools by eclipse.
the class SWTUtils method getView.
@SuppressWarnings("unchecked")
public static <T> T getView(final SWTWorkbenchBot bot, final String viewId, final boolean restore) {
final SWTBotView viewBot = bot.viewById(viewId);
viewBot.setFocus();
return (T) viewBot.getReference().getView(restore);
}
use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method shouldShowSelectedConnectionInPropertiesView.
@Test
public void shouldShowSelectedConnectionInPropertiesView() {
// given
final DockerClient client = MockDockerClientFactory.build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
// open the context menu on one the container
selectConnectionInTreeView("Test");
// show container info in Properties view
SWTUtils.getContextMenu(dockerExplorerViewBot.bot().tree(), "Show In", "Properties").click();
// the properties view should be visible
assertThat(this.bot.viewById("org.eclipse.ui.views.PropertySheet").isActive()).isEqualTo(true);
SWTBotView propertiesViewBot = bot.viewById("org.eclipse.ui.views.PropertySheet");
SWTUtils.getContextMenu(propertiesViewBot.bot().tree().select(1), "Copy").click();
this.dockerExplorerView = (DockerExplorerView) (dockerExplorerViewBot.getViewReference().getView(true));
}
Aggregations