Search in sources :

Example 1 with ContainerCopyFrom

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

Aggregations

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