Search in sources :

Example 1 with ContainerCopyTo

use of org.eclipse.linuxtools.internal.docker.ui.wizards.ContainerCopyTo 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;
}
Also used : IDockerContainer(org.eclipse.linuxtools.docker.core.IDockerContainer) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) ContainerCopyTo(org.eclipse.linuxtools.internal.docker.ui.wizards.ContainerCopyTo) IDockerConnection(org.eclipse.linuxtools.docker.core.IDockerConnection)

Aggregations

IDockerConnection (org.eclipse.linuxtools.docker.core.IDockerConnection)1 IDockerContainer (org.eclipse.linuxtools.docker.core.IDockerContainer)1 ContainerCopyTo (org.eclipse.linuxtools.internal.docker.ui.wizards.ContainerCopyTo)1 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)1