use of org.eclipse.linuxtools.internal.docker.ui.views.DockerContainersView in project linuxtools by eclipse.
the class EditDockerConnectionSWTBotTest method shouldRefreshDockerContainersViewWhenConnectionNameChanges.
@Test
public void shouldRefreshDockerContainersViewWhenConnectionNameChanges() {
// given
configureTCPConnection("Test");
final SWTBotTreeItem connectionTreeItem = SWTUtils.getTreeItem(dockerExplorer.bot(), "Test");
assertThat(connectionTreeItem).isNotNull();
// when
openConnectionEditionWizard("Test");
bot.text(0).setText("foo");
getFinishButton().click();
SWTUtils.wait(2, TimeUnit.SECONDS);
// then
final DockerContainersView dockerContainersView = dockerContainers.view();
final String formTitle = SWTUtils.syncExec(() -> dockerContainersView.getFormTitle());
assertThat(formTitle).contains("foo");
}
use of org.eclipse.linuxtools.internal.docker.ui.views.DockerContainersView in project linuxtools by eclipse.
the class FilterContainersWithLabelsCommandHandler method execute.
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
final IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
final boolean checked = !HandlerUtil.toggleCommandState(event.getCommand());
if (activePart instanceof DockerContainersView) {
final DockerContainersView containersView = (DockerContainersView) activePart;
containersView.showContainersWithLabels(checked);
}
return null;
}
use of org.eclipse.linuxtools.internal.docker.ui.views.DockerContainersView in project linuxtools by eclipse.
the class RemoveContainerLogCommandHandler method execute.
@Override
public Object execute(final ExecutionEvent event) {
final IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
List<IDockerContainer> selectedContainers = CommandUtils.getSelectedContainers(activePart);
if (activePart instanceof DockerContainersView) {
connection = ((DockerContainersView) activePart).getConnection();
}
if (selectedContainers.size() != 1 || connection == null)
return null;
container = selectedContainers.get(0);
IDockerContainerInfo info = connection.getContainerInfo(container.id());
if (info.config().tty()) {
Map<String, Object> properties = new HashMap<>();
properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, "org.eclipse.tm.terminal.connector.streams.launcher.streams");
properties.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tm.terminal.connector.streams.StreamsConnector");
properties.put(ITerminalsConnectorConstants.PROP_TITLE, info.name());
ITerminalService service = TerminalServiceFactory.getService();
service.closeConsole(properties, null);
return null;
}
final RunConsole rc = RunConsole.findConsole(container);
if (rc != null) {
RunConsole.removeConsole(rc);
}
return null;
}
use of org.eclipse.linuxtools.internal.docker.ui.views.DockerContainersView in project linuxtools by eclipse.
the class ShowAllContainersCommandHandler method execute.
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
final IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
final boolean checked = !HandlerUtil.toggleCommandState(event.getCommand());
if (activePart instanceof DockerContainersView) {
final DockerContainersView containersView = (DockerContainersView) activePart;
containersView.showAllContainers(checked);
}
return null;
}
use of org.eclipse.linuxtools.internal.docker.ui.views.DockerContainersView 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();
}
}
});
}
Aggregations