use of org.eclipse.linuxtools.docker.core.IDockerContainer in project linuxtools by eclipse.
the class CommitContainerCommandHandler method execute.
@Override
public Object execute(final ExecutionEvent event) {
final IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
List<IDockerContainer> selectedContainers = CommandUtils.getSelectedContainers(activePart);
final IDockerConnection connection = CommandUtils.getCurrentConnection(activePart);
if (selectedContainers.size() != 1 || connection == null)
return null;
final IDockerContainer container = selectedContainers.get(0);
final ContainerCommit wizard = new ContainerCommit(container.id());
final boolean commitContainer = CommandUtils.openWizard(wizard, HandlerUtil.getActiveShell(event));
if (commitContainer) {
performCommitContainer(wizard, connection, container);
}
return null;
}
use of org.eclipse.linuxtools.docker.core.IDockerContainer in project linuxtools by eclipse.
the class CopyFromContainerCommandHandler method execute.
@Override
public Object execute(final ExecutionEvent event) {
final IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
final IDockerConnection connection = CommandUtils.getCurrentConnection(activePart);
final List<IDockerContainer> selectedContainers = CommandUtils.getSelectedContainers(activePart);
if (selectedContainers.size() != 1) {
return null;
}
final IDockerContainer container = selectedContainers.get(0);
if (connection == null) {
MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), CommandMessages.getString(MISSING_CONNECTION), CommandMessages.getString(ERROR_COPYING_FROM_CONTAINER_NO_CONNECTION));
} else {
final ContainerCopyFrom wizard = new ContainerCopyFrom(connection, container);
final boolean copyFromContainer = CommandUtils.openWizard(wizard, HandlerUtil.getActiveShell(event));
if (copyFromContainer) {
performCopyFromContainer(connection, container, wizard.getTarget(), wizard.getSources());
}
}
return null;
}
use of org.eclipse.linuxtools.docker.core.IDockerContainer in project linuxtools by eclipse.
the class CopyToContainerCommandHandler method execute.
@Override
public Object execute(final ExecutionEvent event) {
final IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
final IDockerConnection connection = CommandUtils.getCurrentConnection(activePart);
final List<IDockerContainer> selectedContainers = CommandUtils.getSelectedContainers(activePart);
if (selectedContainers.size() != 1) {
return null;
}
final IDockerContainer container = selectedContainers.get(0);
if (connection == null) {
MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), CommandMessages.getString(MISSING_CONNECTION), CommandMessages.getString(ERROR_COPYING_TO_CONTAINER_NO_CONNECTION));
} else {
final ContainerCopyTo wizard = new ContainerCopyTo(connection, container);
final boolean copyToContainer = CommandUtils.openWizard(wizard, HandlerUtil.getActiveShell(event));
if (copyToContainer) {
performCopyToContainer(connection, container, wizard.getTarget(), wizard.getSources());
}
}
return null;
}
use of org.eclipse.linuxtools.docker.core.IDockerContainer 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.docker.core.IDockerContainer in project linuxtools by eclipse.
the class RemoveContainersCommandHandler method confirmed.
@Override
boolean confirmed(List<IDockerContainer> selectedContainers) {
// ask for confirmation before deleting images
List<String> containersToRemove = new ArrayList<>();
for (IDockerContainer container : selectedContainers) {
containersToRemove.add(container.name());
}
final List<String> names = containersToRemove;
final DialogResponse response = new DialogResponse();
Display.getDefault().syncExec(() -> {
boolean result = MessageDialog.openConfirm(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), DVMessages.getString(CONTAINER_REMOVE_CONFIRM), DVMessages.getFormattedString(CONTAINER_REMOVE_LIST, names.toString()));
response.setResponse(result);
});
return response.getResponse();
}
Aggregations