use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem 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;
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem in project xtext-xtend by eclipse.
the class SwtBotProjectHelper method clearSourceFolderContents.
public static void clearSourceFolderContents(final SWTWorkbenchBot it, final String project) {
try {
try {
SWTBotTree packageExplorerTree = it.tree();
boolean _hasItems = it.tree().hasItems();
boolean _not = (!_hasItems);
if (_not) {
packageExplorerTree = it.viewByTitle("Package Explorer").bot().tree();
}
final SWTBotTreeItem srcNode = SwtBotProjectHelper.expandNode(SwtBotProjectHelper.expandNode(packageExplorerTree, project), "src");
SWTBotTreeItem[] _items = srcNode.getItems();
for (final SWTBotTreeItem source : _items) {
boolean _isDisposed = source.widget.isDisposed();
boolean _not_1 = (!_isDisposed);
if (_not_1) {
InputOutput.<SWTBotText>println(it.text());
srcNode.select(source.getText());
source.contextMenu("Delete").click();
it.shell("Delete").activate();
it.button("OK").click();
}
}
} catch (final Throwable _t) {
if (_t instanceof WidgetNotFoundException) {
final Consumer<IResource> _function = (IResource it_1) -> {
try {
it_1.delete(true, null);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
};
((List<IResource>) Conversions.doWrapArray(ResourcesPlugin.getWorkspace().getRoot().getProject(project).getFolder("src").members())).forEach(_function);
} else {
throw Exceptions.sneakyThrow(_t);
}
}
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem in project linuxtools by eclipse.
the class CommandUtilsSWTBotTest method shouldRetrieveConnectionFromSelectedContainerPort.
@Test
public void shouldRetrieveConnectionFromSelectedContainerPort() {
// given
final DockerClient client = MockDockerClientFactory.container(MockContainerFactory.name("foo_bar").build(), MockContainerInfoFactory.port("8080/tcp", "0.0.0.0", "8080").build()).build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
final SWTBotTreeItem port = SWTUtils.expand(dockerExplorerViewBot.bot().tree(), "Test", "Containers", "foo_bar", "Ports", "0.0.0.0:8080 -> 8080 (tcp)");
// when selecting the port
port.select();
// then current connection should be found
Assertions.assertThat(CommandUtils.getCurrentConnection(dockerExplorerView)).isEqualTo(dockerConnection);
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem in project linuxtools by eclipse.
the class CommandUtilsSWTBotTest method shouldRetrieveConnectionFromSelectedContainerVolume.
@Test
public void shouldRetrieveConnectionFromSelectedContainerVolume() {
// given
final DockerClient client = MockDockerClientFactory.container(MockContainerFactory.name("foo_bar").build(), MockContainerInfoFactory.volume("/path/to/host:/path/to/container:Z,ro").build()).build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
final SWTBotTreeItem volume = SWTUtils.expand(dockerExplorerViewBot.bot().tree(), "Test", "Containers", "foo_bar", "Volumes", "/path/to/host");
// when selecting the volume
volume.select();
// then current connection should be found
Assertions.assertThat(CommandUtils.getCurrentConnection(dockerExplorerView)).isEqualTo(dockerConnection);
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem in project linuxtools by eclipse.
the class CommandUtilsSWTBotTest method shouldRetrieveConnectionFromSelectedContainerLinksCategory.
@Test
public void shouldRetrieveConnectionFromSelectedContainerLinksCategory() {
// given
final DockerClient client = MockDockerClientFactory.container(MockContainerFactory.name("foo_bar").build(), MockContainerInfoFactory.link("/foo:/bar/foo").build()).build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
final SWTBotTreeItem links = SWTUtils.expand(dockerExplorerViewBot.bot().tree(), "Test", "Containers", "foo_bar", "Links");
// when
links.select();
// then current connection should be found
Assertions.assertThat(CommandUtils.getCurrentConnection(dockerExplorerView)).isEqualTo(dockerConnection);
}
Aggregations